]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
objcopy: add option to specify custom prefix for symbol of binary input
authorAlon Bar-Lev <alon.barlev@gmail.com>
Wed, 29 Oct 2025 10:54:40 +0000 (12:54 +0200)
committerAlan Modra <amodra@gmail.com>
Thu, 30 Oct 2025 05:02:52 +0000 (15:32 +1030)
commit6fa97b38ffcf73403a6b231f7199e570f282b773
tree5871b4ecc3963014a358476894dba17293902267
parentf190abc5841f1155be22100450d017bfc9c40e90
objcopy: add option to specify custom prefix for symbol of binary input

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:

  --binary-symbol-prefix <prefix> Use <prefix> as the base symbol name for
                                    the input file (default: derived from
                                    file name)

It allows specifying an explicit symbol prefix, while preserving the existing
behavior as a fallback.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
bfd/binary.c
binutils/doc/binutils.texi
binutils/objcopy.c
binutils/testsuite/binutils-all/objcopy.exp