diff options
author | Ronald Hoogenbllon <rhoogenboom@irdeto.com> | 2015-10-21 15:16:35 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-10-21 15:16:35 +0100 |
commit | 2b35fb28f397a26c0da03f7579116d28af2af824 (patch) | |
tree | 7dc8a9042b84587fa9c317fbf1feda1caf6a1f97 /binutils/doc | |
parent | 1283d92f0e4704bb31b1e163b9c88216756ef62c (diff) | |
download | binutils-gdb-2b35fb28f397a26c0da03f7579116d28af2af824.tar.gz |
Add ability for objcopy to insert new symbols into a binary.
PR binutils/19104
binutils * objcopy.c (command_line_switch): Add OPTION_ADD_SYMBOL.
(copy_options): Add add-symbol.
(copy_usage): Likewise.
(parse_symflags): New function.
(need_sym_before): New function.
(create_new_symbol): New function.
(filter_symbols): Add code to insert new symbols.
(copy_main): Process OPTION_ADD_SYMBOL.
* doc/binutils.texi: Document new feature.
* NEWS: Add note about the new feature.
tests * binutils-all/add-symbol.d: New test.
* binutils-all/objcopy.exp: Run the new test.
Diffstat (limited to 'binutils/doc')
-rw-r--r-- | binutils/doc/binutils.texi | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index d9936645677..7dc09c32139 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -1106,6 +1106,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}] [@option{--localize-symbols=}@var{filename}] [@option{--globalize-symbols=}@var{filename}] [@option{--weaken-symbols=}@var{filename}] + [@option{--add-symbol} @var{name}=[@var{section}:]@var{value}[,@var{flags}] [@option{--alt-machine-code=}@var{index}] [@option{--prefix-symbols=}@var{string}] [@option{--prefix-sections=}@var{string}] @@ -1504,6 +1505,18 @@ command line. In this case, pass the original section name to @option{--update-section}, and the original and new section names to @option{--rename-section}. +@item --add-symbol @var{name}=[@var{section}:]@var{value}[,@var{flags}] +Add a new symbol named @var{name} while copying the file. This option may be +specified multiple times. If the @var{section} is given, the symbol will be +associated with and relative to that section, otherwise it will be an ABS +symbol. Specifying an undefined section will result in a fatal error. There +is no check for the value, it will be taken as specified. Symbol flags can +be specified and not all flags will be meaningful for all object file +formats. By default, the symbol will be global. The special flag +'before=@var{othersym}' will insert the new symbol in front of the specified +@var{othersym}, otherwise the symbol(s) will be added at the end of the +symbol table in the order they appear. + @item --rename-section @var{oldname}=@var{newname}[,@var{flags}] Rename a section from @var{oldname} to @var{newname}, optionally changing the section's flags to @var{flags} in the process. This has |