about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-10-14 05:59:50 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-10-14 06:00:02 -0700
commitd3d9c95aefded7716d037e241f9d23a1cccab45a (patch)
tree2b926e69a63a8e6ba6ea89f4f35e85b1b6d72390
parent8f763b04a0249d5a94a667da31294dd2395ec3bf (diff)
downloadglibc-d3d9c95aefded7716d037e241f9d23a1cccab45a.tar.gz
glibc-d3d9c95aefded7716d037e241f9d23a1cccab45a.tar.xz
glibc-d3d9c95aefded7716d037e241f9d23a1cccab45a.zip
Support PLT and GOT references in local PIC check
Linker in binutils 2.26 and newer generate GOT references instead
PLT references when -z now is passed to linker.  We need to extend
scripts/localplt.awk to allow PLT or GOT references.

	[BZ #19007]
	* scripts/localplt.awk: Also allow GOT references.
	* sysdeps/unix/sysv/linux/i386/localplt.data: Mark
	_Unwind_Find_FDE, calloc, memalign, realloc and __libc_memalign
	with "+ REL R_386_GLOB_DAT".
	* sysdeps/x86_64/localplt.data: Mark calloc, memalign, realloc
	and __libc_memalign with "+ RELA R_X86_64_GLOB_DAT".
-rw-r--r--ChangeLog10
-rw-r--r--NEWS6
-rw-r--r--scripts/localplt.awk2
-rw-r--r--sysdeps/unix/sysv/linux/i386/localplt.data16
-rw-r--r--sysdeps/x86_64/localplt.data14
5 files changed, 29 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c8dc110f4..6cc7224af6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2015-10-14  H.J. Lu  <hongjiu.lu@intel.com>
 
+	[BZ #19007]
+	* scripts/localplt.awk: Also allow GOT references.
+	* sysdeps/unix/sysv/linux/i386/localplt.data: Mark
+	_Unwind_Find_FDE, calloc, memalign, realloc and __libc_memalign
+	with "+ REL R_386_GLOB_DAT".
+	* sysdeps/x86_64/localplt.data: Mark calloc, memalign, realloc
+	and __libc_memalign with "+ RELA R_X86_64_GLOB_DAT".
+
+2015-10-14  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/i386/brk.c (__brk): Use
 	INLINE_SYSCALL_ERROR_RETURN_VALUE.
 	* sysdeps/unix/sysv/linux/i386/fxstatat.c (__fxstatat):
diff --git a/NEWS b/NEWS
index 6d39148afc..5f455fe9d6 100644
--- a/NEWS
+++ b/NEWS
@@ -17,9 +17,9 @@ Version 2.23
   18661, 18674, 18675, 18681, 18724, 18757, 18778, 18781, 18787, 18789,
   18790, 18795, 18796, 18803, 18820, 18823, 18824, 18825, 18857, 18863,
   18870, 18872, 18873, 18875, 18887, 18921, 18951, 18952, 18956, 18961,
-  18966, 18967, 18969, 18970, 18977, 18980, 18981, 18985, 19003, 19012,
-  19016, 19018, 19032, 19046, 19049, 19050, 19059, 19071, 19076, 19077,
-  19078, 19079, 19085, 19086, 19088, 19094, 19095, 19124, 19125
+  18966, 18967, 18969, 18970, 18977, 18980, 18981, 18985, 19003, 19007,
+  19012, 19016, 19018, 19032, 19046, 19049, 19050, 19059, 19071, 19076,
+  19077, 19078, 19079, 19085, 19086, 19088, 19094, 19095, 19124, 19125
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
diff --git a/scripts/localplt.awk b/scripts/localplt.awk
index f75b3b427b..beaa342922 100644
--- a/scripts/localplt.awk
+++ b/scripts/localplt.awk
@@ -7,7 +7,7 @@
 BEGIN { result = 0 }
 
 FILENAME != lastfile {
-  if (lastfile && jmprel_offset == 0) {
+  if (lastfile && jmprel_offset == 0 && rela_offset == 0 && rel_offset == 0) {
     print FILENAME ": *** failed to find expected output (readelf -WSdr)";
     result = 2;
   }
diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data
index 2e03821dfd..4ce8447673 100644
--- a/sysdeps/unix/sysv/linux/i386/localplt.data
+++ b/sysdeps/unix/sysv/linux/i386/localplt.data
@@ -1,17 +1,17 @@
 # Linker in binutils 2.26 and newer consolidates R_X86_64_JUMP_SLOT
 # relocation with R_386_GLOB_DAT relocation against the same symbol.
-libc.so: _Unwind_Find_FDE
-libc.so: calloc
+libc.so: _Unwind_Find_FDE + REL R_386_GLOB_DAT
+libc.so: calloc + REL R_386_GLOB_DAT
 libc.so: free + REL R_386_GLOB_DAT
 libc.so: malloc + REL R_386_GLOB_DAT
-libc.so: memalign
-libc.so: realloc
+libc.so: memalign + REL R_386_GLOB_DAT
+libc.so: realloc + REL R_386_GLOB_DAT
 libm.so: matherr
 # The dynamic loader uses __libc_memalign internally to allocate aligned
 # TLS storage. The other malloc family of functions are expected to allow
 # user symbol interposition.
-ld.so: __libc_memalign
-ld.so: malloc
-ld.so: calloc
-ld.so: realloc
+ld.so: __libc_memalign + REL R_386_GLOB_DAT
+ld.so: malloc + REL R_386_GLOB_DAT
+ld.so: calloc + REL R_386_GLOB_DAT
+ld.so: realloc + REL R_386_GLOB_DAT
 ld.so: free + REL R_386_GLOB_DAT
diff --git a/sysdeps/x86_64/localplt.data b/sysdeps/x86_64/localplt.data
index d140476dfe..f168b143ff 100644
--- a/sysdeps/x86_64/localplt.data
+++ b/sysdeps/x86_64/localplt.data
@@ -3,17 +3,17 @@
 # users can define their own functions and have library internals call them.
 # Linker in binutils 2.26 and newer consolidates R_X86_64_JUMP_SLOT
 # relocation with R_X86_64_GLOB_DAT relocation against the same symbol.
-libc.so: calloc
+libc.so: calloc + RELA R_X86_64_GLOB_DAT
 libc.so: free + RELA R_X86_64_GLOB_DAT
 libc.so: malloc + RELA R_X86_64_GLOB_DAT
-libc.so: memalign
-libc.so: realloc
+libc.so: memalign + RELA R_X86_64_GLOB_DAT
+libc.so: realloc + RELA R_X86_64_GLOB_DAT
 libm.so: matherr
 # The dynamic loader uses __libc_memalign internally to allocate aligned
 # TLS storage. The other malloc family of functions are expected to allow
 # user symbol interposition.
-ld.so: __libc_memalign
-ld.so: malloc
-ld.so: calloc
-ld.so: realloc
+ld.so: __libc_memalign + RELA R_X86_64_GLOB_DAT
+ld.so: malloc + RELA R_X86_64_GLOB_DAT
+ld.so: calloc + RELA R_X86_64_GLOB_DAT
+ld.so: realloc + RELA R_X86_64_GLOB_DAT
 ld.so: free + RELA R_X86_64_GLOB_DAT