This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] x86-64: Handle undefined IFUNC symbol with -z now
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 19 Apr 2017 16:59:47 -0000
- Subject: [binutils-gdb] x86-64: Handle undefined IFUNC symbol with -z now
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e492d2f8ac653b050019865ba1418fc5b057c00b
commit e492d2f8ac653b050019865ba1418fc5b057c00b
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Apr 19 09:59:14 2017 -0700
x86-64: Handle undefined IFUNC symbol with -z now
Since undefined IFUNC symbol is treated as normal FUNC symbol, don't
abort on undefined IFUNC symbol in the second PLT.
bfd/
PR ld/21401
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
on on undefined IFUNC symbol in the second PLT.
ld/
PR ld/21401
* testsuite/ld-ifunc/ifunc.exp: Add a libtest-2-now.so test with
-z now.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf64-x86-64.c | 2 +-
ld/ChangeLog | 6 ++++++
ld/testsuite/ld-ifunc/ifunc.exp | 8 ++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8abbfcb..11fbdab 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21401
+ * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
+ on on undefined IFUNC symbol in the second PLT.
+
2017-04-19 Wedson Almeida Filho <wedsonaf@gmail.com>
* peXXigen.c (pe_print_reloc): Correct chunk_end.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index bf10893..746b847 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -6013,7 +6013,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
got_offset = h->got.offset;
if (got_offset == (bfd_vma) -1
- || h->type == STT_GNU_IFUNC
+ || (h->type == STT_GNU_IFUNC && h->def_regular)
|| plt == NULL
|| got == NULL)
abort ();
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c20ed75..bccd2be 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21401
+ * testsuite/ld-ifunc/ifunc.exp: Add a libtest-2-now.so test with
+ -z now.
+
2017-04-19 Alan Modra <amodra@gmail.com>
* ld.texinfo (dynamic-undefined-weak): Document.
diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
index ffff2f1..13d50a5 100644
--- a/ld/testsuite/ld-ifunc/ifunc.exp
+++ b/ld/testsuite/ld-ifunc/ifunc.exp
@@ -234,6 +234,10 @@ if ![ld_link $ld "tmpdir/libtest-2.so" "-shared tmpdir/test-2.o"] {
fail "Could not link libtest-2.so"
set fails [expr $fails + 1]
}
+if ![ld_link $ld "tmpdir/libtest-2-now.so" "-shared -z now tmpdir/test-2.o"] {
+ fail "Could not link libtest-2-now.so"
+ set fails [expr $fails + 1]
+}
if { $fails == 0 } {
pass "Building ifunc binaries"
@@ -306,6 +310,10 @@ if {[contains_ifunc_symbol tmpdir/libtest-2.so] != 0} {
fail "libtest-2.so contains IFUNC symbols"
set fails [expr $fails + 1]
}
+if {[contains_ifunc_symbol tmpdir/libtest-2-now.so] != 0} {
+ fail "libtest-2-now.so contains IFUNC symbols"
+ set fails [expr $fails + 1]
+}
# The linked ifunc using executables and shared libraries should contain
# a dynamic reloc referencing the IFUNC symbol. (Even the static