about summary refs log tree commit diff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/powerpc32/dl-irel.h9
-rw-r--r--sysdeps/powerpc/powerpc64/dl-irel.h11
2 files changed, 17 insertions, 3 deletions
diff --git a/sysdeps/powerpc/powerpc32/dl-irel.h b/sysdeps/powerpc/powerpc32/dl-irel.h
index 3f204cd7ae..a31e1edd4a 100644
--- a/sysdeps/powerpc/powerpc32/dl-irel.h
+++ b/sysdeps/powerpc/powerpc32/dl-irel.h
@@ -26,6 +26,13 @@
 
 #define ELF_MACHINE_IRELA	1
 
+static inline Elf32_Addr
+__attribute ((always_inline))
+elf_ifunc_invoke (Elf32_Addr addr)
+{
+  return ((Elf32_Addr (*) (void)) (addr)) ();
+}
+
 static inline void
 __attribute ((always_inline))
 elf_irela (const Elf32_Rela *reloc)
@@ -35,7 +42,7 @@ elf_irela (const Elf32_Rela *reloc)
   if (__builtin_expect (r_type == R_PPC_IRELATIVE, 1))
     {
       Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
-      Elf32_Addr value = ((Elf32_Addr (*) (void)) reloc->r_addend) ();
+      Elf32_Addr value = elf_ifunc_invoke(reloc->r_addend);
       *reloc_addr = value;
     }
   else
diff --git a/sysdeps/powerpc/powerpc64/dl-irel.h b/sysdeps/powerpc/powerpc64/dl-irel.h
index 6cded5091d..3c2668fbb7 100644
--- a/sysdeps/powerpc/powerpc64/dl-irel.h
+++ b/sysdeps/powerpc/powerpc64/dl-irel.h
@@ -33,6 +33,13 @@ typedef struct
   Elf64_Addr fd_aux;
 } Elf64_FuncDesc;
 
+static inline Elf64_Addr
+__attribute ((always_inline))
+elf_ifunc_invoke (Elf64_Addr addr)
+{
+  return ((Elf64_Addr (*) (void)) (addr)) ();
+}
+
 static inline void
 __attribute ((always_inline))
 elf_irela (const Elf64_Rela *reloc)
@@ -42,13 +49,13 @@ elf_irela (const Elf64_Rela *reloc)
   if (__builtin_expect (r_type == R_PPC64_IRELATIVE, 1))
     {
       Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
-      Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+      Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
       *reloc_addr = value;
     }
   else if (__builtin_expect (r_type == R_PPC64_JMP_IREL, 1))
     {
       Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
-      Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+      Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
       *(Elf64_FuncDesc *) reloc_addr = *(Elf64_FuncDesc *) value;
     }
   else