--- binutils.orig/bfd/elfxx-x86.c 2018-09-05 14:08:23.331182323 +0100
+++ binutils-2.30/bfd/elfxx-x86.c 2018-09-05 16:14:15.331921741 +0100
@@ -108,6 +108,7 @@ elf_x86_allocate_dynrelocs (struct elf_l
resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh);
+#if 0 /* Never optimize away PLT entries. They are needed by tools like rtld-audit and ltrace. */
/* We can't use the GOT PLT if pointer equality is needed since
finish_dynamic_symbol won't clear symbol value and the dynamic
linker won't update the GOT slot. We will get into an infinite
@@ -125,6 +126,7 @@ elf_x86_allocate_dynrelocs (struct elf_l
/* Use the GOT PLT. */
eh->plt_got.refcount = 1;
}
+#endif
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
here if it is defined and referenced in a non-shared object. */
diff -rup binutils.orig/ld/testsuite/ld-i386/i386.exp binutils-2.30/ld/testsuite/ld-i386/i386.exp
--- binutils.orig/ld/testsuite/ld-i386/i386.exp 2018-09-12 15:59:03.969158148 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/i386.exp 2018-09-12 16:23:41.579837859 +0100
@@ -1434,9 +1434,9 @@ run_ld_link_tests [list \
]
# Linux only tests
-run_dump_test "pltgot-1"
-run_dump_test "pltgot-2"
-run_dump_test "pr20830"
+# run_dump_test "pltgot-1"
+# run_dump_test "pltgot-2"
+# run_dump_test "pr20830"
run_dump_test "ibt-plt-1"
run_dump_test "ibt-plt-2a"
run_dump_test "ibt-plt-2b"
diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d binutils-2.30/ld/testsuite/ld-i386/pr19636-2d.d
--- binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d 2018-09-12 15:59:03.968158156 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/pr19636-2d.d 2018-09-12 16:20:30.046301550 +0100
@@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse
[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func
-
+#...
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d binutils-2.30/ld/testsuite/ld-i386/pr19636-2e.d
--- binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d 2018-09-12 15:59:03.966158171 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/pr19636-2e.d 2018-09-12 16:20:18.301391306 +0100
@@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse
[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func
[0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func
-
+#...
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.30/ld/testsuite/ld-x86-64/plt-main-bnd.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2018-09-12 15:59:04.038157619 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2018-09-12 16:43:58.243317284 +0100
@@ -1,3 +1,4 @@
+#pass
#...
Disassembly of section .plt.got:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.30/ld/testsuite/ld-x86-64/plt-main-ibt.dd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2018-09-12 15:59:04.027157703 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2018-09-12 16:46:42.417060121 +0100
@@ -1,3 +1,4 @@
+#pass
#...
Disassembly of section .plt.got:
diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.30/ld/testsuite/ld-x86-64/plt-main.rd
--- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd 2018-09-12 15:59:04.037157626 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/plt-main.rd 2018-09-12 16:34:34.950619373 +0100
@@ -1,4 +1,3 @@
-#failif
#...
[0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +bar \+ 0
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr19636-2e.d binutils-2.30/ld/testsuite/ld-x86-64/pr19636-2e.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr19636-2e.d 2018-09-12 15:59:04.034157649 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/pr19636-2e.d 2018-09-12 16:17:08.687840318 +0100
@@ -11,7 +11,7 @@ Relocation section '\.rela\.dyn' at offs
Relocation section '\.rela\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
[0-9a-f]+ +[0-9a-f]+ +R_X86_64_JUMP_SLOT +0+ +func3 \+ 0
-
+#...
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
#...
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-09-12 15:59:04.023157734 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-09-12 16:47:08.880857470 +0100
@@ -59,7 +59,7 @@ set x86_64tests {
"-shared -melf_x86_64 --no-ld-generated-unwind-info --hash-style=sysv" ""
"--64 -mrelax-relocations=yes"
{tlspic3.s tlspic2.s}
- {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd}
+ {{objdump -drj.text\ -Mintel64 tlspic2.dd}
{objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
"libtlspic2.so"}
{"TLS descriptor -fpic -shared transitions"
@@ -1837,18 +1837,18 @@ if { "$LD_CLASS" == "64bit" } then {
# This test needs 64-bit linker.
run_dump_test "pr17618"
}
-run_dump_test "pltgot-1"
-run_dump_test "pltgot-2"
-run_dump_test "pr20830a"
-run_dump_test "pr20830b"
-run_dump_test "pr21038a"
-run_dump_test "pr21038b"
-run_dump_test "pr21038c"
-run_dump_test "pr20830a-now"
-run_dump_test "pr20830b-now"
-run_dump_test "pr21038a-now"
-run_dump_test "pr21038b-now"
-run_dump_test "pr21038c-now"
+# run_dump_test "pltgot-1"
+# run_dump_test "pltgot-2"
+# run_dump_test "pr20830a"
+# run_dump_test "pr20830b"
+# run_dump_test "pr21038a"
+# run_dump_test "pr21038b"
+# run_dump_test "pr21038c"
+# run_dump_test "pr20830a-now"
+# run_dump_test "pr20830b-now"
+# run_dump_test "pr21038a-now"
+# run_dump_test "pr21038b-now"
+# run_dump_test "pr21038c-now"
run_dump_test "ibt-plt-1"
run_dump_test "ibt-plt-1-x32"
run_dump_test "ibt-plt-2a"