From 74414708355a922a514d5c76183eca6931c4488a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 31 May 2009 23:45:33 -0700 Subject: Finish IFUNC support for x86 and x86-64. Add support for the IRELAIVE relocation and IFUNC in static executables. --- sysdeps/x86_64/dl-machine.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sysdeps/x86_64/dl-machine.h') diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 4444ae0a71..1b5ce8e981 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -297,6 +297,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, : (Elf64_Addr) sym_map->l_addr + sym->st_value); if (sym != NULL + && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1) && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)) value = ((Elf64_Addr (*) (void)) value) (); @@ -442,6 +443,11 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, } break; # endif + case R_X86_64_IRELATIVE: + value = map->l_addr + reloc->r_addend; + value = ((Elf64_Addr (*) (void)) value) (); + *reloc_addr = value; + break; default: _dl_reloc_bad_type (map, r_type, 0); break; @@ -488,6 +494,12 @@ elf_machine_lazy_rel (struct link_map *map, td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)]) + map->l_addr); } + else if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 0)) + { + Elf64_Addr value = map->l_addr + reloc->r_addend; + value = ((Elf64_Addr (*) (void)) value) (); + *reloc_addr = value; + } else _dl_reloc_bad_type (map, r_type, 1); } -- cgit 1.4.1