[PATCH] objcopy: add option to specify custom symbol name for binary input

Alon Bar-Lev alon.barlev@gmail.com
Sat Oct 25 00:42:22 GMT 2025


On Sat, 25 Oct 2025 at 02:21, H.J. Lu <hjl.tools@gmail.com> wrote:

> On Sat, Oct 25, 2025 at 7:19 AM Alon Bar-Lev <alon.barlev@gmail.com>
> wrote:
> >
> > When using --input-target=binary, objcopy currently derives symbol names
> from
> > a mangled version of the input file name.  This approach can lead to
> > unpredictable results, as the generated symbols depend on the file path
> and
> > working directory.
> >
> > This patch introduces a new option:
> >
> >   --input-symbol <name>    Use <name> as the base symbol name for the
> input file
> >                            (default: derived from file name)
> >
> > It allows specifying an explicit symbol name, while preserving the
> existing
> > behavior as a fallback.
> >
> > Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
> > ---
>
> Tests are missing.
>
> --
> H.J.
>

Hi,

I could not find reference to tests for the current implementation.
I added tests, I had to guess the target output, please let me know if
there is a better method.

Thanks,
Alon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20251025/b6f81e83/attachment-0001.htm>


More information about the Binutils mailing list