From 13a2df29c930eda49837741902b67021ab004990 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 12 Aug 2015 13:31:29 -0700 Subject: Set EI_OSABI to ELFOSABI_GNU for local IFUNC symbols Since the backend elf_add_symbol_hook isn't called on local symbols, the EI_OSABI field isn't to ELFOSABI_GNU where are local IFUNC symbols. This patch changes the x86 backends to set has_gnu_symbols if there are relocations against IFUNC symbols. Other backends with IFUNC support may need a similar change. This patch also changes the type of has_gnu_symbols from bfd_boolean to enum elf_gnu_symbols. bfd/ PR ld/18815 * elf-bfd.h (elf_gnu_symbols): New enum. (elf_obj_tdata): Use elf_gnu_symbols on has_gnu_symbols. * elf-s390-common.c (elf_s390_add_symbol_hook): Set has_gnu_symbols to elf_gnu_symbol_any. * elf32-arm.c (elf32_arm_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * lfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elf32-i386.c (elf_i386_check_relocs): Update has_gnu_symbols if there are relocations against IFUNC symbols. (elf_i386_add_symbol_hook): Don't check STT_GNU_IFUNC here. * elf64-x86-64. (elf_x86_64_check_relocs): Update has_gnu_symbols if there are relocations against IFUNC symbols. (elf_x86_64_add_symbol_hook): Don't check STT_GNU_IFUNC here. ld/testsuite/ PR ld/18815 * ld-i386/i386.exp: Run pr18815. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr18815.d: New file. * ld-i386/pr18815.s: Likewise. * ld-x86-64/pr18815.d: Likewise. * ld-x86-64/pr18815.s: Likewise. --- bfd/elf32-m68k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bfd/elf32-m68k.c') diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index db0d0da..07211b5 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -4846,7 +4846,7 @@ elf_m68k_add_symbol_hook (bfd *abfd, || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE) && (abfd->flags & DYNAMIC) == 0 && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour) - elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE; + elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any; return TRUE; } -- cgit v1.1