File ld-relro.diff of Package binutils.35540

Index: ld/lexsup.c
===================================================================
--- ld/lexsup.c.orig	2024-08-04 01:00:00.000000000 +0200
+++ ld/lexsup.c	2024-08-06 16:02:35.554864901 +0200
@@ -772,6 +772,9 @@ parse_args (unsigned argc, char **argv)
 	}
     }
 
+  optarg = "relro";
+  ldemul_handle_option ('z');
+
   last_optind = -1;
   while (1)
     {
Index: ld/testsuite/config/default.exp
===================================================================
--- ld/testsuite/config/default.exp.orig	2024-08-04 01:00:00.000000000 +0200
+++ ld/testsuite/config/default.exp	2024-08-06 16:05:13.860859897 +0200
@@ -39,7 +39,7 @@ if [info exists env(LD_UNDER_TEST)] {
 }
 
 if ![info exists ld] then {
-    set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
+    set ld "[findfile $base_dir/ld-new $base_dir/ld-new [transform ld]] -znorelro"
 }
 
 if ![info exists as] then {
@@ -92,7 +92,7 @@ if {[info exists ld_testsuite_bindir]} {
     }
     catch "exec ln -s ld tmpdir/ld/collect-ld" status
     catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
-    set gcc_B_opt "-B[pwd]/tmpdir/ld/"
+    set gcc_B_opt "-B[pwd]/tmpdir/ld/ -Wl,-z,norelro"
 }
 
 # load the linker path
@@ -343,7 +343,7 @@ if ![info exists ELFEDIT] then {
 }
 
 if ![info exists LD] then {
-    set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
+    set LD "[findfile $base_dir/ld-new ./ld-new [transform ld]] -znorelro"
 }
 
 if ![info exists LDFLAGS] then {
Index: ld/testsuite/ld-bootstrap/bootstrap.exp
===================================================================
--- ld/testsuite/ld-bootstrap/bootstrap.exp.orig	2024-08-04 01:00:00.000000000 +0200
+++ ld/testsuite/ld-bootstrap/bootstrap.exp	2024-08-06 16:02:35.554864901 +0200
@@ -112,7 +112,12 @@ foreach flags $test_flags {
 
     # This test can only be run if we have the ld build directory,
     # since we need the object files.
-    if {[file normalize $ld] != [file normalize $objdir/ld-new]} {
+    set ldexe $ld
+    set ldparm [string first " " $ld]
+    if { $ldparm > 0 } then {
+	set ldexe [string range $ld 0 $ldparm]
+    }
+    if {[file normalize $ldexe] != [file normalize $objdir/ld-new]} {
 	untested $testname
 	continue
     }
openSUSE Build Service is sponsored by