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

Alon Bar-Lev alon.barlev@gmail.com
Mon Oct 27 09:48:15 GMT 2025


On Mon, 27 Oct 2025 at 11:45, Jan Beulich <jbeulich@suse.com> wrote:

> On 27.10.2025 10:42, Alon Bar-Lev wrote:
> > On Mon, 27 Oct 2025 at 10:51, Jan Beulich <jbeulich@suse.com> wrote:
> >
> >> On 25.10.2025 05:25, Alon Bar-Lev 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>
> >>> ---
> >>>  bfd/bfd-in2.h                               | 15 ++++++++
> >>>  bfd/bfd.c                                   | 15 ++++++++
> >>>  bfd/binary.c                                |  7 +++-
> >>>  binutils/doc/binutils.texi                  | 15 ++++++++
> >>>  binutils/objcopy.c                          | 23 ++++++++----
> >>>  binutils/testsuite/binutils-all/objcopy.exp | 39 +++++++++++++++++++++
> >>>  6 files changed, 107 insertions(+), 7 deletions(-)
> >>
> >> I have a total of 4 patches with the same title in my inbox. Which one
> is
> >> newest?
> >> Judging from time, was this one perhaps meant to be tagged v4?
> >
> > Yes... all are the same implementation, the tests were improved over the
> > revisions.
> >
> > Before I perform the changes Alan requested, please let me know what
> > implementation you prefer.
>
> I fear I'm confused. Above you say "all are the same implementation".
> Please
> address Alan's comments and then resubmit a new, properly tagged version.
>
> Jan
>

Implementation == what goes to users: was not modified during the revisions.
Tests == what is used during the release cycle: was added and improved per
H.J Lu comments.

I will modify the implementation per Alan's comments and resubmit.

Thanks.
Aon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20251027/05d6f503/attachment-0001.htm>


More information about the Binutils mailing list