1 |
vapier 16/07/04 05:57:52 |
2 |
|
3 |
Added: |
4 |
00_all_0001-Add-mips-and-s390-build-targets-for-gold.patch |
5 |
00_all_0002-ld-Add-a-linker-configure-option-enable-relro.patch |
6 |
00_all_0003-ld-tests-make-address-matches-more-flexible.patch |
7 |
00_all_0004-ld-always-warn-about-textrels-in-files.patch |
8 |
00_all_0005-gold-ld-add-support-for-poisoned-system-directories.patch |
9 |
00_all_0006-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
10 |
00_all_0007-gold-ld-enable-gnu-hash-by-default.patch |
11 |
00_all_0008-libiberty-install-PIC-version-of-libiberty.a.patch |
12 |
README.history |
13 |
Log: |
14 |
initial 2.26.1 patchset based on last 2.25.1 patchset (and on new git branch) |
15 |
|
16 |
Revision Changes Path |
17 |
1.1 src/patchsets/binutils/2.26.1/00_all_0001-Add-mips-and-s390-build-targets-for-gold.patch |
18 |
|
19 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0001-Add-mips-and-s390-build-targets-for-gold.patch?rev=1.1&view=markup |
20 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0001-Add-mips-and-s390-build-targets-for-gold.patch?rev=1.1&content-type=text/plain |
21 |
|
22 |
Index: 00_all_0001-Add-mips-and-s390-build-targets-for-gold.patch |
23 |
=================================================================== |
24 |
From 8f711d3426e1157e8faa83b3d7e6f4c0ad8bb440 Mon Sep 17 00:00:00 2001 |
25 |
From: Cary Coutant <ccoutant@×××××.com> |
26 |
Date: Thu, 17 Mar 2016 15:37:10 -0700 |
27 |
Subject: [PATCH] Add mips and s390 build targets for gold. |
28 |
|
29 |
* configure.ac: Add mips and s390 to the gold target check. |
30 |
* configure: Regenerate. |
31 |
|
32 |
(cherry picked from commit ea01647092eefeca9336b36809962ff097306b41) |
33 |
--- |
34 |
configure | 2 +- |
35 |
configure.ac | 2 +- |
36 |
2 files changed, 2 insertions(+), 2 deletions(-) |
37 |
|
38 |
diff --git a/configure.ac b/configure.ac |
39 |
index 4977d97e770b..606385461e44 100644 |
40 |
--- a/configure.ac |
41 |
+++ b/configure.ac |
42 |
@@ -351,7 +351,7 @@ case "${ENABLE_GOLD}" in |
43 |
# Check for target supported by gold. |
44 |
case "${target}" in |
45 |
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ |
46 |
- | aarch64*-*-* | tilegx*-*-*) |
47 |
+ | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*) |
48 |
configdirs="$configdirs gold" |
49 |
if test x${ENABLE_GOLD} = xdefault; then |
50 |
default_ld=gold |
51 |
diff --git a/configure b/configure |
52 |
index 34b66f7ea123..09b01f1769bb 100755 |
53 |
--- a/configure |
54 |
+++ b/configure |
55 |
@@ -2972,7 +2972,7 @@ case "${ENABLE_GOLD}" in |
56 |
# Check for target supported by gold. |
57 |
case "${target}" in |
58 |
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ |
59 |
- | aarch64*-*-* | tilegx*-*-*) |
60 |
+ | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*) |
61 |
configdirs="$configdirs gold" |
62 |
if test x${ENABLE_GOLD} = xdefault; then |
63 |
default_ld=gold |
64 |
-- |
65 |
2.8.0.rc3.226.g39d4020 |
66 |
|
67 |
|
68 |
|
69 |
|
70 |
1.1 src/patchsets/binutils/2.26.1/00_all_0002-ld-Add-a-linker-configure-option-enable-relro.patch |
71 |
|
72 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0002-ld-Add-a-linker-configure-option-enable-relro.patch?rev=1.1&view=markup |
73 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0002-ld-Add-a-linker-configure-option-enable-relro.patch?rev=1.1&content-type=text/plain |
74 |
|
75 |
Index: 00_all_0002-ld-Add-a-linker-configure-option-enable-relro.patch |
76 |
=================================================================== |
77 |
From 68ead870a7388dd4833ea22135ca50e5f82d4ca5 Mon Sep 17 00:00:00 2001 |
78 |
From: "H.J. Lu" <hjl.tools@×××××.com> |
79 |
Date: Wed, 22 Jun 2016 05:37:24 -0700 |
80 |
Subject: [PATCH] ld: Add a linker configure option --enable-relro |
81 |
|
82 |
Add a configure option --enable-relro to decide whether -z relro should |
83 |
be enabled in ELF linker by default. Default to yes for all Linux |
84 |
targets, except FRV, HPPA, IA64 and MIPS, since many relro tests fail |
85 |
on these targets. |
86 |
|
87 |
PR ld/20283 |
88 |
* NEWS: Mention --enable-relro. |
89 |
* configure.ac: Add --enable-relro. |
90 |
(DEFAULT_LD_Z_RELRO): New. Set by --enable-relro. |
91 |
* configure.tgt (ac_default_ld_z_relro): Default it to 1 for |
92 |
some Linux targets. |
93 |
* config.in: Regenerated. |
94 |
* configure: Likewise. |
95 |
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set |
96 |
link_info.relro to DEFAULT_LD_Z_RELRO. |
97 |
* testsuite/config/default.exp (ld_elf_shared_opt): New. |
98 |
* testsuite/lib/ld-lib.exp (run_dump_test): Pass |
99 |
$ld_elf_shared_opt to ld for ELF targets with shared object |
100 |
support. |
101 |
(run_ld_link_tests): Likewise. |
102 |
|
103 |
(cherry picked from commit 647e4d46495f2bfb0950fd1066c8a660173cca40) |
104 |
--- |
105 |
ld/config.in | 3 +++ |
106 |
ld/configure | 22 ++++++++++++++++++++++ |
107 |
ld/configure.ac | 18 ++++++++++++++++++ |
108 |
ld/configure.tgt | 25 +++++++++++++++++++++++++ |
109 |
ld/emultempl/elf32.em | 1 + |
110 |
ld/testsuite/config/default.exp | 3 +++ |
111 |
ld/testsuite/lib/ld-lib.exp | 18 ++++++++++++++++-- |
112 |
7 files changed, 88 insertions(+), 2 deletions(-) |
113 |
|
114 |
diff --git a/ld/configure.ac b/ld/configure.ac |
115 |
index e28f38ee3a5e..39ea2c868700 100644 |
116 |
--- a/ld/configure.ac |
117 |
+++ b/ld/configure.ac |
118 |
@@ -155,6 +155,17 @@ AC_ARG_ENABLE(compressed_debug_sections, |
119 |
,no, | ,none,) ac_default_compressed_debug_sections=no ;; |
120 |
esac])dnl |
121 |
|
122 |
+# Decide if -z relro should be enabled in ELF linker by default. |
123 |
+ac_default_ld_z_relro=unset |
124 |
+# Provide a configure time option to override our default. |
125 |
+AC_ARG_ENABLE(relro, |
126 |
+ AS_HELP_STRING([--enable-relro], |
127 |
+ [enable -z relro in ELF linker by default]), |
128 |
+[case "${enableval}" in |
129 |
+ yes) ac_default_ld_z_relro=1 ;; |
130 |
+ no) ac_default_ld_z_relro=0 ;; |
131 |
+esac])dnl |
132 |
+ |
133 |
AM_BINUTILS_WARNINGS |
134 |
|
135 |
AM_LC_MESSAGES |
136 |
@@ -388,6 +399,13 @@ if test x$ac_default_compressed_debug_sections = xyes ; then |
137 |
AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.]) |
138 |
fi |
139 |
|
140 |
+if test "${ac_default_ld_z_relro}" = unset; then |
141 |
+ ac_default_ld_z_relro=0 |
142 |
+fi |
143 |
+AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_RELRO, |
144 |
+ $ac_default_ld_z_relro, |
145 |
+ [Define to 1 if you want to enable -z relro in ELF linker by default.]) |
146 |
+ |
147 |
AC_SUBST(elf_list_options) |
148 |
AC_SUBST(elf_shlib_list_options) |
149 |
AC_SUBST(elf_plt_unwind_list_options) |
150 |
diff --git a/ld/config.in b/ld/config.in |
151 |
index 276fb776da0e..2c6d698b6ce1 100644 |
152 |
--- a/ld/config.in |
153 |
+++ b/ld/config.in |
154 |
@@ -10,6 +10,9 @@ |
155 |
/* Define if you want compressed debug sections by default. */ |
156 |
#undef DEFAULT_FLAG_COMPRESS_DEBUG |
157 |
|
158 |
+/* Define to 1 if you want to enable -z relro in ELF linker by default. */ |
159 |
+#undef DEFAULT_LD_Z_RELRO |
160 |
+ |
161 |
/* Define to 1 if translation of program messages to the user's native |
162 |
language is requested. */ |
163 |
#undef ENABLE_NLS |
164 |
diff --git a/ld/configure b/ld/configure |
165 |
index e1216616b795..a4c3350a4e45 100755 |
166 |
--- a/ld/configure |
167 |
+++ b/ld/configure |
168 |
@@ -789,6 +789,7 @@ with_sysroot |
169 |
enable_gold |
170 |
enable_got |
171 |
enable_compressed_debug_sections |
172 |
+enable_relro |
173 |
enable_werror |
174 |
enable_build_warnings |
175 |
enable_nls |
176 |
@@ -1447,6 +1448,7 @@ Optional Features: |
177 |
multigot) |
178 |
--enable-compressed-debug-sections={all,ld,none} |
179 |
compress debug sections by default] |
180 |
+ --enable-relro enable -z relro in ELF linker by default |
181 |
--enable-werror treat compile warnings as errors |
182 |
--enable-build-warnings enable build-time compiler warnings |
183 |
--disable-nls do not use Native Language Support |
184 |
@@ -15536,6 +15538,17 @@ if test "${enable_compressed_debug_sections+set}" = set; then : |
185 |
esac |
186 |
fi |
187 |
|
188 |
+# Decide if -z relro should be enabled in ELF linker by default. |
189 |
+ac_default_ld_z_relro=unset |
190 |
+# Provide a configure time option to override our default. |
191 |
+# Check whether --enable-relro was given. |
192 |
+if test "${enable_relro+set}" = set; then : |
193 |
+ enableval=$enable_relro; case "${enableval}" in |
194 |
+ yes) ac_default_ld_z_relro=1 ;; |
195 |
+ no) ac_default_ld_z_relro=0 ;; |
196 |
+esac |
197 |
+fi |
198 |
+ |
199 |
|
200 |
# Set the 'development' global. |
201 |
. $srcdir/../bfd/development.sh |
202 |
@@ -17140,6 +17153,15 @@ $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h |
203 |
|
204 |
fi |
205 |
|
206 |
+if test "${ac_default_ld_z_relro}" = unset; then |
207 |
+ ac_default_ld_z_relro=0 |
208 |
+fi |
209 |
+ |
210 |
+cat >>confdefs.h <<_ACEOF |
211 |
+#define DEFAULT_LD_Z_RELRO $ac_default_ld_z_relro |
212 |
+_ACEOF |
213 |
+ |
214 |
+ |
215 |
|
216 |
|
217 |
|
218 |
diff --git a/ld/configure.tgt b/ld/configure.tgt |
219 |
index 6b6bbf25771e..ad24b507f738 100644 |
220 |
--- a/ld/configure.tgt |
221 |
+++ b/ld/configure.tgt |
222 |
@@ -876,3 +876,28 @@ alpha*-*-*) |
223 |
;; |
224 |
|
225 |
esac |
226 |
+ |
227 |
+case "${target}" in |
228 |
+frv-*-* | hppa*-*-* | ia64-*-* | mips*-*-*) |
229 |
+ # Don't enable -z relro by default since many relro tests fail on these |
230 |
+ # targets: |
231 |
+ # FAIL: strip -z relro (relro1) |
232 |
+ # FAIL: strip -z relro -shared (relro1) |
233 |
+ # FAIL: objcopy -z relro (relro1) |
234 |
+ # FAIL: objcopy -z relro -shared (relro1) |
235 |
+ # FAIL: objcopy -z relro (tdata1) |
236 |
+ # FAIL: objcopy -shared -z relro (tdata1) |
237 |
+ # FAIL: objcopy -z relro (tdata2) |
238 |
+ # FAIL: objcopy -shared -z relro (tdata2) |
239 |
+ # FAIL: objcopy -z relro (tdata3) |
240 |
+ # FAIL: objcopy -shared -z relro (tdata3) |
241 |
+ # FAIL: objcopy -shared -z relro (tbss1) |
242 |
+ # FAIL: objcopy -shared -z relro (tbss2) |
243 |
+ # FAIL: objcopy -shared -z relro (tbss3) |
244 |
+ ;; |
245 |
+*-*-linux*) |
246 |
+ if test ${ac_default_ld_z_relro} = unset; then |
247 |
+ ac_default_ld_z_relro=1 |
248 |
+ fi |
249 |
+ ;; |
250 |
+esac |
251 |
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em |
252 |
index 809b27c8bf7f..69a67b0e1f36 100644 |
253 |
--- a/ld/emultempl/elf32.em |
254 |
+++ b/ld/emultempl/elf32.em |
255 |
@@ -104,6 +104,7 @@ gld${EMULATION_NAME}_before_parse (void) |
256 |
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
257 |
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
258 |
`if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`; |
259 |
+ link_info.relro = DEFAULT_LD_Z_RELRO; |
260 |
} |
261 |
|
262 |
EOF |
263 |
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp |
264 |
index 310a3b21ba85..686dfb1b5dff 100644 |
265 |
--- a/ld/testsuite/config/default.exp |
266 |
+++ b/ld/testsuite/config/default.exp |
267 |
@@ -76,6 +76,9 @@ if {[file exists tmpdir/libpath.exp]} { |
268 |
} |
269 |
} |
270 |
|
271 |
+# Many ELF testcases expect that "-z relro" is off. |
272 |
+set ld_elf_shared_opt "-z norelro" |
273 |
+ |
274 |
# The "make check" target in the Makefile passes in |
275 |
# "CC=$(CC_FOR_TARGET)". But, if the user invokes runtest directly |
276 |
# (as when testing an installed linker), these flags may not be set. |
277 |
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp |
278 |
index 364c6facba89..d1391da04883 100644 |
279 |
--- a/ld/testsuite/lib/ld-lib.exp |
280 |
+++ b/ld/testsuite/lib/ld-lib.exp |
281 |
@@ -588,6 +588,13 @@ proc run_dump_test { name {extra_options {}} } { |
282 |
global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS |
283 |
global host_triplet runtests |
284 |
global env verbose |
285 |
+ global ld_elf_shared_opt |
286 |
+ |
287 |
+ if { [is_elf_format] && [check_shared_lib_support] } { |
288 |
+ set ld_extra_opt "$ld_elf_shared_opt" |
289 |
+ } else { |
290 |
+ set ld_extra_opt "" |
291 |
+ } |
292 |
|
293 |
if [string match "*/*" $name] { |
294 |
set file $name |
295 |
@@ -910,7 +917,7 @@ proc run_dump_test { name {extra_options {}} } { |
296 |
|
297 |
# Add -L$srcdir/$subdir so that the linker command can use |
298 |
# linker scripts in the source directory. |
299 |
- set cmd "$LD $LDFLAGS -L$srcdir/$subdir \ |
300 |
+ set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \ |
301 |
$opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)" |
302 |
|
303 |
# If needed then check for, or add a -Map option. |
304 |
@@ -1164,6 +1171,13 @@ proc run_ld_link_tests { ldtests } { |
305 |
global CFLAGS |
306 |
global runtests |
307 |
global exec_output |
308 |
+ global ld_elf_shared_opt |
309 |
+ |
310 |
+ if { [is_elf_format] && [check_shared_lib_support] } { |
311 |
+ set ld_extra_opt "$ld_elf_shared_opt" |
312 |
+ } else { |
313 |
+ set ld_extra_opt "" |
314 |
+ } |
315 |
|
316 |
foreach testitem $ldtests { |
317 |
set testname [lindex $testitem 0] |
318 |
@@ -1226,7 +1240,7 @@ proc run_ld_link_tests { ldtests } { |
319 |
if { ![ar_simple_create $ar $ld_options $binfile "$objfiles $ld_after"] } { |
320 |
set failed 1 |
321 |
} |
322 |
- } elseif { ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles $ld_after"] } { |
323 |
+ } elseif { ![ld_simple_link $ld $binfile "$ld_extra_opt -L$srcdir/$subdir $ld_options $objfiles $ld_after"] } { |
324 |
set maybe_failed 1 |
325 |
set ld_output "$exec_output" |
326 |
} |
327 |
-- |
328 |
2.8.0.rc3.226.g39d4020 |
329 |
|
330 |
|
331 |
|
332 |
|
333 |
1.1 src/patchsets/binutils/2.26.1/00_all_0003-ld-tests-make-address-matches-more-flexible.patch |
334 |
|
335 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0003-ld-tests-make-address-matches-more-flexible.patch?rev=1.1&view=markup |
336 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0003-ld-tests-make-address-matches-more-flexible.patch?rev=1.1&content-type=text/plain |
337 |
|
338 |
Index: 00_all_0003-ld-tests-make-address-matches-more-flexible.patch |
339 |
=================================================================== |
340 |
From 2a2578b4787d734c0fd638ba422f98b6851b3d90 Mon Sep 17 00:00:00 2001 |
341 |
From: Mike Frysinger <vapier@g.o> |
342 |
Date: Sun, 7 Mar 2010 20:11:55 -0500 |
343 |
Subject: [PATCH] ld: tests: make address matches more flexible |
344 |
|
345 |
Make some of the address matches more flexible fixes tests when using |
346 |
pax/relro/hash patches. These addresses are not important to making |
347 |
sure the test passes/fails. |
348 |
--- |
349 |
ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d | 4 ++-- |
350 |
ld/testsuite/ld-ifunc/ifunc-2-x86-64.d | 4 ++-- |
351 |
2 files changed, 4 insertions(+), 4 deletions(-) |
352 |
|
353 |
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d |
354 |
index f72359d8dc8a..e29323ed84c8 100644 |
355 |
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d |
356 |
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d |
357 |
@@ -4,6 +4,6 @@ |
358 |
#target: x86_64-*-* |
359 |
|
360 |
#... |
361 |
-[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x220@plt> |
362 |
-[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x220@plt> |
363 |
+[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt> |
364 |
+[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt> |
365 |
#pass |
366 |
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d |
367 |
index f72359d8dc8a..e29323ed84c8 100644 |
368 |
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d |
369 |
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d |
370 |
@@ -4,6 +4,6 @@ |
371 |
#target: x86_64-*-* |
372 |
|
373 |
#... |
374 |
-[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x220@plt> |
375 |
-[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x220@plt> |
376 |
+[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt> |
377 |
+[ \t0-9a-f]+:[ \t0-9a-f]+lea[ \t]+.*\(%rip\),%rax.*[ \t0-9a-fq]+<\*ABS\*\+0x[a-f0-9]+@plt> |
378 |
#pass |
379 |
-- |
380 |
2.8.0.rc3.226.g39d4020 |
381 |
|
382 |
|
383 |
|
384 |
|
385 |
1.1 src/patchsets/binutils/2.26.1/00_all_0004-ld-always-warn-about-textrels-in-files.patch |
386 |
|
387 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0004-ld-always-warn-about-textrels-in-files.patch?rev=1.1&view=markup |
388 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0004-ld-always-warn-about-textrels-in-files.patch?rev=1.1&content-type=text/plain |
389 |
|
390 |
Index: 00_all_0004-ld-always-warn-about-textrels-in-files.patch |
391 |
=================================================================== |
392 |
From 0e182c6ffe388f97f7448674a1baf28b7c93abc8 Mon Sep 17 00:00:00 2001 |
393 |
From: Mike Frysinger <vapier@g.o> |
394 |
Date: Mon, 16 May 2005 22:10:19 -0400 |
395 |
Subject: [PATCH] ld: always warn about textrels in files |
396 |
|
397 |
textrels are bad for forcing copy-on-write (this affects everyone), and for |
398 |
security/runtime code generation, this affects security ppl. But in either |
399 |
case, it doesn't matter who needs textrels, it's the very fact that they're |
400 |
needed at all. |
401 |
--- |
402 |
ld/ldmain.c | 1 + |
403 |
ld/testsuite/lib/ld-lib.exp | 4 ++++ |
404 |
2 files changed, 5 insertions(+) |
405 |
|
406 |
diff --git a/ld/ldmain.c b/ld/ldmain.c |
407 |
index bb0b9ccb2f44..ca34975ff28b 100644 |
408 |
--- a/ld/ldmain.c |
409 |
+++ b/ld/ldmain.c |
410 |
@@ -280,6 +280,7 @@ main (int argc, char **argv) |
411 |
link_info.extern_protected_data = -1; |
412 |
link_info.pei386_auto_import = -1; |
413 |
link_info.spare_dynamic_tags = 5; |
414 |
+ link_info.warn_shared_textrel = TRUE; |
415 |
link_info.path_separator = ':'; |
416 |
#ifdef DEFAULT_FLAG_COMPRESS_DEBUG |
417 |
link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; |
418 |
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp |
419 |
index d1391da04883..fab98909ad36 100644 |
420 |
--- a/ld/testsuite/lib/ld-lib.exp |
421 |
+++ b/ld/testsuite/lib/ld-lib.exp |
422 |
@@ -246,6 +246,10 @@ proc default_ld_simple_link { ld target objects } { |
423 |
# symbol, since the default linker script might use ENTRY. |
424 |
regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output |
425 |
|
426 |
+ # Gentoo tweak: |
427 |
+ # We want to ignore TEXTREL warnings since we force enable them by default |
428 |
+ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output |
429 |
+ |
430 |
return [string match "" $exec_output] |
431 |
} |
432 |
|
433 |
-- |
434 |
2.8.0.rc3.226.g39d4020 |
435 |
|
436 |
|
437 |
|
438 |
|
439 |
1.1 src/patchsets/binutils/2.26.1/00_all_0005-gold-ld-add-support-for-poisoned-system-directories.patch |
440 |
|
441 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0005-gold-ld-add-support-for-poisoned-system-directories.patch?rev=1.1&view=markup |
442 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0005-gold-ld-add-support-for-poisoned-system-directories.patch?rev=1.1&content-type=text/plain |
443 |
|
444 |
Index: 00_all_0005-gold-ld-add-support-for-poisoned-system-directories.patch |
445 |
=================================================================== |
446 |
From 91a74546327189c6329ebce2efe067d1f47bee54 Mon Sep 17 00:00:00 2001 |
447 |
From: Mike Frysinger <vapier@g.o> |
448 |
Date: Mon, 25 May 2015 04:42:58 -0400 |
449 |
Subject: [PATCH] gold/ld: add support for poisoned system directories |
450 |
|
451 |
This is based on the old CodeSourcery patch written by Joseph Myers to add |
452 |
support to the link for detecting & rejecting bad -L paths when using a |
453 |
cross-compiler. The differences here: |
454 |
* The command line flags are always available. |
455 |
* We can turn on & off the warning via the command line. |
456 |
* The configure option controls the default warning behavior. |
457 |
* Add support for gold. |
458 |
|
459 |
It is not currently upstream, nor has it been submitted at all. There are |
460 |
no plans to do so currently either. |
461 |
|
462 |
BUG=chromium:488360 |
463 |
TEST=`cbuildbot chromiumos-sdk` passes # tests arm/amd64/mipsel/x86 |
464 |
TEST=`cbuildbot panther_moblab-full whirlwind-release` pass |
465 |
TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures |
466 |
TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd) |
467 |
|
468 |
Reviewed-on: https://chromium-review.googlesource.com/272083 |
469 |
--- |
470 |
gold/options.cc | 33 +++++++++++++++++++++++++++++++++ |
471 |
gold/options.h | 7 +++++++ |
472 |
ld/config.in | 3 +++ |
473 |
ld/configure | 14 ++++++++++++++ |
474 |
ld/configure.ac | 10 ++++++++++ |
475 |
ld/ld.h | 7 +++++++ |
476 |
ld/ld.texinfo | 18 ++++++++++++++++++ |
477 |
ld/ldfile.c | 20 ++++++++++++++++++++ |
478 |
ld/ldlex.h | 3 +++ |
479 |
ld/ldmain.c | 7 +++++++ |
480 |
ld/lexsup.c | 24 ++++++++++++++++++++++++ |
481 |
11 files changed, 146 insertions(+) |
482 |
|
483 |
diff --git a/gold/options.cc b/gold/options.cc |
484 |
index c42623f01969..276a6465b3ca 100644 |
485 |
--- a/gold/options.cc |
486 |
+++ b/gold/options.cc |
487 |
@@ -1222,6 +1222,39 @@ General_options::finalize() |
488 |
// in the path, as appropriate. |
489 |
this->add_sysroot(); |
490 |
|
491 |
+ // Now check if library_path is poisoned. |
492 |
+ if (this->warn_poison_system_directories()) |
493 |
+ { |
494 |
+ std::vector<std::string> bad_paths; |
495 |
+ |
496 |
+ bad_paths.push_back("/lib"); |
497 |
+ // TODO: This check is disabled for now due to a bunch of packages that |
498 |
+ // use libtool and relink with -L/usr/lib paths (albeit after the right |
499 |
+ // sysroot path). Once those are fixed we can enable. |
500 |
+ // We also need to adjust it so it only rejects one or two levels deep. |
501 |
+ // Gcc's internal paths also live below /usr/lib. |
502 |
+ // http://crbug.com/488360 |
503 |
+ // bad_paths.push_back("/usr/lib"); |
504 |
+ bad_paths.push_back("/usr/local/lib"); |
505 |
+ bad_paths.push_back("/usr/X11R6/lib"); |
506 |
+ |
507 |
+ for (std::vector<std::string>::const_iterator b = bad_paths.begin(); |
508 |
+ b != bad_paths.end(); |
509 |
+ ++b) |
510 |
+ for (Dir_list::iterator p = this->library_path_.value.begin(); |
511 |
+ p != this->library_path_.value.end(); |
512 |
+ ++p) |
513 |
+ if (!p->name().compare(0, b->size(), *b)) |
514 |
+ { |
515 |
+ if (this->error_poison_system_directories()) |
516 |
+ gold_fatal(_("library search path \"%s\" is unsafe for " |
517 |
+ "cross-compilation"), p->name().c_str()); |
518 |
+ else |
519 |
+ gold_warning(_("library search path \"%s\" is unsafe for " |
520 |
+ "cross-compilation"), p->name().c_str()); |
521 |
+ } |
522 |
+ } |
523 |
+ |
524 |
// Now that we've normalized the options, check for contradictory ones. |
525 |
if (this->shared() && this->is_static()) |
526 |
gold_fatal(_("-shared and -static are incompatible")); |
527 |
diff --git a/gold/options.h b/gold/options.h |
528 |
index ffc44e6d7525..5d820f29fa91 100644 |
529 |
--- a/gold/options.h |
530 |
+++ b/gold/options.h |
531 |
@@ -1219,6 +1219,13 @@ class General_options |
532 |
DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false, |
533 |
N_("Ignored"), NULL); |
534 |
|
535 |
+ DEFINE_bool(warn_poison_system_directories, options::TWO_DASHES, '\0', false, |
536 |
+ N_("Warn for -L options using system directories"), |
537 |
+ N_("Do not warn for -L options using system directories")); |
538 |
+ DEFINE_bool(error_poison_system_directories, options::TWO_DASHES, '\0', false, |
539 |
+ N_("Give an error for -L options using system directories"), |
540 |
+ NULL); |
541 |
+ |
542 |
DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true, |
543 |
N_("Warn when skipping an incompatible library"), |
544 |
N_("Don't warn when skipping an incompatible library")); |
545 |
diff --git a/ld/configure.ac b/ld/configure.ac |
546 |
index 39ea2c868700..1ea1e11324c2 100644 |
547 |
--- a/ld/configure.ac |
548 |
+++ b/ld/configure.ac |
549 |
@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot) |
550 |
AC_SUBST(TARGET_SYSTEM_ROOT) |
551 |
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) |
552 |
|
553 |
+AC_ARG_ENABLE([poison-system-directories], |
554 |
+ AS_HELP_STRING([--enable-poison-system-directories], |
555 |
+ [warn for use of native system library directories]),, |
556 |
+ [enable_poison_system_directories=no]) |
557 |
+if test "x${enable_poison_system_directories}" = "xyes"; then |
558 |
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], |
559 |
+ [1], |
560 |
+ [Define to warn for use of native system library directories]) |
561 |
+fi |
562 |
+ |
563 |
dnl Use --enable-gold to decide if this linker should be the default. |
564 |
dnl "install_as_default" is set to false if gold is the default linker. |
565 |
dnl "installed_linker" is the installed BFD linker name. |
566 |
diff --git a/ld/config.in b/ld/config.in |
567 |
index 2c6d698b6ce1..d3cb7e882de9 100644 |
568 |
--- a/ld/config.in |
569 |
+++ b/ld/config.in |
570 |
@@ -17,6 +17,9 @@ |
571 |
language is requested. */ |
572 |
#undef ENABLE_NLS |
573 |
|
574 |
+/* Define to warn for use of native system library directories */ |
575 |
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES |
576 |
+ |
577 |
/* Additional extension a shared object might have. */ |
578 |
#undef EXTRA_SHLIB_EXTENSION |
579 |
|
580 |
diff --git a/ld/configure b/ld/configure |
581 |
index a4c3350a4e45..47e657a58893 100755 |
582 |
--- a/ld/configure |
583 |
+++ b/ld/configure |
584 |
@@ -786,6 +786,7 @@ with_lib_path |
585 |
enable_targets |
586 |
enable_64_bit_bfd |
587 |
with_sysroot |
588 |
+enable_poison_system_directories |
589 |
enable_gold |
590 |
enable_got |
591 |
enable_compressed_debug_sections |
592 |
@@ -1443,6 +1444,8 @@ Optional Features: |
593 |
--disable-largefile omit support for large files |
594 |
--enable-targets alternative target configurations |
595 |
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) |
596 |
+ --enable-poison-system-directories |
597 |
+ warn for use of native system library directories |
598 |
--enable-gold[=ARG] build gold [ARG={default,yes,no}] |
599 |
--enable-got=<type> GOT handling scheme (target, single, negative, |
600 |
multigot) |
601 |
@@ -15493,7 +15496,18 @@ else |
602 |
fi |
603 |
|
604 |
|
605 |
+# Check whether --enable-poison-system-directories was given. |
606 |
+if test "${enable_poison_system_directories+set}" = set; then : |
607 |
+ enableval=$enable_poison_system_directories; |
608 |
+else |
609 |
+ enable_poison_system_directories=no |
610 |
+fi |
611 |
+ |
612 |
+if test "x${enable_poison_system_directories}" = "xyes"; then |
613 |
|
614 |
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h |
615 |
+ |
616 |
+fi |
617 |
|
618 |
# Check whether --enable-got was given. |
619 |
if test "${enable_got+set}" = set; then : |
620 |
diff --git a/ld/ld.h b/ld/ld.h |
621 |
index d84ec4e634ea..1669f6cff877 100644 |
622 |
--- a/ld/ld.h |
623 |
+++ b/ld/ld.h |
624 |
@@ -164,6 +164,13 @@ typedef struct { |
625 |
/* If set, display the target memory usage (per memory region). */ |
626 |
bfd_boolean print_memory_usage; |
627 |
|
628 |
+ /* If TRUE warn for uses of system directories when cross linking. */ |
629 |
+ bfd_boolean warn_poison_system_directories; |
630 |
+ |
631 |
+ /* If TRUE (default FALSE) give an error for uses of system |
632 |
+ directories when cross linking instead of a warning. */ |
633 |
+ bfd_boolean error_poison_system_directories; |
634 |
+ |
635 |
/* Big or little endian as set on command line. */ |
636 |
enum endian_enum endian; |
637 |
|
638 |
diff --git a/ld/ld.texinfo b/ld/ld.texinfo |
639 |
index 238966119323..b61cf2b05d32 100644 |
640 |
--- a/ld/ld.texinfo |
641 |
+++ b/ld/ld.texinfo |
642 |
@@ -2338,6 +2338,24 @@ string identifying the original linked file does not change. |
643 |
|
644 |
Passing @code{none} for @var{style} disables the setting from any |
645 |
@code{--build-id} options earlier on the command line. |
646 |
+ |
647 |
+@kindex --warn-poison-system-directories |
648 |
+@item --warn-poison-system-directories |
649 |
+Warn for @option{-L} options using system directories such as |
650 |
+@file{/usr/lib} when cross linking. This option is intended for use |
651 |
+in environments that want to detect and reject incorrect link settings. |
652 |
+ |
653 |
+@kindex --no-warn-poison-system-directories |
654 |
+@item --no-warn-poison-system-directories |
655 |
+Do not warn for @option{-L} options using system directories such as |
656 |
+@file{/usr/lib} when cross linking. This option is intended for use |
657 |
+in chroot environments when such directories contain the correct |
658 |
+libraries for the target system rather than the host. |
659 |
+ |
660 |
+@kindex --error-poison-system-directories |
661 |
+@item --error-poison-system-directories |
662 |
+Give an error instead of a warning for @option{-L} options using |
663 |
+system directories when cross linking. |
664 |
@end table |
665 |
|
666 |
@c man end |
667 |
diff --git a/ld/ldfile.c b/ld/ldfile.c |
668 |
index 96f9ecc0157d..22390ed7c500 100644 |
669 |
--- a/ld/ldfile.c |
670 |
+++ b/ld/ldfile.c |
671 |
@@ -114,6 +114,26 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline) |
672 |
new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); |
673 |
else |
674 |
new_dirs->name = xstrdup (name); |
675 |
+ |
676 |
+ if (command_line.warn_poison_system_directories |
677 |
+ && (!strncmp (name, "/lib", 4) |
678 |
+ /* TODO: This check is disabled for now due to a bunch of packages that |
679 |
+ * use libtool and relink with -L/usr/lib paths (albeit after the right |
680 |
+ * sysroot path). Once those are fixed we can enable. |
681 |
+ * We also need to adjust it so it only rejects one or two levels deep. |
682 |
+ * Gcc's internal paths also live below /usr/lib. |
683 |
+ * http://crbug.com/488360 */ |
684 |
+ /* || !strncmp (name, "/usr/lib", 8) */ |
685 |
+ || !strncmp (name, "/usr/local/lib", 14) |
686 |
+ || !strncmp (name, "/usr/X11R6/lib", 14))) |
687 |
+ { |
688 |
+ if (command_line.error_poison_system_directories) |
689 |
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " |
690 |
+ "cross-compilation\n"), name); |
691 |
+ else |
692 |
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for " |
693 |
+ "cross-compilation\n"), name); |
694 |
+ } |
695 |
} |
696 |
|
697 |
/* Try to open a BFD for a lang_input_statement. */ |
698 |
diff --git a/ld/ldlex.h b/ld/ldlex.h |
699 |
index 6f11e7bd2178..50ff957fcfaf 100644 |
700 |
--- a/ld/ldlex.h |
701 |
+++ b/ld/ldlex.h |
702 |
@@ -139,6 +139,9 @@ enum option_values |
703 |
OPTION_PRINT_OUTPUT_FORMAT, |
704 |
OPTION_PRINT_SYSROOT, |
705 |
OPTION_IGNORE_UNRESOLVED_SYMBOL, |
706 |
+ OPTION_WARN_POISON_SYSTEM_DIRECTORIES, |
707 |
+ OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES, |
708 |
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, |
709 |
OPTION_PUSH_STATE, |
710 |
OPTION_POP_STATE, |
711 |
OPTION_PRINT_MEMORY_USAGE, |
712 |
diff --git a/ld/ldmain.c b/ld/ldmain.c |
713 |
index ca34975ff28b..b73349f74295 100644 |
714 |
--- a/ld/ldmain.c |
715 |
+++ b/ld/ldmain.c |
716 |
@@ -257,6 +257,13 @@ main (int argc, char **argv) |
717 |
command_line.warn_mismatch = TRUE; |
718 |
command_line.warn_search_mismatch = TRUE; |
719 |
command_line.check_section_addresses = -1; |
720 |
+ command_line.warn_poison_system_directories = |
721 |
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES |
722 |
+ TRUE; |
723 |
+#else |
724 |
+ FALSE; |
725 |
+#endif |
726 |
+ command_line.error_poison_system_directories = FALSE; |
727 |
|
728 |
/* We initialize DEMANGLING based on the environment variable |
729 |
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the |
730 |
diff --git a/ld/lexsup.c b/ld/lexsup.c |
731 |
index e2fb21264f0f..82fc16666840 100644 |
732 |
--- a/ld/lexsup.c |
733 |
+++ b/ld/lexsup.c |
734 |
@@ -519,6 +519,18 @@ static const struct ld_option ld_options[] = |
735 |
OPTION_IGNORE_UNRESOLVED_SYMBOL}, |
736 |
'\0', N_("SYMBOL"), |
737 |
N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES }, |
738 |
+ { {"warn-poison-system-directories", no_argument, NULL, |
739 |
+ OPTION_WARN_POISON_SYSTEM_DIRECTORIES}, |
740 |
+ '\0', NULL, N_("Warn for -L options using system directories"), |
741 |
+ TWO_DASHES }, |
742 |
+ { {"no-warn-poison-system-directories", no_argument, NULL, |
743 |
+ OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES}, |
744 |
+ '\0', NULL, N_("Do not warn for -L options using system directories"), |
745 |
+ TWO_DASHES }, |
746 |
+ { {"error-poison-system-directories", no_argument, NULL, |
747 |
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, |
748 |
+ '\0', NULL, N_("Give an error for -L options using system directories"), |
749 |
+ TWO_DASHES }, |
750 |
{ {"push-state", no_argument, NULL, OPTION_PUSH_STATE}, |
751 |
'\0', NULL, N_("Push state of flags governing input file handling"), |
752 |
TWO_DASHES }, |
753 |
@@ -1516,6 +1528,18 @@ parse_args (unsigned argc, char **argv) |
754 |
} |
755 |
break; |
756 |
|
757 |
+ case OPTION_WARN_POISON_SYSTEM_DIRECTORIES: |
758 |
+ command_line.warn_poison_system_directories = TRUE; |
759 |
+ break; |
760 |
+ |
761 |
+ case OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES: |
762 |
+ command_line.warn_poison_system_directories = FALSE; |
763 |
+ break; |
764 |
+ |
765 |
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: |
766 |
+ command_line.error_poison_system_directories = TRUE; |
767 |
+ break; |
768 |
+ |
769 |
case OPTION_PUSH_STATE: |
770 |
input_flags.pushed = xmemdup (&input_flags, |
771 |
sizeof (input_flags), |
772 |
-- |
773 |
2.8.0.rc3.226.g39d4020 |
774 |
|
775 |
|
776 |
|
777 |
|
778 |
1.1 src/patchsets/binutils/2.26.1/00_all_0006-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
779 |
|
780 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0006-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch?rev=1.1&view=markup |
781 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0006-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch?rev=1.1&content-type=text/plain |
782 |
|
783 |
Index: 00_all_0006-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
784 |
=================================================================== |
785 |
From e23fa81adf41d3460f2a73f30471ae532e29df52 Mon Sep 17 00:00:00 2001 |
786 |
From: Mike Frysinger <vapier@g.o> |
787 |
Date: Fri, 7 Jan 2005 00:15:53 -0500 |
788 |
Subject: [PATCH] ld: enable new dtags by default for linux/gnu targets |
789 |
|
790 |
The "new" dtags options have been around for 14+ years now, so for Linux |
791 |
and GNU targets, enable them by default. |
792 |
|
793 |
2012-01-21 Mike Frysinger <vapier@g.o> |
794 |
|
795 |
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set |
796 |
link_info.new_dtags to TRUE for linux/gnu targets. |
797 |
* NEWS: Mention new dtags default. |
798 |
|
799 |
2013-01-22 Roland McGrath <mcgrathr@××××××.com> |
800 |
|
801 |
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set |
802 |
new_dtags to TRUE for *-*-nacl* targets. |
803 |
--- |
804 |
ld/emultempl/elf32.em | 10 ++++++++++ |
805 |
1 file changed, 10 insertions(+) |
806 |
|
807 |
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em |
808 |
index 69a67b0e1f36..533f227e659a 100644 |
809 |
--- a/ld/emultempl/elf32.em |
810 |
+++ b/ld/emultempl/elf32.em |
811 |
@@ -103,6 +103,16 @@ gld${EMULATION_NAME}_before_parse (void) |
812 |
input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; |
813 |
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
814 |
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
815 |
+EOF |
816 |
+ |
817 |
+case ${target} in |
818 |
+ *-*-linux-* | *-*-k*bsd*-* | *-*-gnu* | *-*-nacl*) |
819 |
+ fragment <<EOF |
820 |
+ link_info.new_dtags = TRUE; |
821 |
+EOF |
822 |
+ ;; |
823 |
+esac |
824 |
+fragment <<EOF |
825 |
`if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`; |
826 |
link_info.relro = DEFAULT_LD_Z_RELRO; |
827 |
} |
828 |
-- |
829 |
2.8.0.rc3.226.g39d4020 |
830 |
|
831 |
|
832 |
|
833 |
|
834 |
1.1 src/patchsets/binutils/2.26.1/00_all_0007-gold-ld-enable-gnu-hash-by-default.patch |
835 |
|
836 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0007-gold-ld-enable-gnu-hash-by-default.patch?rev=1.1&view=markup |
837 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0007-gold-ld-enable-gnu-hash-by-default.patch?rev=1.1&content-type=text/plain |
838 |
|
839 |
Index: 00_all_0007-gold-ld-enable-gnu-hash-by-default.patch |
840 |
=================================================================== |
841 |
From 7e57f673f08ef266788c1fc018209cc543864b3f Mon Sep 17 00:00:00 2001 |
842 |
From: Mike Frysinger <vapier@g.o> |
843 |
Date: Sat, 27 Jan 2007 15:01:08 -0500 |
844 |
Subject: [PATCH] gold/ld: enable gnu hash by default |
845 |
|
846 |
Glibc first added .gnu.hash support to glibc-2.5 (released 29 Sep 2006), |
847 |
and gold was first released after that. Let's default the gnu hash style |
848 |
to the new "gnu" rather than the classic sysv. |
849 |
|
850 |
gold/: |
851 |
2012-02-03 Mike Frysinger <vapier@g.o> |
852 |
|
853 |
* options.h (General_options): Change default to gnu for hash_style. |
854 |
--- |
855 |
gold/options.h | 2 +- |
856 |
ld/emultempl/elf32.em | 13 +++++++++++++ |
857 |
ld/testsuite/lib/ld-lib.exp | 4 ++-- |
858 |
3 files changed, 16 insertions(+), 3 deletions(-) |
859 |
|
860 |
diff --git a/gold/options.h b/gold/options.h |
861 |
index 5d820f29fa91..47269eff6789 100644 |
862 |
--- a/gold/options.h |
863 |
+++ b/gold/options.h |
864 |
@@ -852,7 +852,7 @@ class General_options |
865 |
N_("Min fraction of empty buckets in dynamic hash"), |
866 |
N_("FRACTION")); |
867 |
|
868 |
- DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv", |
869 |
+ DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "gnu", |
870 |
N_("Dynamic hash style"), N_("[sysv,gnu,both]"), |
871 |
{"sysv", "gnu", "both"}); |
872 |
|
873 |
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em |
874 |
index 533f227e659a..90aaa90721b8 100644 |
875 |
--- a/ld/emultempl/elf32.em |
876 |
+++ b/ld/emultempl/elf32.em |
877 |
@@ -100,6 +100,19 @@ static void |
878 |
gld${EMULATION_NAME}_before_parse (void) |
879 |
{ |
880 |
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); |
881 |
+EOF |
882 |
+# Enable gnu hash by default for Linux (non-mips) targets. |
883 |
+# This has been supported since glibc-2.5. |
884 |
+case ${target} in |
885 |
+ mips*) ;; |
886 |
+ *-*-linux-* | *-*-gnu*) |
887 |
+ fragment <<EOF |
888 |
+ link_info.emit_hash = FALSE; |
889 |
+ link_info.emit_gnu_hash = TRUE; |
890 |
+EOF |
891 |
+ ;; |
892 |
+esac |
893 |
+fragment <<EOF |
894 |
input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; |
895 |
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
896 |
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
897 |
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp |
898 |
index fab98909ad36..7486870354c0 100644 |
899 |
--- a/ld/testsuite/lib/ld-lib.exp |
900 |
+++ b/ld/testsuite/lib/ld-lib.exp |
901 |
@@ -143,7 +143,7 @@ proc default_ld_relocate { ld target objects } { |
902 |
global HOSTING_EMU |
903 |
|
904 |
remote_file host delete $target |
905 |
- return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"] |
906 |
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"] |
907 |
} |
908 |
|
909 |
# Check to see if ld is being invoked with a non-endian output format |
910 |
@@ -224,7 +224,7 @@ proc default_ld_link { ld target objects } { |
911 |
|
912 |
remote_file host delete $target |
913 |
|
914 |
- return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"] |
915 |
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv $flags -o $target $objs $libs"] |
916 |
} |
917 |
|
918 |
# Link a program using ld, without including any libraries. |
919 |
-- |
920 |
2.8.0.rc3.226.g39d4020 |
921 |
|
922 |
|
923 |
|
924 |
|
925 |
1.1 src/patchsets/binutils/2.26.1/00_all_0008-libiberty-install-PIC-version-of-libiberty.a.patch |
926 |
|
927 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0008-libiberty-install-PIC-version-of-libiberty.a.patch?rev=1.1&view=markup |
928 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/00_all_0008-libiberty-install-PIC-version-of-libiberty.a.patch?rev=1.1&content-type=text/plain |
929 |
|
930 |
Index: 00_all_0008-libiberty-install-PIC-version-of-libiberty.a.patch |
931 |
=================================================================== |
932 |
From 9c04d0a47dd0f591fb0ef621fc1dc3a221b860cc Mon Sep 17 00:00:00 2001 |
933 |
From: Mike Frysinger <vapier@g.o> |
934 |
Date: Fri, 7 Jan 2005 00:15:53 -0500 |
935 |
Subject: [PATCH] libiberty: install PIC version of libiberty.a |
936 |
|
937 |
This will install a PIC version of libiberty.a by overwriting the non-PIC |
938 |
version of libiberty.a while compiling. We do this because there is no |
939 |
shared version of libiberty for random apps to link against which means if |
940 |
someone wants to use this in a shared library or PIE, they're out of luck. |
941 |
It's arguable whether people should be able to use this in a shared lib, |
942 |
but usage in PIE should be fine. You could argue that this penalizes the |
943 |
non-PIE users, but the counter point is that people using this library in |
944 |
general are fairly low, and we'd rather have things work for all of them. |
945 |
--- |
946 |
libiberty/Makefile.in | 1 + |
947 |
1 file changed, 1 insertion(+) |
948 |
|
949 |
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in |
950 |
index 7d7e2f41efa4..35fcda56a79e 100644 |
951 |
--- a/libiberty/Makefile.in |
952 |
+++ b/libiberty/Makefile.in |
953 |
@@ -254,6 +254,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) |
954 |
$(AR) $(AR_FLAGS) $(TARGETLIB) \ |
955 |
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ |
956 |
$(RANLIB) $(TARGETLIB); \ |
957 |
+ cp $(TARGETLIB) ../ ; \ |
958 |
cd ..; \ |
959 |
else true; fi; \ |
960 |
if [ x"$(NOASANFLAG)" != x ]; then \ |
961 |
-- |
962 |
2.8.0.rc3.226.g39d4020 |
963 |
|
964 |
|
965 |
|
966 |
|
967 |
1.1 src/patchsets/binutils/2.26.1/README.history |
968 |
|
969 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/README.history?rev=1.1&view=markup |
970 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.26.1/README.history?rev=1.1&content-type=text/plain |
971 |
|
972 |
Index: README.history |
973 |
=================================================================== |
974 |
1.0 04 Jul 2016 |
975 |
+ 00_all_0001-Add-mips-and-s390-build-targets-for-gold.patch |
976 |
+ 00_all_0002-ld-Add-a-linker-configure-option-enable-relro.patch |
977 |
+ 00_all_0003-ld-tests-make-address-matches-more-flexible.patch |
978 |
+ 00_all_0004-ld-always-warn-about-textrels-in-files.patch |
979 |
+ 00_all_0005-gold-ld-add-support-for-poisoned-system-directories.patch |
980 |
+ 00_all_0006-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
981 |
+ 00_all_0007-gold-ld-enable-gnu-hash-by-default.patch |
982 |
+ 00_all_0008-libiberty-install-PIC-version-of-libiberty.a.patch |