[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r14259 - in /fsf/trunk/libc: ./ elf/ sysdeps/i386/ sysdeps/powerpc/powerpc32/ sysdeps/powerpc/powerpc64/ sysdeps/sparc/sparc...



Author: eglibc
Date: Tue Jun 21 00:03:23 2011
New Revision: 14259

Log:
Import glibc-mainline for 2011-06-21

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/dl-runtime.c
    fsf/trunk/libc/elf/dl-sym.c
    fsf/trunk/libc/sysdeps/i386/dl-irel.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h
    fsf/trunk/libc/sysdeps/sparc/sparc32/dl-irel.h
    fsf/trunk/libc/sysdeps/sparc/sparc32/dl-plt.h
    fsf/trunk/libc/sysdeps/sparc/sparc64/dl-irel.h
    fsf/trunk/libc/sysdeps/sparc/sparc64/dl-plt.h
    fsf/trunk/libc/sysdeps/x86_64/dl-irel.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Jun 21 00:03:23 2011
@@ -1,3 +1,20 @@
+2011-06-20  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/sparc/sparc32/dl-plt.h: Protect against multiple
+	inclusions.
+	* sysdeps/sparc/sparc64/dl-plt.h: Likewise.
+
+	* sysdeps/i386/dl-irel.h (elf_ifunc_invoke): New.
+	(elf_irel): Use it.
+	* sysdeps/powerpc/powerpc32/dl-irel.h: Likewise.
+	* sysdeps/powerpc/powerpc64/dl-irel.h: Likewise.
+	* sysdeps/sparc/sparc32/dl-irel.h: Likewise.
+	* sysdeps/sparc/sparc64/dl-irel.h: Likewise.
+	* sysdeps/x86_64/dl-irel.h: Likewise.
+
+	* elf/dl-runtime.c: Use elf_ifunc_invoke.
+	* elf/dl-sym.c: Likewise.
+
 2011-06-15  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	* resolv/res_send.c (__libc_res_nsend): Fix typos in last patch.  We

Modified: fsf/trunk/libc/elf/dl-runtime.c
==============================================================================
--- fsf/trunk/libc/elf/dl-runtime.c (original)
+++ fsf/trunk/libc/elf/dl-runtime.c Tue Jun 21 00:03:23 2011
@@ -27,6 +27,7 @@
 #include <sysdep-cancel.h>
 #include "dynamic-link.h"
 #include <tls.h>
+#include <dl-irel.h>
 
 
 #if (!defined ELF_MACHINE_NO_RELA && !defined ELF_MACHINE_PLT_REL) \
@@ -146,7 +147,7 @@
 
   if (sym != NULL
       && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
-    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (value)) ();
+    value = elf_ifunc_invoke (DL_FIXUP_VALUE_ADDR (value));
 
   /* Finally, fix up the plt itself.  */
   if (__builtin_expect (GLRO(dl_bind_not), 0))
@@ -235,8 +236,7 @@
 	  if (defsym != NULL
 	      && __builtin_expect (ELFW(ST_TYPE) (defsym->st_info)
 				   == STT_GNU_IFUNC, 0))
-	    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
-		     DL_FIXUP_VALUE_ADDR (value)) ();
+	    value = elf_ifunc_invoke (DL_FIXUP_VALUE_ADDR (value));
 	}
       else
 	{
@@ -246,8 +246,7 @@
 
 	  if (__builtin_expect (ELFW(ST_TYPE) (refsym->st_info)
 				== STT_GNU_IFUNC, 0))
-	    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
-		     DL_FIXUP_VALUE_ADDR (value)) ();
+	    value = elf_ifunc_invoke (DL_FIXUP_VALUE_ADDR (value));
 
 	  result = l;
 	}

Modified: fsf/trunk/libc/elf/dl-sym.c
==============================================================================
--- fsf/trunk/libc/elf/dl-sym.c (original)
+++ fsf/trunk/libc/elf/dl-sym.c Tue Jun 21 00:03:23 2011
@@ -27,6 +27,7 @@
 #include <dl-hash.h>
 #include <sysdep-cancel.h>
 #include <dl-tls.h>
+#include <dl-irel.h>
 
 
 #ifdef SHARED
