[BZ,#18078] FAIL: elf/check-localplt with ld from binutils 2.26

Message ID 20150309202636.GA24131@intel.com
State Superseded
Headers

Commit Message

Lu, Hongjiu March 9, 2015, 8:26 p.m. UTC
  On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
R_*_GLOB_DAT relocation against the same symbol.  It makes R_*_JUMP_SLOT
relocations against free and malloc optional.  We should mark PLT entries
for free and malloc optional.  OK for master?

Thanks.


H.J.
--
	[BZ #18078]
	* sysdeps/unix/sysv/linux/i386/localplt.data: Mark PLT entries
	for free and malloc optional.
	* sysdeps/x86_64/localplt.data: New file.
---
 sysdeps/unix/sysv/linux/i386/localplt.data |  9 ++++++---
 sysdeps/x86_64/localplt.data               | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/x86_64/localplt.data
  

Comments

Roland McGrath March 10, 2015, 10:21 p.m. UTC | #1
I don't think this is the way to do it.  For those cases it is mandatory
that libc is actually using the PLT entry, so we don't want a check that
would pass if libc stopped using it at all.  Perhaps instead there is a way
to modify scripts/localplt.awk and/or scripts/check-localplt.awk so that
they will grok the new linker's output as constituting use of a PLT entry.
Maybe a GLOB_DAT reloc to a symbol that's STT_FUNC is a close enough proxy?
  

Patch

diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data
index b25abf8..9d70ba7 100644
--- a/sysdeps/unix/sysv/linux/i386/localplt.data
+++ b/sysdeps/unix/sysv/linux/i386/localplt.data
@@ -1,7 +1,10 @@ 
+# Linker in binutils 2.26 and newer consolidates R_X86_64_JUMP_SLOT
+# relocation with R_386_GLOB_DAT relocation against the same symbol.
+# It makes R_386_JUMP_SLOT relocations against free and malloc optional.
 libc.so: _Unwind_Find_FDE
 libc.so: calloc
-libc.so: free
-libc.so: malloc
+libc.so: free ?
+libc.so: malloc ?
 libc.so: memalign
 libc.so: realloc
 libm.so: matherr
@@ -12,4 +15,4 @@  ld.so: __libc_memalign
 ld.so: malloc
 ld.so: calloc
 ld.so: realloc
-ld.so: free
+ld.so: free ?
diff --git a/sysdeps/x86_64/localplt.data b/sysdeps/x86_64/localplt.data
new file mode 100644
index 0000000..165259a
--- /dev/null
+++ b/sysdeps/x86_64/localplt.data
@@ -0,0 +1,20 @@ 
+# See scripts/check-localplt.awk for how this file is processed.
+# PLT use is required for the malloc family and for matherr because
+# 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.
+# It makes R_X86_64_JUMP_SLOT relocations against free and malloc optional.
+libc.so: calloc
+libc.so: free ?
+libc.so: malloc ?
+libc.so: memalign
+libc.so: realloc
+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: free ?