about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-03-21 17:14:49 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-03-21 17:14:49 -0700
commitc8e43ba739d696b3ff9a7b71786de8fab92950bc (patch)
tree74c34c4a6c88aa8adce8a4e5524e0fd89aff3121 /elf
parentdcb33988382dd79655cc9efbafe2981de0be5d12 (diff)
downloadglibc-c8e43ba739d696b3ff9a7b71786de8fab92950bc.tar.gz
glibc-c8e43ba739d696b3ff9a7b71786de8fab92950bc.tar.xz
glibc-c8e43ba739d696b3ff9a7b71786de8fab92950bc.zip
Add x32 support to dynamic linker audit
Diffstat (limited to 'elf')
-rw-r--r--elf/tst-auditmod1.c18
-rw-r--r--elf/tst-auditmod3b.c18
-rw-r--r--elf/tst-auditmod4b.c18
-rw-r--r--elf/tst-auditmod5b.c18
-rw-r--r--elf/tst-auditmod6b.c18
-rw-r--r--elf/tst-auditmod6c.c18
-rw-r--r--elf/tst-auditmod7b.c18
7 files changed, 91 insertions, 35 deletions
diff --git a/elf/tst-auditmod1.c b/elf/tst-auditmod1.c
index 69da278f28..67fc758ac3 100644
--- a/elf/tst-auditmod1.c
+++ b/elf/tst-auditmod1.c
@@ -109,10 +109,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
 # define La_retval La_i86_retval
 # define int_retval lrv_eax
 #elif defined __x86_64__
-# define pltenter la_x86_64_gnu_pltenter
-# define pltexit la_x86_64_gnu_pltexit
-# define La_regs La_x86_64_regs
-# define La_retval La_x86_64_retval
+# ifdef __LP64__
+#  define pltenter la_x86_64_gnu_pltenter
+#  define pltexit la_x86_64_gnu_pltexit
+#  define La_regs La_x86_64_regs
+#  define La_retval La_x86_64_retval
+# else
+#  define pltenter la_x32_gnu_pltenter
+#  define pltexit la_x32_gnu_pltexit
+#  define La_regs La_x32_regs
+#  define La_retval La_x32_retval
+# endif
 # define int_retval lrv_rax
 #elif defined __powerpc__ && __WORDSIZE == 32
 # define pltenter la_ppc32_gnu_pltenter
@@ -188,7 +195,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
   return 0;
 }
diff --git a/elf/tst-auditmod3b.c b/elf/tst-auditmod3b.c
index 388ed6e49c..921eaca55a 100644
--- a/elf/tst-auditmod3b.c
+++ b/elf/tst-auditmod3b.c
@@ -105,10 +105,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
   return sym->st_value;
 }
 
-#define pltenter la_x86_64_gnu_pltenter
-#define pltexit la_x86_64_gnu_pltexit
-#define La_regs La_x86_64_regs
-#define La_retval La_x86_64_retval
+#ifdef __LP64__
+# define pltenter la_x86_64_gnu_pltenter
+# define pltexit la_x86_64_gnu_pltexit
+# define La_regs La_x86_64_regs
+# define La_retval La_x86_64_retval
+#else
+# define pltenter la_x32_gnu_pltenter
+# define pltexit la_x32_gnu_pltexit
+# define La_regs La_x32_regs
+# define La_retval La_x32_retval
+#endif
 #define int_retval lrv_rax
 
 #include <tst-audit.h>
@@ -140,7 +147,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
   __m128i xmm = _mm_set1_epi32 (-1);
   asm volatile ("movdqa %0, %%xmm0" : : "x" (xmm) : "xmm0" );
diff --git a/elf/tst-auditmod4b.c b/elf/tst-auditmod4b.c
index 761d97ce9d..75e85582bd 100644
--- a/elf/tst-auditmod4b.c
+++ b/elf/tst-auditmod4b.c
@@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
   return sym->st_value;
 }
 
-#define pltenter la_x86_64_gnu_pltenter
-#define pltexit la_x86_64_gnu_pltexit
-#define La_regs La_x86_64_regs
-#define La_retval La_x86_64_retval
+#ifdef __LP64__
+# define pltenter la_x86_64_gnu_pltenter
+# define pltexit la_x86_64_gnu_pltexit
+# define La_regs La_x86_64_regs
+# define La_retval La_x86_64_retval
+#else
+# define pltenter la_x32_gnu_pltenter
+# define pltexit la_x32_gnu_pltexit
+# define La_regs La_x32_regs
+# define La_retval La_x32_retval
+#endif
 #define int_retval lrv_rax
 
 #include <tst-audit.h>
@@ -177,7 +184,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
 #ifdef __AVX__
   if (check_avx () && strcmp (symname, "audit_test") == 0)
