SHA256
1
0
forked from pool/binutils
binutils/ld-relro.diff

64 lines
2.1 KiB
Diff

Index: ld/lexsup.c
===================================================================
--- ld/lexsup.c.orig 2012-07-13 15:20:26.000000000 +0200
+++ ld/lexsup.c 2012-09-14 14:00:57.262167402 +0200
@@ -608,6 +608,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 2012-03-15 02:57:57.000000000 +0100
+++ ld/testsuite/config/default.exp 2012-09-14 14:00:57.263167402 +0200
@@ -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 {
@@ -69,7 +69,7 @@ if {![file isdirectory tmpdir/ld]} then
catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
catch "exec ln -s ld tmpdir/ld/collect-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]} {
@@ -279,7 +279,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 2011-12-03 18:13:01.000000000 +0100
+++ ld/testsuite/ld-bootstrap/bootstrap.exp 2012-09-14 14:00:57.263167402 +0200
@@ -71,7 +71,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
}