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