diff --git a/elf/tst-auditmod5b.c b/elf/tst-auditmod5b.c
index 7e1e941126..d2443c8d20 100644
--- a/elf/tst-auditmod5b.c
+++ b/elf/tst-auditmod5b.c
@@ -95,10 +95,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
   return sym->st_value;
 }
 
-#define pltenter la_x86_64_gnu_pltenter
-#define pltexit la_x86_64_gnu_pltexit
-#define La_regs La_x86_64_regs
-#define La_retval La_x86_64_retval
+#ifdef __LP64__
+# define pltenter la_x86_64_gnu_pltenter
+# define pltexit la_x86_64_gnu_pltexit
+# define La_regs La_x86_64_regs
+# define La_retval La_x86_64_retval
+#else
+# define pltenter la_x32_gnu_pltenter
+# define pltexit la_x32_gnu_pltexit
+# define La_regs La_x32_regs
+# define La_retval La_x32_retval
+#endif
 #define int_retval lrv_rax
 
 #include <tst-audit.h>
@@ -150,7 +157,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
   __m128i xmm;
 
diff --git a/elf/tst-auditmod6b.c b/elf/tst-auditmod6b.c
index a7a60b9927..b00dcd7c2e 100644
--- a/elf/tst-auditmod6b.c
+++ b/elf/tst-auditmod6b.c
@@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
   return sym->st_value;
 }
 
-#define pltenter la_x86_64_gnu_pltenter
-#define pltexit la_x86_64_gnu_pltexit
-#define La_regs La_x86_64_regs
-#define La_retval La_x86_64_retval
+#ifdef __LP64__
+# define pltenter la_x86_64_gnu_pltenter
+# define pltexit la_x86_64_gnu_pltexit
+# define La_regs La_x86_64_regs
+# define La_retval La_x86_64_retval
+#else
+# define pltenter la_x32_gnu_pltenter
+# define pltexit la_x32_gnu_pltexit
+# define La_regs La_x32_regs
+# define La_retval La_x32_retval
+#endif
 #define int_retval lrv_rax
 
 #include <tst-audit.h>
@@ -179,7 +186,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
 #ifdef __AVX__
   if (check_avx () && strcmp (symname, "audit_test") == 0)
diff --git a/elf/tst-auditmod6c.c b/elf/tst-auditmod6c.c
index e0b5ac2319..a78c913963 100644
--- a/elf/tst-auditmod6c.c
+++ b/elf/tst-auditmod6c.c
@@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
   return sym->st_value;
 }
 
-#define pltenter la_x86_64_gnu_pltenter
-#define pltexit la_x86_64_gnu_pltexit
-#define La_regs La_x86_64_regs
-#define La_retval La_x86_64_retval
+#ifdef __LP64__
+# define pltenter la_x86_64_gnu_pltenter
+# define pltexit la_x86_64_gnu_pltexit
+# define La_regs La_x86_64_regs
+# define La_retval La_x86_64_retval
+#else
+# define pltenter la_x32_gnu_pltenter
+# define pltexit la_x32_gnu_pltexit
+# define La_regs La_x32_regs
+# define La_retval La_x32_retval
+#endif
 #define int_retval lrv_rax
 
 #include <tst-audit.h>
@@ -185,7 +192,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
 #ifdef __AVX__
   if (check_avx () && strcmp (symname, "audit_test") == 0)
diff --git a/elf/tst-auditmod7b.c b/elf/tst-auditmod7b.c
index a27d38540e..d761149a2f 100644
--- a/elf/tst-auditmod7b.c
+++ b/elf/tst-auditmod7b.c
@@ -94,10 +94,17 @@ la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
   return sym->st_value;
 }
 
-#define pltenter la_x86_64_gnu_pltenter
-#define pltexit la_x86_64_gnu_pltexit
-#define La_regs La_x86_64_regs
-#define La_retval La_x86_64_retval
+#ifdef __LP64__
+# define pltenter la_x86_64_gnu_pltenter
+# define pltexit la_x86_64_gnu_pltexit
+# define La_regs La_x86_64_regs
+# define La_retval La_x86_64_retval
+#else
+# define pltenter la_x32_gnu_pltenter
+# define pltexit la_x32_gnu_pltexit
+# define La_regs La_x32_regs
+# define La_retval La_x32_retval
+#endif
 #define int_retval lrv_rax
 
 #include <tst-audit.h>
@@ -177,7 +184,8 @@ pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
 	 const char *symname)
 {
   printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
-	  symname, (long int) sym->st_value, ndx, outregs->int_retval);
+	  symname, (long int) sym->st_value, ndx,
+	  (ptrdiff_t) outregs->int_retval);
 
 #ifdef __AVX__
   if (check_avx () && strcmp (symname, "audit_test") == 0)