diff -upr ../binutils-2.22.52.0.1.orig/ld/testsuite/config/default.exp ld/testsuite/config/default.exp --- a/ld/testsuite/config/default.exp 2012-03-06 14:00:31.141957656 +0000 +++ b/ld/testsuite/config/default.exp 2012-03-06 14:09:33.492940503 +0000 @@ -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 { @@ -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 "" @@ -279,7 +279,7 @@ } 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 { diff -cpr ../binutils-2.22.52.0.1.orig/ld/testsuite/ld-bootstrap/bootstrap.exp ld/testsuite/ld-bootstrap/bootstrap.exp --- a/ld/testsuite/ld-bootstrap/bootstrap.exp 2012-03-06 14:00:30.503957676 +0000 +++ b/ld/testsuite/ld-bootstrap/bootstrap.exp 2012-03-06 15:03:33.949837926 +0000 @@ -71,7 +71,13 @@ # 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 ldparm [expr $ldparm - 1] + set ldexe [string range $ld 0 $ldparm] + } + if {$ldexe != "$objdir/ld-new"} { untested $testname continue } --- a/ld/emultempl/elf32.em 2013-04-24 11:06:47.777176887 +0100 +++ b/ld/emultempl/elf32.em 2013-04-24 11:07:22.405177847 +0100 @@ -105,6 +105,7 @@ input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; + link_info.relro = TRUE; } EOF