]> git.ipfire.org Git - ipfire-3.x.git/blame - binutils/patches/binutils-2.22.52.0.1-relro-on-by-default.patch
pakfire: Add platform patches.
[ipfire-3.x.git] / binutils / patches / binutils-2.22.52.0.1-relro-on-by-default.patch
CommitLineData
34dec647
MT
1diff -Nur binutils-2.22.52.0.4-vanilla/ld/emultempl/armelf.em binutils-2.22.52.0.4/ld/emultempl/armelf.em
2--- binutils-2.22.52.0.4-vanilla/ld/emultempl/armelf.em 2012-06-05 18:44:10.000000000 +0200
3+++ binutils-2.22.52.0.4/ld/emultempl/armelf.em 2012-06-08 13:34:30.578427241 +0200
4@@ -52,6 +52,7 @@
5 #endif /* not TARGET_ */
6 input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
7 config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
8+ link_info.relro = TRUE;
9 }
10
11 static void
12diff -Nur binutils-2.22.52.0.4-vanilla/ld/emultempl/elf32.em binutils-2.22.52.0.4/ld/emultempl/elf32.em
13--- binutils-2.22.52.0.4-vanilla/ld/emultempl/elf32.em 2012-06-05 18:44:10.000000000 +0200
14+++ binutils-2.22.52.0.4/ld/emultempl/elf32.em 2012-06-08 13:33:07.090612102 +0200
15@@ -106,6 +106,7 @@
16 input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
17 config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
18 link_info.sharable_sections = `if test "$SHARABLE_SECTIONS" = "yes" ; then echo TRUE ; else echo FALSE ; fi`;
19+ link_info.relro = TRUE;
20 }
21
22 EOF
23diff -Nur binutils-2.22.52.0.4-vanilla/ld/testsuite/config/default.exp binutils-2.22.52.0.4/ld/testsuite/config/default.exp
24--- binutils-2.22.52.0.4-vanilla/ld/testsuite/config/default.exp 2012-06-05 18:44:10.000000000 +0200
25+++ binutils-2.22.52.0.4/ld/testsuite/config/default.exp 2012-06-08 13:33:07.085612052 +0200
26@@ -23,7 +23,7 @@
27 #
28
29 if ![info exists ld] then {
30- set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
31+ set ld "[findfile $base_dir/ld-new $base_dir/ld-new [transform ld]] -znorelro"
32 }
33
34 if ![info exists as] then {
35@@ -69,7 +69,7 @@
36 catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
37 catch "exec ln -s ld tmpdir/ld/collect-ld" status
38 }
39-set gcc_ld_flag "-B[pwd]/tmpdir/ld/"
40+set gcc_ld_flag "-B[pwd]/tmpdir/ld/ -Wl,-z,norelro"
41
42 # load the linker path
43 if {[file exists tmpdir/libpath.exp]} {
44@@ -279,7 +279,7 @@
45 }
46
47 if ![info exists LD] then {
48- set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
49+ set LD "[findfile $base_dir/ld-new ./ld-new [transform ld]] -znorelro"
50 }
51
52 if ![info exists LDFLAGS] then {
53diff -Nur binutils-2.22.52.0.4-vanilla/ld/testsuite/ld-bootstrap/bootstrap.exp binutils-2.22.52.0.4/ld/testsuite/ld-bootstrap/bootstrap.exp
54--- binutils-2.22.52.0.4-vanilla/ld/testsuite/ld-bootstrap/bootstrap.exp 2012-06-05 18:44:10.000000000 +0200
55+++ binutils-2.22.52.0.4/ld/testsuite/ld-bootstrap/bootstrap.exp 2012-06-08 13:33:07.086612062 +0200
56@@ -71,7 +71,13 @@
57
58 # This test can only be run if we have the ld build directory,
59 # since we need the object files.
60- if {$ld != "$objdir/ld-new"} {
61+ set ldexe $ld
62+ set ldparm [string first " " $ld]
63+ if { $ldparm > 0 } then {
64+ set ldparm [expr $ldparm - 1]
65+ set ldexe [string range $ld 0 $ldparm]
66+ }
67+ if {$ldexe != "$objdir/ld-new"} {
68 untested $testname
69 continue
70 }