ld relro
authorAnas Nashif <anas.nashif@intel.com>
Tue, 30 Oct 2012 19:43:07 +0000 (12:43 -0700)
committerVyacheslav Barinov <v.barinov@samsung.com>
Mon, 16 Feb 2015 07:34:03 +0000 (10:34 +0300)
ld/lexsup.c
ld/testsuite/config/default.exp
ld/testsuite/ld-bootstrap/bootstrap.exp

index 4812c97..082a328 100644 (file)
@@ -625,6 +625,9 @@ parse_args (unsigned argc, char **argv)
        }
     }
 
+  optarg = "relro";
+  ldemul_handle_option ('z');
+
   last_optind = -1;
   while (1)
     {
index 09b2626..aa6c13d 100644 (file)
@@ -22,7 +22,7 @@
 #
 
 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 {
@@ -60,7 +60,7 @@ if {![file isdirectory tmpdir/ld]} then {
     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
 set ld_L_opt ""
@@ -272,7 +272,7 @@ if ![info exists READELFFLAGS] 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 bbd4fd8..ccb07d5 100644 (file)
@@ -78,7 +78,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 {$ld != "$objdir/ld-new"} {
+    set ldexe $ld
+    set ldparm [string first " " $ld]
+    if { $ldparm > 0 } then {
+       set ldexe [string range $ld 0 $ldparm]
+    }
+    if {$ldexe != "$objdir/ld-new"} {
        untested $testname
        continue
     }