[PATCH] 'add symbol' feature in objcopy

Ronald Hoogenboom hoogenboom30@zonnet.nl
Tue Oct 13 18:04:00 GMT 2015


Objcopy allows to strip/remove and manipulate all kinds of symbols in an object. Sometimes it might be
useful to be able to ADD a symbol too.

The attached patch does just that. It adds the --add-symbol option (can be used multiple times) that
allows to add a new symbol to the end of the symbol table with an arbitrary absolute value.

I've added the section support. <symbol>=[<section>:]<value>
This binds the new symbol to (and makes it relative to) the specified section.

Extended the --add-symbol with the possibility to specify symbol flags. Some symbol flags depend on
the ordering of symbols in the symtab (warning, indirect) if I understand correctly... so I preserved
the order of the added symbols. Maybe one more useful feature could be to add a symbol in front of
another existing symbol, to enhance the usability of the warning flag (does it actually have the effect
as it is described in the bfd.h file?).

Refer to bugzilla item 19104.

The patch was made against the binutils-2.24-32 from fedora 21. It may apply with some fuzz.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: objcopy-add-symbol.patch
Type: text/x-patch
Size: 5940 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20151013/94f01814/attachment.bin>


More information about the Binutils mailing list