The problem with linkonce sections in ELF

H . J . Lu
Thu Feb 3 18:48:00 GMT 2000

On Thu, Feb 03, 2000 at 08:52:15PM -0500, Ian Lance Taylor wrote:
>    > _bfd_strip_section_from_output should only be called for sections
>    > created by the linker.  Are you saying that you have input sections
>    > with the same name as sections which the linker creates?  That could
>    > indeed be a problem, and I don't think your patch is the correct fix
>    > for that.
>    _bfd_strip_section_from_output () is called by
>    elf_i386_size_dynamic_sections () in elf32-i386.c on
>    ".rel.gnu.linkonce.t*" sections. They are created by linker.
>    But for some reason. they are not put on the input section
>    list. I will look into it more.
> The linker creates the .rel.gnu.linkonce.t* sections.  It assumes that
> there are no input sections for those sections, just as it assumes
> that there are no input sections for any relocation sections.  If
> there are input sections for a relocation section, I would be
> surprised if the code worked correctly.
> It sounds like you are saying that there are input sections named
> .rel.gnu.linkonce.t* which do not hold relocations.  If they did hold
> relocations, they would not be treated as ordinary input sections.

I was wrong. One such an input section is
.rel.gnu.linkonce.t._._19srvr_message_list_c. It does hold relocations
for .gnu.linkonce.t._._19srvr_message_list_c:

RELOCATION RECORDS FOR [.gnu.linkonce.t._._19srvr_message_list_c]:
OFFSET   TYPE              VALUE
00000016 R_386_PC32        __builtin_delete
00000028 R_386_PC32        __builtin_delete
0000003a R_386_PC32        __builtin_delete

For some reason, linker decides to strip the input relocation
section, .rel.gnu.linkonce.t._._19srvr_message_list_c.

H.J. Lu (

More information about the Binutils mailing list