File binutils-disable-dt-relr.sh of Package binutils.29920

Disable support for packed relative relocs on i386/x86_64

the infrastructure for this requires the RELA relocations to
be idempotent.  Our local patch binutils-revert-rela.diff changes
behaviour back to old behaviour in which they aren't anymore.
We require this for backward compat in the SLE codestreams.
Adjusting the infrastructure to deal with this isn't trivial, so
instead whole-sale disable the whole support for packed relative
relocs (and adjust testsuite for that).

This is necessary for at least glibc which tries to use them when
they seem to be available in the linker, which ultimately generates
wrong relocs (basically they are applied "twice").

Index: binutils-2.39/binutils/testsuite/lib/binutils-common.exp
===================================================================
--- binutils-2.39.orig/binutils/testsuite/lib/binutils-common.exp	2022-07-08 11:46:47.000000000 +0200
+++ binutils-2.39/binutils/testsuite/lib/binutils-common.exp	2023-07-13 16:13:51.824789990 +0200
@@ -429,9 +429,7 @@ proc supports_persistent_section {} {
 
 # Whether a target support DT_RELR sections.
 proc supports_dt_relr {} {
-    if { ([istarget x86_64-*-*]
-	  || [istarget i?86-*-*]
-	  || [istarget powerpc64*-*-*])
+    if { ([istarget powerpc64*-*-*])
 	 && ([istarget *-*-linux*]
 	     || [istarget *-*-gnu*]) } {
 	return 1
Index: binutils-2.39/ld/emulparams/elf32_x86_64.sh
===================================================================
--- binutils-2.39.orig/ld/emulparams/elf32_x86_64.sh	2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/emulparams/elf32_x86_64.sh	2023-07-13 16:11:48.286724327 +0200
@@ -7,7 +7,7 @@ source_sh ${srcdir}/emulparams/cet.sh
 source_sh ${srcdir}/emulparams/x86-report-relative.sh
 source_sh ${srcdir}/emulparams/x86-64-level.sh
 source_sh ${srcdir}/emulparams/static.sh
-source_sh ${srcdir}/emulparams/dt-relr.sh
+#source_sh ${srcdir}/emulparams/dt-relr.sh
 SCRIPT_NAME=elf
 ELFSIZE=32
 OUTPUT_FORMAT="elf32-x86-64"
Index: binutils-2.39/ld/emulparams/elf_i386.sh
===================================================================
--- binutils-2.39.orig/ld/emulparams/elf_i386.sh	2023-07-13 16:04:41.919595303 +0200
+++ binutils-2.39/ld/emulparams/elf_i386.sh	2023-07-13 16:12:19.287242674 +0200
@@ -6,7 +6,7 @@ source_sh ${srcdir}/emulparams/cet.sh
 source_sh ${srcdir}/emulparams/x86-report-relative.sh
 source_sh ${srcdir}/emulparams/x86-64-level.sh
 source_sh ${srcdir}/emulparams/static.sh
-source_sh ${srcdir}/emulparams/dt-relr.sh
+#source_sh ${srcdir}/emulparams/dt-relr.sh
 SCRIPT_NAME=elf
 OUTPUT_FORMAT="elf32-i386"
 NO_RELA_RELOCS=yes
Index: binutils-2.39/ld/emulparams/elf_x86_64.sh
===================================================================
--- binutils-2.39.orig/ld/emulparams/elf_x86_64.sh	2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/emulparams/elf_x86_64.sh	2023-07-13 16:12:03.510978888 +0200
@@ -8,7 +8,7 @@ source_sh ${srcdir}/emulparams/x86-repor
 source_sh ${srcdir}/emulparams/x86-64-level.sh
 source_sh ${srcdir}/emulparams/x86-64-lam.sh
 source_sh ${srcdir}/emulparams/static.sh
-source_sh ${srcdir}/emulparams/dt-relr.sh
+#source_sh ${srcdir}/emulparams/dt-relr.sh
 SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-x86-64"
Index: binutils-2.39/ld/testsuite/ld-i386/i386.exp
===================================================================
--- binutils-2.39.orig/ld/testsuite/ld-i386/i386.exp	2022-07-26 09:13:10.000000000 +0200
+++ binutils-2.39/ld/testsuite/ld-i386/i386.exp	2023-07-13 16:20:30.479460469 +0200
@@ -507,8 +507,8 @@ run_dump_test "pr27491-1c"
 run_dump_test "pr27491-2"
 run_dump_test "pr27491-3"
 run_dump_test "pr27491-4"
-run_dump_test "dt-relr-1a"
-run_dump_test "dt-relr-1b"
+# run_dump_test "dt-relr-1a"
+# run_dump_test "dt-relr-1b"
 run_dump_test "pr28870"
 run_dump_test "pr28894"
 
Index: binutils-2.39/ld/testsuite/ld-x86-64/x86-64.exp
===================================================================
--- binutils-2.39.orig/ld/testsuite/ld-x86-64/x86-64.exp	2023-07-13 16:04:42.043597377 +0200
+++ binutils-2.39/ld/testsuite/ld-x86-64/x86-64.exp	2023-07-13 16:21:13.668183963 +0200
@@ -500,10 +500,10 @@ run_dump_test "pr27491-1c"
 run_dump_test "pr27491-2"
 run_dump_test "pr27491-3"
 run_dump_test "pr27491-4"
-run_dump_test "dt-relr-1a"
-run_dump_test "dt-relr-1a-x32"
-run_dump_test "dt-relr-1b"
-run_dump_test "dt-relr-1b-x32"
+# run_dump_test "dt-relr-1a"
+# run_dump_test "dt-relr-1a-x32"
+# run_dump_test "dt-relr-1b"
+# run_dump_test "dt-relr-1b-x32"
 
 if ![istarget "x86_64-*-linux*"] {
     return
openSUSE Build Service is sponsored by