@@ -196,8 +197,7 @@
 	{
 	  DL_FIXUP_VALUE_TYPE fixup
 	    = DL_FIXUP_MAKE_VALUE (result, (ElfW(Addr)) value);
-	  fixup =
-	    ((DL_FIXUP_VALUE_TYPE (*) (void)) DL_FIXUP_VALUE_ADDR (fixup)) ();
+	  fixup = elf_ifunc_invoke (DL_FIXUP_VALUE_ADDR (fixup));
 	  value = (void *) DL_FIXUP_VALUE_CODE_ADDR (fixup);
 	}
 

Modified: fsf/trunk/libc/sysdeps/i386/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/i386/dl-irel.h Tue Jun 21 00:03:23 2011
@@ -26,6 +26,13 @@
 
 #define ELF_MACHINE_IREL	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_irel (const Elf32_Rel *reloc)
@@ -35,7 +42,7 @@
 
   if (__builtin_expect (r_type == R_386_IRELATIVE, 1))
     {
-      Elf32_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) ();
+      Elf32_Addr value = elf_ifunc_invoke(*reloc_addr);
       *reloc_addr = value;
     }
   else

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h Tue Jun 21 00:03:23 2011
@@ -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 @@
   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

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h Tue Jun 21 00:03:23 2011
@@ -33,6 +33,13 @@
   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 @@
   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

Modified: fsf/trunk/libc/sysdeps/sparc/sparc32/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc32/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc32/dl-irel.h Tue Jun 21 00:03:23 2011
@@ -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 @@
   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);
     }

Modified: fsf/trunk/libc/sysdeps/sparc/sparc32/dl-plt.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc32/dl-plt.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc32/dl-plt.h Tue Jun 21 00:03:23 2011
@@ -17,6 +17,9 @@
    License along with the GNU C Library; if not, write to the Free
    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 */
@@ -95,3 +98,5 @@
 
   return value;
 }
+
+#endif /* dl-plt.h */

Modified: fsf/trunk/libc/sysdeps/sparc/sparc64/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/dl-irel.h Tue Jun 21 00:03:23 2011
@@ -28,6 +28,13 @@
 
 #define ELF_MACHINE_IRELA	1
 
+static inline Elf64_Addr
+__attribute ((always_inline))
+elf_ifunc_invoke (Elf64_Addr addr)
+{
+  return ((Elf64_Addr (*) (int)) (addr)) (GLRO(dl_hwcap));
+}
+
 static inline void
 __attribute ((always_inline))
 elf_irela (const Elf64_Rela *reloc)
@@ -37,13 +44,13 @@
   if (__builtin_expect (r_type == R_SPARC_IRELATIVE, 1))
     {
       Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
-      Elf64_Addr value = ((Elf64_Addr (*) (int)) reloc->r_addend) (GLRO(dl_hwcap));
+      Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
       *reloc_addr = value;
     }
   else if (__builtin_expect (r_type == R_SPARC_JMP_IREL, 1))
     {
       Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
-      Elf64_Addr value = ((Elf64_Addr (*) (int)) reloc->r_addend) (GLRO(dl_hwcap));
+      Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
       struct link_map map = { .l_addr = 0 };
 
       /* 'high' is always zero, for large PLT entries the linker

Modified: fsf/trunk/libc/sysdeps/sparc/sparc64/dl-plt.h
==============================================================================
--- fsf/trunk/libc/sysdeps/sparc/sparc64/dl-plt.h (original)
+++ fsf/trunk/libc/sysdeps/sparc/sparc64/dl-plt.h Tue Jun 21 00:03:23 2011
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, write to the Free
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
+
+#ifndef _DL_PLT_H
+#define _DL_PLT_H
 
 /* We have 4 cases to handle.  And we code different code sequences
    for each one.  I love V9 code models...  */
@@ -161,3 +164,5 @@
       __asm __volatile ("flush %0" : : "r" (insns));
     }
 }
+
+#endif /* dl-plt.h */

Modified: fsf/trunk/libc/sysdeps/x86_64/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/dl-irel.h Tue Jun 21 00:03:23 2011
@@ -26,6 +26,13 @@
 
 #define ELF_MACHINE_IRELA	1
 
+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)
@@ -35,7 +42,7 @@
 
   if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1))
     {
-      Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+      Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
       *reloc_addr = value;
     }
   else