This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

ld: linking to GNU_UNIQUE symbol does not set ELFOSABI_GNU


This code in bfd/elf64-x86-64.c seems to be wrong:

  if ((abfd->flags & DYNAMIC) == 0
      && (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
	  || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE))
    elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;

The DYNAMIC requirement should only apply to the STT_GNU_IFUNC case. For STB_GNU_UNIQUE, the binding type is propagated to the resulting object (at least for DSOs).

I think this might be the appropriate fix:

  if (((abfd->flags & DYNAMIC) == 0
        && (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
      || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE))
    elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;

But the has_gnu_symbols flag should probably be set in a different location because this code is replicated in many places.

--
Florian Weimer / Red Hat Product Security Team


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