1 |
tamiko 17/08/02 16:45:33 |
2 |
|
3 |
Added: |
4 |
00_all_0001-ld-always-warn-about-textrels-in-files.patch |
5 |
00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch |
6 |
00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
7 |
00_all_0004-gold-ld-enable-gnu-hash-by-default.patch |
8 |
00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch |
9 |
00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch |
10 |
README.history |
11 |
Log: |
12 |
2.29 patchset 1.0 |
13 |
|
14 |
Revision Changes Path |
15 |
1.1 src/patchsets/binutils/2.29/00_all_0001-ld-always-warn-about-textrels-in-files.patch |
16 |
|
17 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0001-ld-always-warn-about-textrels-in-files.patch?rev=1.1&view=markup |
18 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0001-ld-always-warn-about-textrels-in-files.patch?rev=1.1&content-type=text/plain |
19 |
|
20 |
Index: 00_all_0001-ld-always-warn-about-textrels-in-files.patch |
21 |
=================================================================== |
22 |
From bb101959912073f460669d75097215cde7b20019 Mon Sep 17 00:00:00 2001 |
23 |
From: Mike Frysinger <vapier@g.o> |
24 |
Date: Mon, 16 May 2005 22:10:19 -0400 |
25 |
Subject: [PATCH] ld: always warn about textrels in files |
26 |
|
27 |
textrels are bad for forcing copy-on-write (this affects everyone), and for |
28 |
security/runtime code generation, this affects security ppl. But in either |
29 |
case, it doesn't matter who needs textrels, it's the very fact that they're |
30 |
needed at all. |
31 |
--- |
32 |
ld/ldmain.c | 1 + |
33 |
ld/testsuite/lib/ld-lib.exp | 4 ++++ |
34 |
2 files changed, 5 insertions(+) |
35 |
|
36 |
diff --git a/ld/ldmain.c b/ld/ldmain.c |
37 |
index 1e48b1a2dbbc..f634eaa908a5 100644 |
38 |
--- a/ld/ldmain.c |
39 |
+++ b/ld/ldmain.c |
40 |
@@ -294,6 +294,7 @@ main (int argc, char **argv) |
41 |
link_info.dynamic_undefined_weak = -1; |
42 |
link_info.pei386_auto_import = -1; |
43 |
link_info.spare_dynamic_tags = 5; |
44 |
+ link_info.warn_shared_textrel = TRUE; |
45 |
link_info.path_separator = ':'; |
46 |
#ifdef DEFAULT_FLAG_COMPRESS_DEBUG |
47 |
link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; |
48 |
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp |
49 |
index cf7886b4866f..6c6a0b7a001e 100644 |
50 |
--- a/ld/testsuite/lib/ld-lib.exp |
51 |
+++ b/ld/testsuite/lib/ld-lib.exp |
52 |
@@ -250,6 +250,10 @@ proc default_ld_simple_link { ld target objects } { |
53 |
# symbol, since the default linker script might use ENTRY. |
54 |
regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output |
55 |
|
56 |
+ # Gentoo tweak: |
57 |
+ # We want to ignore TEXTREL warnings since we force enable them by default |
58 |
+ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output |
59 |
+ |
60 |
return [string match "" $exec_output] |
61 |
} |
62 |
|
63 |
-- |
64 |
2.11.1 |
65 |
|
66 |
|
67 |
|
68 |
|
69 |
1.1 src/patchsets/binutils/2.29/00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch |
70 |
|
71 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch?rev=1.1&view=markup |
72 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch?rev=1.1&content-type=text/plain |
73 |
|
74 |
Index: 00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch |
75 |
=================================================================== |
76 |
From 9c3fda8166172bb9fa818bf2b7fec003847393d8 Mon Sep 17 00:00:00 2001 |
77 |
From: Mike Frysinger <vapier@g.o> |
78 |
Date: Mon, 25 May 2015 04:42:58 -0400 |
79 |
Subject: [PATCH] gold/ld: add support for poisoned system directories |
80 |
|
81 |
This is based on the old CodeSourcery patch written by Joseph Myers to add |
82 |
support to the link for detecting & rejecting bad -L paths when using a |
83 |
cross-compiler. The differences here: |
84 |
* The command line flags are always available. |
85 |
* We can turn on & off the warning via the command line. |
86 |
* The configure option controls the default warning behavior. |
87 |
* Add support for gold. |
88 |
|
89 |
It is not currently upstream, nor has it been submitted at all. There are |
90 |
no plans to do so currently either. |
91 |
|
92 |
BUG=chromium:488360 |
93 |
TEST=`cbuildbot chromiumos-sdk` passes # tests arm/amd64/mipsel/x86 |
94 |
TEST=`cbuildbot panther_moblab-full whirlwind-release` pass |
95 |
TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures |
96 |
TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd) |
97 |
|
98 |
Reviewed-on: https://chromium-review.googlesource.com/272083 |
99 |
--- |
100 |
gold/options.cc | 33 +++++++++++++++++++++++++++++++++ |
101 |
gold/options.h | 7 +++++++ |
102 |
ld/config.in | 3 +++ |
103 |
ld/configure | 14 ++++++++++++++ |
104 |
ld/configure.ac | 10 ++++++++++ |
105 |
ld/ld.h | 7 +++++++ |
106 |
ld/ld.texinfo | 18 ++++++++++++++++++ |
107 |
ld/ldfile.c | 20 ++++++++++++++++++++ |
108 |
ld/ldlex.h | 3 +++ |
109 |
ld/ldmain.c | 7 +++++++ |
110 |
ld/lexsup.c | 24 ++++++++++++++++++++++++ |
111 |
11 files changed, 146 insertions(+) |
112 |
|
113 |
diff --git a/gold/options.cc b/gold/options.cc |
114 |
index ed63b6f04feb..5de289b5dd2e 100644 |
115 |
--- a/gold/options.cc |
116 |
+++ b/gold/options.cc |
117 |
@@ -1285,6 +1285,39 @@ General_options::finalize() |
118 |
// in the path, as appropriate. |
119 |
this->add_sysroot(); |
120 |
|
121 |
+ // Now check if library_path is poisoned. |
122 |
+ if (this->warn_poison_system_directories()) |
123 |
+ { |
124 |
+ std::vector<std::string> bad_paths; |
125 |
+ |
126 |
+ bad_paths.push_back("/lib"); |
127 |
+ // TODO: This check is disabled for now due to a bunch of packages that |
128 |
+ // use libtool and relink with -L/usr/lib paths (albeit after the right |
129 |
+ // sysroot path). Once those are fixed we can enable. |
130 |
+ // We also need to adjust it so it only rejects one or two levels deep. |
131 |
+ // Gcc's internal paths also live below /usr/lib. |
132 |
+ // http://crbug.com/488360 |
133 |
+ // bad_paths.push_back("/usr/lib"); |
134 |
+ bad_paths.push_back("/usr/local/lib"); |
135 |
+ bad_paths.push_back("/usr/X11R6/lib"); |
136 |
+ |
137 |
+ for (std::vector<std::string>::const_iterator b = bad_paths.begin(); |
138 |
+ b != bad_paths.end(); |
139 |
+ ++b) |
140 |
+ for (Dir_list::iterator p = this->library_path_.value.begin(); |
141 |
+ p != this->library_path_.value.end(); |
142 |
+ ++p) |
143 |
+ if (!p->name().compare(0, b->size(), *b)) |
144 |
+ { |
145 |
+ if (this->error_poison_system_directories()) |
146 |
+ gold_fatal(_("library search path \"%s\" is unsafe for " |
147 |
+ "cross-compilation"), p->name().c_str()); |
148 |
+ else |
149 |
+ gold_warning(_("library search path \"%s\" is unsafe for " |
150 |
+ "cross-compilation"), p->name().c_str()); |
151 |
+ } |
152 |
+ } |
153 |
+ |
154 |
// Now that we've normalized the options, check for contradictory ones. |
155 |
if (this->shared() && this->is_static()) |
156 |
gold_fatal(_("-shared and -static are incompatible")); |
157 |
diff --git a/gold/options.h b/gold/options.h |
158 |
index a8b1d46aa109..b7c725a82539 100644 |
159 |
--- a/gold/options.h |
160 |
+++ b/gold/options.h |
161 |
@@ -1344,6 +1344,13 @@ class General_options |
162 |
DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false, |
163 |
N_("Ignored"), NULL); |
164 |
|
165 |
+ DEFINE_bool(warn_poison_system_directories, options::TWO_DASHES, '\0', false, |
166 |
+ N_("Warn for -L options using system directories"), |
167 |
+ N_("Do not warn for -L options using system directories")); |
168 |
+ DEFINE_bool(error_poison_system_directories, options::TWO_DASHES, '\0', false, |
169 |
+ N_("Give an error for -L options using system directories"), |
170 |
+ NULL); |
171 |
+ |
172 |
DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true, |
173 |
N_("Warn when skipping an incompatible library"), |
174 |
N_("Don't warn when skipping an incompatible library")); |
175 |
diff --git a/ld/config.in b/ld/config.in |
176 |
index 2c6d698b6ce1..d3cb7e882de9 100644 |
177 |
--- a/ld/config.in |
178 |
+++ b/ld/config.in |
179 |
@@ -17,6 +17,9 @@ |
180 |
language is requested. */ |
181 |
#undef ENABLE_NLS |
182 |
|
183 |
+/* Define to warn for use of native system library directories */ |
184 |
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES |
185 |
+ |
186 |
/* Additional extension a shared object might have. */ |
187 |
#undef EXTRA_SHLIB_EXTENSION |
188 |
|
189 |
diff --git a/ld/configure b/ld/configure |
190 |
index 36af9695b1c8..bd1d677e0920 100755 |
191 |
--- a/ld/configure |
192 |
+++ b/ld/configure |
193 |
@@ -789,6 +789,7 @@ with_lib_path |
194 |
enable_targets |
195 |
enable_64_bit_bfd |
196 |
with_sysroot |
197 |
+enable_poison_system_directories |
198 |
enable_gold |
199 |
enable_got |
200 |
enable_compressed_debug_sections |
201 |
@@ -1446,6 +1447,8 @@ Optional Features: |
202 |
--disable-largefile omit support for large files |
203 |
--enable-targets alternative target configurations |
204 |
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) |
205 |
+ --enable-poison-system-directories |
206 |
+ warn for use of native system library directories |
207 |
--enable-gold[=ARG] build gold [ARG={default,yes,no}] |
208 |
--enable-got=<type> GOT handling scheme (target, single, negative, |
209 |
multigot) |
210 |
@@ -15499,7 +15502,18 @@ else |
211 |
fi |
212 |
|
213 |
|
214 |
+# Check whether --enable-poison-system-directories was given. |
215 |
+if test "${enable_poison_system_directories+set}" = set; then : |
216 |
+ enableval=$enable_poison_system_directories; |
217 |
+else |
218 |
+ enable_poison_system_directories=no |
219 |
+fi |
220 |
+ |
221 |
+if test "x${enable_poison_system_directories}" = "xyes"; then |
222 |
|
223 |
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h |
224 |
+ |
225 |
+fi |
226 |
|
227 |
# Check whether --enable-got was given. |
228 |
if test "${enable_got+set}" = set; then : |
229 |
diff --git a/ld/configure.ac b/ld/configure.ac |
230 |
index 36a9f5083aea..47f1d33fa58c 100644 |
231 |
--- a/ld/configure.ac |
232 |
+++ b/ld/configure.ac |
233 |
@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot) |
234 |
AC_SUBST(TARGET_SYSTEM_ROOT) |
235 |
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) |
236 |
|
237 |
+AC_ARG_ENABLE([poison-system-directories], |
238 |
+ AS_HELP_STRING([--enable-poison-system-directories], |
239 |
+ [warn for use of native system library directories]),, |
240 |
+ [enable_poison_system_directories=no]) |
241 |
+if test "x${enable_poison_system_directories}" = "xyes"; then |
242 |
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], |
243 |
+ [1], |
244 |
+ [Define to warn for use of native system library directories]) |
245 |
+fi |
246 |
+ |
247 |
dnl Use --enable-gold to decide if this linker should be the default. |
248 |
dnl "install_as_default" is set to false if gold is the default linker. |
249 |
dnl "installed_linker" is the installed BFD linker name. |
250 |
diff --git a/ld/ld.h b/ld/ld.h |
251 |
index 104bb8e2376b..e1c3f744862d 100644 |
252 |
--- a/ld/ld.h |
253 |
+++ b/ld/ld.h |
254 |
@@ -172,6 +172,13 @@ typedef struct |
255 |
/* If set, display the target memory usage (per memory region). */ |
256 |
bfd_boolean print_memory_usage; |
257 |
|
258 |
+ /* If TRUE warn for uses of system directories when cross linking. */ |
259 |
+ bfd_boolean warn_poison_system_directories; |
260 |
+ |
261 |
+ /* If TRUE (default FALSE) give an error for uses of system |
262 |
+ directories when cross linking instead of a warning. */ |
263 |
+ bfd_boolean error_poison_system_directories; |
264 |
+ |
265 |
/* Big or little endian as set on command line. */ |
266 |
enum endian_enum endian; |
267 |
|
268 |
diff --git a/ld/ld.texinfo b/ld/ld.texinfo |
269 |
index d393acdd9406..8eb156efb8dd 100644 |
270 |
--- a/ld/ld.texinfo |
271 |
+++ b/ld/ld.texinfo |
272 |
@@ -2403,6 +2403,24 @@ string identifying the original linked file does not change. |
273 |
|
274 |
Passing @code{none} for @var{style} disables the setting from any |
275 |
@code{--build-id} options earlier on the command line. |
276 |
+ |
277 |
+@kindex --warn-poison-system-directories |
278 |
+@item --warn-poison-system-directories |
279 |
+Warn for @option{-L} options using system directories such as |
280 |
+@file{/usr/lib} when cross linking. This option is intended for use |
281 |
+in environments that want to detect and reject incorrect link settings. |
282 |
+ |
283 |
+@kindex --no-warn-poison-system-directories |
284 |
+@item --no-warn-poison-system-directories |
285 |
+Do not warn for @option{-L} options using system directories such as |
286 |
+@file{/usr/lib} when cross linking. This option is intended for use |
287 |
+in chroot environments when such directories contain the correct |
288 |
+libraries for the target system rather than the host. |
289 |
+ |
290 |
+@kindex --error-poison-system-directories |
291 |
+@item --error-poison-system-directories |
292 |
+Give an error instead of a warning for @option{-L} options using |
293 |
+system directories when cross linking. |
294 |
@end table |
295 |
|
296 |
@c man end |
297 |
diff --git a/ld/ldfile.c b/ld/ldfile.c |
298 |
index 0943bb2dfa0f..b3bc22469900 100644 |
299 |
--- a/ld/ldfile.c |
300 |
+++ b/ld/ldfile.c |
301 |
@@ -114,6 +114,26 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline) |
302 |
new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); |
303 |
else |
304 |
new_dirs->name = xstrdup (name); |
305 |
+ |
306 |
+ if (command_line.warn_poison_system_directories |
307 |
+ && (!strncmp (name, "/lib", 4) |
308 |
+ /* TODO: This check is disabled for now due to a bunch of packages that |
309 |
+ * use libtool and relink with -L/usr/lib paths (albeit after the right |
310 |
+ * sysroot path). Once those are fixed we can enable. |
311 |
+ * We also need to adjust it so it only rejects one or two levels deep. |
312 |
+ * Gcc's internal paths also live below /usr/lib. |
313 |
+ * http://crbug.com/488360 */ |
314 |
+ /* || !strncmp (name, "/usr/lib", 8) */ |
315 |
+ || !strncmp (name, "/usr/local/lib", 14) |
316 |
+ || !strncmp (name, "/usr/X11R6/lib", 14))) |
317 |
+ { |
318 |
+ if (command_line.error_poison_system_directories) |
319 |
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for " |
320 |
+ "cross-compilation\n"), name); |
321 |
+ else |
322 |
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for " |
323 |
+ "cross-compilation\n"), name); |
324 |
+ } |
325 |
} |
326 |
|
327 |
/* Try to open a BFD for a lang_input_statement. */ |
328 |
diff --git a/ld/ldlex.h b/ld/ldlex.h |
329 |
index 3ecac2bc865e..7ed67bae3f23 100644 |
330 |
--- a/ld/ldlex.h |
331 |
+++ b/ld/ldlex.h |
332 |
@@ -141,6 +141,9 @@ enum option_values |
333 |
OPTION_PRINT_OUTPUT_FORMAT, |
334 |
OPTION_PRINT_SYSROOT, |
335 |
OPTION_IGNORE_UNRESOLVED_SYMBOL, |
336 |
+ OPTION_WARN_POISON_SYSTEM_DIRECTORIES, |
337 |
+ OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES, |
338 |
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, |
339 |
OPTION_PUSH_STATE, |
340 |
OPTION_POP_STATE, |
341 |
OPTION_PRINT_MEMORY_USAGE, |
342 |
diff --git a/ld/ldmain.c b/ld/ldmain.c |
343 |
index f634eaa908a5..bba193355b0d 100644 |
344 |
--- a/ld/ldmain.c |
345 |
+++ b/ld/ldmain.c |
346 |
@@ -270,6 +270,13 @@ main (int argc, char **argv) |
347 |
command_line.warn_mismatch = TRUE; |
348 |
command_line.warn_search_mismatch = TRUE; |
349 |
command_line.check_section_addresses = -1; |
350 |
+ command_line.warn_poison_system_directories = |
351 |
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES |
352 |
+ TRUE; |
353 |
+#else |
354 |
+ FALSE; |
355 |
+#endif |
356 |
+ command_line.error_poison_system_directories = FALSE; |
357 |
|
358 |
/* We initialize DEMANGLING based on the environment variable |
359 |
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the |
360 |
diff --git a/ld/lexsup.c b/ld/lexsup.c |
361 |
index 0b7d4976ac90..327b203eeb25 100644 |
362 |
--- a/ld/lexsup.c |
363 |
+++ b/ld/lexsup.c |
364 |
@@ -524,6 +524,18 @@ static const struct ld_option ld_options[] = |
365 |
OPTION_IGNORE_UNRESOLVED_SYMBOL}, |
366 |
'\0', N_("SYMBOL"), |
367 |
N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES }, |
368 |
+ { {"warn-poison-system-directories", no_argument, NULL, |
369 |
+ OPTION_WARN_POISON_SYSTEM_DIRECTORIES}, |
370 |
+ '\0', NULL, N_("Warn for -L options using system directories"), |
371 |
+ TWO_DASHES }, |
372 |
+ { {"no-warn-poison-system-directories", no_argument, NULL, |
373 |
+ OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES}, |
374 |
+ '\0', NULL, N_("Do not warn for -L options using system directories"), |
375 |
+ TWO_DASHES }, |
376 |
+ { {"error-poison-system-directories", no_argument, NULL, |
377 |
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, |
378 |
+ '\0', NULL, N_("Give an error for -L options using system directories"), |
379 |
+ TWO_DASHES }, |
380 |
{ {"push-state", no_argument, NULL, OPTION_PUSH_STATE}, |
381 |
'\0', NULL, N_("Push state of flags governing input file handling"), |
382 |
TWO_DASHES }, |
383 |
@@ -1528,6 +1540,18 @@ parse_args (unsigned argc, char **argv) |
384 |
} |
385 |
break; |
386 |
|
387 |
+ case OPTION_WARN_POISON_SYSTEM_DIRECTORIES: |
388 |
+ command_line.warn_poison_system_directories = TRUE; |
389 |
+ break; |
390 |
+ |
391 |
+ case OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES: |
392 |
+ command_line.warn_poison_system_directories = FALSE; |
393 |
+ break; |
394 |
+ |
395 |
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: |
396 |
+ command_line.error_poison_system_directories = TRUE; |
397 |
+ break; |
398 |
+ |
399 |
case OPTION_PUSH_STATE: |
400 |
input_flags.pushed = xmemdup (&input_flags, |
401 |
sizeof (input_flags), |
402 |
-- |
403 |
2.11.1 |
404 |
|
405 |
|
406 |
|
407 |
|
408 |
1.1 src/patchsets/binutils/2.29/00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
409 |
|
410 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch?rev=1.1&view=markup |
411 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch?rev=1.1&content-type=text/plain |
412 |
|
413 |
Index: 00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
414 |
=================================================================== |
415 |
From da0140fb5c8a9bccd0c66166c8e21cb3e37e2f1d Mon Sep 17 00:00:00 2001 |
416 |
From: Mike Frysinger <vapier@g.o> |
417 |
Date: Fri, 7 Jan 2005 00:15:53 -0500 |
418 |
Subject: [PATCH] ld: enable new dtags by default for linux/gnu targets |
419 |
|
420 |
The "new" dtags options have been around for 14+ years now, so for Linux |
421 |
and GNU targets, enable them by default. |
422 |
|
423 |
2012-01-21 Mike Frysinger <vapier@g.o> |
424 |
|
425 |
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set |
426 |
link_info.new_dtags to TRUE for linux/gnu targets. |
427 |
* NEWS: Mention new dtags default. |
428 |
|
429 |
2013-01-22 Roland McGrath <mcgrathr@××××××.com> |
430 |
|
431 |
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set |
432 |
new_dtags to TRUE for *-*-nacl* targets. |
433 |
--- |
434 |
ld/emultempl/elf32.em | 10 ++++++++++ |
435 |
1 file changed, 10 insertions(+) |
436 |
|
437 |
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em |
438 |
index 84adaef6dfe1..92b7e4aabd0b 100644 |
439 |
--- a/ld/emultempl/elf32.em |
440 |
+++ b/ld/emultempl/elf32.em |
441 |
@@ -103,6 +103,16 @@ gld${EMULATION_NAME}_before_parse (void) |
442 |
input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; |
443 |
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
444 |
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
445 |
+EOF |
446 |
+ |
447 |
+case ${target} in |
448 |
+ *-*-linux-* | *-*-k*bsd*-* | *-*-gnu* | *-*-nacl*) |
449 |
+ fragment <<EOF |
450 |
+ link_info.new_dtags = TRUE; |
451 |
+EOF |
452 |
+ ;; |
453 |
+esac |
454 |
+fragment <<EOF |
455 |
`if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`; |
456 |
link_info.check_relocs_after_open_input = `if test "x${CHECK_RELOCS_AFTER_OPEN_INPUT}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
457 |
link_info.relro = DEFAULT_LD_Z_RELRO; |
458 |
-- |
459 |
2.11.1 |
460 |
|
461 |
|
462 |
|
463 |
|
464 |
1.1 src/patchsets/binutils/2.29/00_all_0004-gold-ld-enable-gnu-hash-by-default.patch |
465 |
|
466 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0004-gold-ld-enable-gnu-hash-by-default.patch?rev=1.1&view=markup |
467 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0004-gold-ld-enable-gnu-hash-by-default.patch?rev=1.1&content-type=text/plain |
468 |
|
469 |
Index: 00_all_0004-gold-ld-enable-gnu-hash-by-default.patch |
470 |
=================================================================== |
471 |
From a6c35c40daf508b4f236b870c2b60bfa9b68de9e Mon Sep 17 00:00:00 2001 |
472 |
From: Mike Frysinger <vapier@g.o> |
473 |
Date: Sat, 27 Jan 2007 15:01:08 -0500 |
474 |
Subject: [PATCH] gold/ld: enable gnu hash by default |
475 |
|
476 |
Glibc first added .gnu.hash support to glibc-2.5 (released 29 Sep 2006), |
477 |
and gold was first released after that. Let's default the gnu hash style |
478 |
to the new "gnu" rather than the classic sysv. |
479 |
|
480 |
gold/: |
481 |
2012-02-03 Mike Frysinger <vapier@g.o> |
482 |
|
483 |
* options.h (General_options): Change default to gnu for hash_style. |
484 |
--- |
485 |
gold/options.h | 2 +- |
486 |
ld/emultempl/elf32.em | 13 +++++++++++++ |
487 |
ld/testsuite/lib/ld-lib.exp | 4 ++-- |
488 |
3 files changed, 16 insertions(+), 3 deletions(-) |
489 |
|
490 |
diff --git a/gold/options.h b/gold/options.h |
491 |
index 294c5e6..0b610e3 100644 |
492 |
--- a/gold/options.h |
493 |
+++ b/gold/options.h |
494 |
@@ -925,7 +925,7 @@ class General_options |
495 |
N_("Min fraction of empty buckets in dynamic hash"), |
496 |
N_("FRACTION")); |
497 |
|
498 |
- DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv", |
499 |
+ DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "gnu", |
500 |
N_("Dynamic hash style"), N_("[sysv,gnu,both]"), |
501 |
{"sysv", "gnu", "both"}); |
502 |
|
503 |
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em |
504 |
index 1b8e4ea..5424468 100644 |
505 |
--- a/ld/emultempl/elf32.em |
506 |
+++ b/ld/emultempl/elf32.em |
507 |
@@ -100,6 +100,19 @@ static void |
508 |
gld${EMULATION_NAME}_before_parse (void) |
509 |
{ |
510 |
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); |
511 |
+EOF |
512 |
+# Enable gnu hash by default for Linux (non-mips) targets. |
513 |
+# This has been supported since glibc-2.5. |
514 |
+case ${target} in |
515 |
+ mips*) ;; |
516 |
+ *-*-linux-* | *-*-gnu*) |
517 |
+ fragment <<EOF |
518 |
+ link_info.emit_hash = FALSE; |
519 |
+ link_info.emit_gnu_hash = TRUE; |
520 |
+EOF |
521 |
+ ;; |
522 |
+esac |
523 |
+fragment <<EOF |
524 |
input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; |
525 |
config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
526 |
config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
527 |
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp |
528 |
index bb7bbb8..8d535eb 100644 |
529 |
--- a/ld/testsuite/lib/ld-lib.exp |
530 |
+++ b/ld/testsuite/lib/ld-lib.exp |
531 |
@@ -147,7 +147,7 @@ proc default_ld_relocate { ld target objects } { |
532 |
global HOSTING_EMU |
533 |
|
534 |
remote_file host delete $target |
535 |
- return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"] |
536 |
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv $flags -o $target $objs $libs"] |
537 |
} |
538 |
|
539 |
# Check to see if ld is being invoked with a non-endian output format |
540 |
|
541 |
|
542 |
|
543 |
1.1 src/patchsets/binutils/2.29/00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch |
544 |
|
545 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch?rev=1.1&view=markup |
546 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch?rev=1.1&content-type=text/plain |
547 |
|
548 |
Index: 00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch |
549 |
=================================================================== |
550 |
From bb4bd6b89365800a7b403ce505401d0c02ad02f8 Mon Sep 17 00:00:00 2001 |
551 |
From: Mike Frysinger <vapier@g.o> |
552 |
Date: Fri, 7 Jan 2005 00:15:53 -0500 |
553 |
Subject: [PATCH] libiberty: install PIC version of libiberty.a |
554 |
|
555 |
This will install a PIC version of libiberty.a by overwriting the non-PIC |
556 |
version of libiberty.a while compiling. We do this because there is no |
557 |
shared version of libiberty for random apps to link against which means if |
558 |
someone wants to use this in a shared library or PIE, they're out of luck. |
559 |
It's arguable whether people should be able to use this in a shared lib, |
560 |
but usage in PIE should be fine. You could argue that this penalizes the |
561 |
non-PIE users, but the counter point is that people using this library in |
562 |
general are fairly low, and we'd rather have things work for all of them. |
563 |
--- |
564 |
libiberty/Makefile.in | 1 + |
565 |
1 file changed, 1 insertion(+) |
566 |
|
567 |
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in |
568 |
index 0ff9e45e45ef..55a70330ffb8 100644 |
569 |
--- a/libiberty/Makefile.in |
570 |
+++ b/libiberty/Makefile.in |
571 |
@@ -256,6 +256,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) |
572 |
$(AR) $(AR_FLAGS) $(TARGETLIB) \ |
573 |
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ |
574 |
$(RANLIB) $(TARGETLIB); \ |
575 |
+ cp $(TARGETLIB) ../ ; \ |
576 |
cd ..; \ |
577 |
else true; fi; \ |
578 |
if [ x"$(NOASANFLAG)" != x ]; then \ |
579 |
-- |
580 |
2.11.1 |
581 |
|
582 |
|
583 |
|
584 |
|
585 |
1.1 src/patchsets/binutils/2.29/00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch |
586 |
|
587 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch?rev=1.1&view=markup |
588 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch?rev=1.1&content-type=text/plain |
589 |
|
590 |
Index: 00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch |
591 |
=================================================================== |
592 |
From 561d984aa3a3b99bbd9c6ddf6ba08dadd107d62c Mon Sep 17 00:00:00 2001 |
593 |
From: Mike Frysinger <vapier@g.o> |
594 |
Date: Tue, 5 Jul 2016 20:24:00 +0545 |
595 |
Subject: [PATCH] opcodes: link against libbfd.la for rpath deps |
596 |
|
597 |
The reason opcodes doesn't link against libbfd.la is to workaround a |
598 |
libtool bug where it uses installed -L paths ahead of DESTDIR paths. |
599 |
The downside is that the library itself lacks rpath tags to find the |
600 |
right version of libbfd.so. |
601 |
|
602 |
Since Gentoo has patched the libtool bug for a while, we don't need |
603 |
the workaround. Use the .la file so we get the rpath tags. |
604 |
|
605 |
URL: https://bugs.gentoo.org/563934 |
606 |
--- |
607 |
opcodes/configure | 2 +- |
608 |
opcodes/configure.ac | 2 +- |
609 |
2 files changed, 2 insertions(+), 2 deletions(-) |
610 |
|
611 |
diff --git a/opcodes/configure b/opcodes/configure |
612 |
index be87eb22a5f0..19528bef6906 100755 |
613 |
--- a/opcodes/configure |
614 |
+++ b/opcodes/configure |
615 |
@@ -12561,7 +12561,7 @@ if test "$enable_shared" = "yes"; then |
616 |
SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}" |
617 |
;; |
618 |
*) |
619 |
- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}" |
620 |
+ SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}" |
621 |
;; |
622 |
esac |
623 |
SHARED_DEPENDENCIES="../bfd/libbfd.la" |
624 |
diff --git a/opcodes/configure.ac b/opcodes/configure.ac |
625 |
index b9f5eb8a4fdf..b5ff57a341ea 100644 |
626 |
--- a/opcodes/configure.ac |
627 |
+++ b/opcodes/configure.ac |
628 |
@@ -185,7 +185,7 @@ changequote([,])dnl |
629 |
SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}" |
630 |
;; |
631 |
*) |
632 |
- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}" |
633 |
+ SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}" |
634 |
;; |
635 |
esac |
636 |
SHARED_DEPENDENCIES="../bfd/libbfd.la" |
637 |
-- |
638 |
2.11.1 |
639 |
|
640 |
|
641 |
|
642 |
|
643 |
1.1 src/patchsets/binutils/2.29/README.history |
644 |
|
645 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/README.history?rev=1.1&view=markup |
646 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/binutils/2.29/README.history?rev=1.1&content-type=text/plain |
647 |
|
648 |
Index: README.history |
649 |
=================================================================== |
650 |
1.0 02 Aug 2017 |
651 |
+ 00_all_0001-ld-always-warn-about-textrels-in-files.patch |
652 |
+ 00_all_0002-gold-ld-add-support-for-poisoned-system-directories.patch |
653 |
+ 00_all_0003-ld-enable-new-dtags-by-default-for-linux-gnu-targets.patch |
654 |
+ 00_all_0004-gold-ld-enable-gnu-hash-by-default.patch |
655 |
+ 00_all_0005-libiberty-install-PIC-version-of-libiberty.a.patch |
656 |
+ 00_all_0006-opcodes-link-against-libbfd.la-for-rpath-deps.patch |