aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-04-30 15:47:13 +0000
committerNick Clifton <nickc@redhat.com>2009-04-30 15:47:13 +0000
commitd8045f234d8865a7a7bfce71e81fcbeaf4098a7e (patch)
tree31e6bc2d28ac295c02dde51ed85fc561675e29a6 /bfd/elf.c
parentb22a5a41858f1962abba75900ef9928efca36bcd (diff)
downloadgdb-d8045f234d8865a7a7bfce71e81fcbeaf4098a7e.zip
gdb-d8045f234d8865a7a7bfce71e81fcbeaf4098a7e.tar.gz
gdb-d8045f234d8865a7a7bfce71e81fcbeaf4098a7e.tar.bz2
include/elf
2009-04-30 Nick Clifton <nickc@redhat.com> * common.h (STT_GNU_IFUNC): Define. elfcpp 2009-04-30 Nick Clifton <nickc@redhat.com> * (enum STT): Add STT_GNU_IFUNC. gas 2009-04-30 Nick Clifton <nickc@redhat.com> * config/obj-elf.c (obj_elf_type): Add support for a gnu_indirect_function type. * config/tc-i386.c (tc_i386_fix_adjustable): Do not adjust fixups against indirect function symbols. * doc/as.texinfo (.type): Document the support for the gnu_indirect_function symbol type. * NEWS: Mention the new feature. gas/testsuite 2009-04-30 Nick Clifton <nickc@redhat.com> * gas/elf/elf.exp: Extend type test to include an ifunc symbol. Provide an alternative test for targets which do not support ifunc symbols. (type.s): Add entry for an ifunc symbol. (type.e): Add ifunc entry to expected symbol dump. (section2.e-armelf): Add entry for ifunc symbol. (type-noifunc.s): New file. (type-noifunc.e): New file. bfd/ 2009-04-30 Nick Clifton <nickc@redhat.com> * elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs section pointer. (struct elf_obj_data): Add has_ifunc_symbols boolean. * elf.c (swap_out_syms): Convert BSF_GNU_INDIRECT_FUNCTION flags into a STT_GNU_IFUNC symbol type. (_bfd_elf_is_function_type): Accept STT_GNU_IFUNC as a function type. (_bfd_elf_set_osabi): Set the osasbi field to ELFOSABI_LINUX if the binary contains ifunc symbols. * elfcode.h (elf_slurp_symbol_table): Translate the STT_GNU_IFUNC symbol type into a BSF_GNU_INDIRECT_FUNCTION flag. * elf32-i386.c (is_indirect_function): New function. (elf_i386_check_relocs): Create an ifunc output section. (allocate_dynrelocs): Create dynamic relocs in the ifunc output section if necessary. (elf_i386_relocate_section): Emit a reloc against an ifunc symbol if necessary. (elf_i386_add_symbol_hook): New function. Set the has_ifunc_symbols field of the elf_obj_data structure if an ifunc symbol is encountered. (elf_backend_post_process_headers): Define. (elf_backend_add_symbol_hook): Define. (elf_i386_post_process_headers): Rename to elf_i388_fbsd_post_process_headers. * elf64-x86_64.c (IS_X86_64_PCREL_TYPE): New macro. (is_indirect_function): New function. (elf64_x86_64_check_relocs): Create an ifunc output section. (allocate_dynrelocs): Create dynamic relocs in the ifunc output section if necessary. (elf64_x86_64_relocate_section): Emit a reloc against an ifunc symbol if necessary. (elf_i386_add_symbol_hook): Set the has_ifunc_symbols field of the elf_obj_data structure if an ifunc symbol is encountered. (elf_backend_post_process_headers): Define. * elflink.c (_bfd_elf_adjust_dynamic_symbol): Always create a PLT if we have ifunc symbols to handle. (get_ifunc_reloc_section_name): New function. Computes the name for an ifunc section. (_bfd_elf_make_ifunc_reloc_section): New function. Creates a section to hold ifunc relocs. * syms.c (BSF_GNU_INDIRECT_FUNCTION): Define. (bfd_print_symbol_vandf): Handle ifunc symbols. (bfd_decode_symclass): Likewise. * bfd-in2.h: Regenerate. binutils 2009-04-30 Nick Clifton <nickc@redhat.com> * readelf.c (dump_relocations): Display a relocation against an ifunc symbol as if it were a function invocation. (get_symbol_type): Handle STT_GNU_IFUNC. ld 2009-04-30 Nick Clifton <nickc@redhat.com> * NEWS: Mention support for IFUNC symbols. ld/testsuite 2009-04-30 Nick Clifton <nickc@redhat.com> * ld-ifunc: New directory. * ld-ifunc/ifunc.exp: New file: Run the IFUNC tests. * ld-ifunc/prog.c: New file. * ld-ifunc/lib.c: New file.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 720c8a1..c7151be 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6399,6 +6399,8 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"),
if ((flags & BSF_THREAD_LOCAL) != 0)
type = STT_TLS;
+ else if ((flags & BSF_GNU_INDIRECT_FUNCTION) != 0)
+ type = STT_GNU_IFUNC;
else if ((flags & BSF_FUNCTION) != 0)
type = STT_FUNC;
else if ((flags & BSF_OBJECT) != 0)
@@ -8977,15 +8979,23 @@ _bfd_elf_set_osabi (bfd * abfd,
i_ehdrp = elf_elfheader (abfd);
i_ehdrp->e_ident[EI_OSABI] = get_elf_backend_data (abfd)->elf_osabi;
+
+ /* To make things simpler for the loader on Linux systems we set the
+ osabi field to ELFOSABI_LINUX if the binary contains symbols of
+ the STT_GNU_IFUNC type. */
+ if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE
+ && elf_tdata (abfd)->has_ifunc_symbols)
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX;
}
/* Return TRUE for ELF symbol types that represent functions.
This is the default version of this function, which is sufficient for
- most targets. It returns true if TYPE is STT_FUNC. */
+ most targets. It returns true if TYPE is STT_FUNC or STT_GNU_IFUNC. */
bfd_boolean
_bfd_elf_is_function_type (unsigned int type)
{
- return (type == STT_FUNC);
+ return (type == STT_FUNC
+ || type == STT_GNU_IFUNC);
}