[PATCH] SHF_MERGE support for gas and ld (was RFC: .gnu.strtab ...)

Ian Lance Taylor ian@zembu.com
Mon Apr 2 09:17:00 GMT 2001


Jakub Jelinek <jakub@redhat.com> writes:

> This patch does not need any modifications to port elf*.c files, but one
> pays for this:
> assembler has to keep local symbols in SHF_MERGE sections so that
> relocations are against them and not against STT_SECTION symbols. But as gas
> has -L by default turned off and ld does not have -X by default turned on
> (ie. gas defaults to different behaviour than ld), the .L symbols will wind
> up in the resulting executable/DSO unless -X is explicitely given or the
> thing is stripped.

I admit that I have not looked at this problem, and it is quite likely
that I am missing something.  However, it seems to me that you have
all the information you need without making this change.

The relocation to the SHF_MERGE section entry will have the SHF_MERGE
section and the offset.  That is enough information to know which
string the relocation refers to.  Based on that, it seems to me that
you can adjust the offset to refer to the final location of the
string.  Of course, this offset might be negative.

You do have to find all the relocations against the SHF_MERGE
section.  The elf_link_add_object_symbols function already has to
examine all the relocations.  Perhaps it could build a list of
local relocations against the SHF_MERGE section.  This would speed up
processing in link_input_bfd.

Ian



More information about the Binutils mailing list