binutils/ld-relro.diff

64 lines
2.1 KiB
Diff

Index: ld/lexsup.c
===================================================================
--- ld/lexsup.c.orig 2009-11-23 14:02:48.000000000 +0100
+++ ld/lexsup.c 2009-11-23 14:03:09.000000000 +0100
@@ -687,6 +687,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 2009-11-23 14:02:48.000000000 +0100
+++ ld/testsuite/config/default.exp 2009-11-23 14:03:09.000000000 +0100
@@ -23,7 +23,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 {
@@ -68,7 +68,7 @@ if {![file isdirectory tmpdir/ld]} then
catch "exec mkdir tmpdir/ld" status
catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
}
-set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
+set gcc_ld_flag "-B[pwd]/tmpdir/ld/ -Wl,-z,norelro"
# load the linker path
if {[file exists tmpdir/libpath.exp]} {
@@ -270,7 +270,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: ld/testsuite/ld-bootstrap/bootstrap.exp
===================================================================
--- ld/testsuite/ld-bootstrap/bootstrap.exp.orig 2009-11-23 14:02:48.000000000 +0100
+++ ld/testsuite/ld-bootstrap/bootstrap.exp 2009-11-23 14:03:09.000000000 +0100
@@ -56,7 +56,12 @@ foreach flags {"" "strip" "--static" "--
# 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
}