mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 14:39:09 +08:00
ld: Unify STT_GNU_IFUNC handling
Take STT_GNU_IFUNC handling scattered across targets and gather it in the generic ELF linker. bfd/ PR ld/23238 * elf-s390-common.c (elf_s390_add_symbol_hook): Removed. * elf32-arc.c (elf_arc_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf32-s390.c (elf_backend_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf64-s390.c (elf_backend_add_symbol_hook): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elfxx-aarch64.h (_bfd_aarch64_elf_add_symbol_hook): Likewise. (elf_backend_add_symbol_hook): Likewise. * elf32-arm.c (elf32_arm_add_symbol_hook): Remove STT_GNU_IFUNC handling. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elflink.c (elf_link_add_object_symbols): Set elf_gnu_symbol_ifunc for STT_GNU_IFUNC symbols. ld/ PR ld/23238 * testsuite/ld-ifunc/ifunc-26.d: New file. * testsuite/ld-ifunc/ifunc-26.s: Likewise. * testsuite/ld-ifunc/ifunc.exp: Run *.d tests without a working compiler.
This commit is contained in:
@ -2797,26 +2797,6 @@ const struct elf_size_info arc_elf32_size_info =
|
||||
|
||||
#define elf_backend_size_info arc_elf32_size_info
|
||||
|
||||
/* Hook called by the linker routine which adds symbols from an object
|
||||
file. */
|
||||
|
||||
static bfd_boolean
|
||||
elf_arc_add_symbol_hook (bfd * abfd,
|
||||
struct bfd_link_info * info,
|
||||
Elf_Internal_Sym * sym,
|
||||
const char ** namep ATTRIBUTE_UNUSED,
|
||||
flagword * flagsp ATTRIBUTE_UNUSED,
|
||||
asection ** secp ATTRIBUTE_UNUSED,
|
||||
bfd_vma * valp ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
|
||||
&& (abfd->flags & DYNAMIC) == 0
|
||||
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
|
||||
elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_ifunc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GDB expects general purpose registers to be in section .reg. However Linux
|
||||
kernel doesn't create this section and instead writes registers to NOTE
|
||||
section. It is up to the binutils to create a pseudo-section .reg from the
|
||||
@ -2946,7 +2926,6 @@ elf32_arc_section_from_shdr (bfd *abfd,
|
||||
|
||||
#define elf_backend_finish_dynamic_sections elf_arc_finish_dynamic_sections
|
||||
#define elf_backend_size_dynamic_sections elf_arc_size_dynamic_sections
|
||||
#define elf_backend_add_symbol_hook elf_arc_add_symbol_hook
|
||||
|
||||
#define elf_backend_can_gc_sections 1
|
||||
#define elf_backend_want_got_plt 1
|
||||
|
Reference in New Issue
Block a user