This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ld: linking to GNU_UNIQUE symbol does not set ELFOSABI_GNU
- From: Florian Weimer <fweimer at redhat dot com>
- To: binutils at sourceware dot org
- Date: Thu, 24 Jan 2013 12:31:37 +0100
- Subject: 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