From 42675c6ff0e95346de8a2cbc066e14e0d6a856e4 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 20 Jun 2011 19:56:40 -0700 Subject: Add an elf_ifunc_invoke interface so that architectures can implement the ifunc resolver calls however they wish. --- sysdeps/sparc/sparc32/dl-irel.h | 11 +++++++++-- sysdeps/sparc/sparc32/dl-plt.h | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'sysdeps/sparc/sparc32') diff --git a/sysdeps/sparc/sparc32/dl-irel.h b/sysdeps/sparc/sparc32/dl-irel.h index 2753fb4ceb..4eaaa37d69 100644 --- a/sysdeps/sparc/sparc32/dl-irel.h +++ b/sysdeps/sparc/sparc32/dl-irel.h @@ -28,6 +28,13 @@ #define ELF_MACHINE_IRELA 1 +static inline Elf32_Addr +__attribute ((always_inline)) +elf_ifunc_invoke (Elf32_Addr addr) +{ + return ((Elf32_Addr (*) (int)) (addr)) (GLRO(dl_hwcap)); +} + static inline void __attribute ((always_inline)) elf_irela (const Elf32_Rela *reloc) @@ -37,13 +44,13 @@ elf_irela (const Elf32_Rela *reloc) if (__builtin_expect (r_type == R_SPARC_IRELATIVE, 1)) { Elf32_Addr *const reloc_addr = (void *) reloc->r_offset; - Elf32_Addr value = ((Elf32_Addr (*) (int)) reloc->r_addend) (GLRO(dl_hwcap)); + Elf32_Addr value = elf_ifunc_invoke(reloc->r_addend); *reloc_addr = value; } else if (__builtin_expect (r_type == R_SPARC_JMP_IREL, 1)) { Elf32_Addr *const reloc_addr = (void *) reloc->r_offset; - Elf32_Addr value = ((Elf32_Addr (*) (int)) reloc->r_addend) (GLRO(dl_hwcap)); + Elf32_Addr value = elf_ifunc_invoke(reloc->r_addend); sparc_fixup_plt (reloc, reloc_addr, value, 0, 1); } diff --git a/sysdeps/sparc/sparc32/dl-plt.h b/sysdeps/sparc/sparc32/dl-plt.h index bfb891fe69..0fbd95093b 100644 --- a/sysdeps/sparc/sparc32/dl-plt.h +++ b/sysdeps/sparc/sparc32/dl-plt.h @@ -18,6 +18,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifndef _DL_PLT_H +#define _DL_PLT_H + /* Some SPARC opcodes we need to use for self-modifying code. */ #define OPCODE_NOP 0x01000000 /* nop */ #define OPCODE_CALL 0x40000000 /* call ?; add PC-rel word address */ @@ -95,3 +98,5 @@ sparc_fixup_plt (const Elf32_Rela *reloc, Elf32_Addr *reloc_addr, return value; } + +#endif /* dl-plt.h */ -- cgit v1.2.3