ELF STT_SECTION symbol for .comment section

Ian Lance Taylor ian@cygnus.com
Thu Feb 11 09:17:00 GMT 1999


   Date: Thu, 11 Feb 1999 12:11:04 +0000
   From: Michael Nonweiler <Michael.Nonweiler@arm.com>

   The problem is caused by the function elf_map_symbols in bfd/elf.c
   generating an unnamed section symbol for the ".comment" section of an
   object file.  This upsets my linker because it expects to map all symbols
   to image locations, and the ".comment" section of the object file is not
   part of the image.

That expectation seems like a bug.  In fact, since some types of
debugging informations have references between debugging sections,
which require symbols in the debugging sections, I don't see how this
can work in practice.

   FYI: The ".comment" section normally contains the version string of the
   Enabling debugging for elf.c shows that this is the _only_ section symbol
   added by "elf_map_symbols".  Section symbols for the other sections are
   generated by gcc.

   I don't know what these symbols are for, but I feel sure it can't be
   necessary to have one for the ".comment" section of the object.

I agree.  However, a section symbol may be required for any section
which can have relocations.  Relocations can appear in sections which
are not loaded, such as debugging sections.

The behaviour of the GNU ELF linker was loosely based on the behaviour
of the Solaris linker.  That linker does add a section symbol for the
.comment section.

So since I think we agree that there is a bug in the linker you are
using, and since adding a section symbol follows the lead of at least
one other ELF linker, I'm not too inclined to change the GNU linker
behaviour.

Ian



More information about the Bfd mailing list