This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: identifier mangling when linking binary "blobs"


   From: jtc@redback.com (J.T. Conklin)
   Date: 21 May 1999 15:43:26 -0700

   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.

I think it's a bug.  mangle_name in binary.c should prepend
bfd_get_symbol_leading_char (abfd).  That should make the name
consistently start with an underscore, which I think is correct.

Ian

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]