identifier mangling when linking binary "blobs"

J.T. Conklin jtc@redback.com
Thu Jul 1 00:00:00 GMT 1999


We use '-b binary' to link in binary images (inteligent I/O card
firmware, etc.) into our main images.  

The linker creates the symbols binary_<filename>_start, ..._end, and
..._size, which conveniently allow the program to refer to the image
(to download it to a I/O card, etc.).  But when moving from an a.out
to an ELF based system, I discovered that I needed to change the
identifiers used by my program from binary_... to _binary_... as
bfd/binary.c always emits the identifier with a leading underscore
regardless of whether or not the object format normally uses
underscores.

As these symbols aren't documented, I one could argue that this is
either a bug or a toolchain/object format implementation detail.  I
tend to think the former, especially since my code will continue to
have to work with both a.out and ELF based toolchains and I don't
relish the idea of adding #ifdef ELF conditionals in code that
otherwise doesn't and shouldn't care.

	--jtc

-- 
J.T. Conklin
RedBack Networks


More information about the Binutils mailing list