summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-02-04 13:18:08 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-05 13:53:48 +0000
commitdb9bca2b3b126ad915decc1c803e136a3cdb5d66 (patch)
tree3fab2b7ec10ee8397268827ed03a9396715188ed /meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch
parent3c6764b09888e2025536b8bc73ce548cf53a1579 (diff)
downloadpoky-db9bca2b3b126ad915decc1c803e136a3cdb5d66.tar.gz
binutils: Upgrade to binutils 2.32
Changes https://sourceware.org/ml/binutils/2019-02/msg00010.html 0007-Add-the-armv5e-architecture-to-binutils.patch is dropped since we armv5 is not a used option anymore in OE armv5te is default, and gcc9 will drop it completely anyway CVE patches were backports from master which is already past of 2.32 release Other dropped patches were partial or full backports as well (From OE-Core rev: b71294c4decf35d544a2c8adb4e67d141841fc68) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch273
1 files changed, 0 insertions, 273 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch b/meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch
deleted file mode 100644
index 9a9e319621..0000000000
--- a/meta/recipes-devtools/binutils/binutils/0009-warn-for-uses-of-system-directories-when-cross-linki.patch
+++ /dev/null
@@ -1,273 +0,0 @@
1From a3667059fc0d52d890b505bed0e5050ea3d7002e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 15 Jan 2016 06:31:09 +0000
4Subject: [PATCH 09/15] warn for uses of system directories when cross linking
5
62008-07-02 Joseph Myers <joseph@codesourcery.com>
7
8 ld/
9 * ld.h (args_type): Add error_poison_system_directories.
10 * ld.texinfo (--error-poison-system-directories): Document.
11 * ldfile.c (ldfile_add_library_path): Check
12 command_line.error_poison_system_directories.
13 * ldmain.c (main): Initialize
14 command_line.error_poison_system_directories.
15 * lexsup.c (enum option_values): Add
16 OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
17 (ld_options): Add --error-poison-system-directories.
18 (parse_args): Handle new option.
19
202007-06-13 Joseph Myers <joseph@codesourcery.com>
21
22 ld/
23 * config.in: Regenerate.
24 * ld.h (args_type): Add poison_system_directories.
25 * ld.texinfo (--no-poison-system-directories): Document.
26 * ldfile.c (ldfile_add_library_path): Check
27 command_line.poison_system_directories.
28 * ldmain.c (main): Initialize
29 command_line.poison_system_directories.
30 * lexsup.c (enum option_values): Add
31 OPTION_NO_POISON_SYSTEM_DIRECTORIES.
32 (ld_options): Add --no-poison-system-directories.
33 (parse_args): Handle new option.
34
352007-04-20 Joseph Myers <joseph@codesourcery.com>
36
37 Merge from Sourcery G++ binutils 2.17:
38
39 2007-03-20 Joseph Myers <joseph@codesourcery.com>
40 Based on patch by Mark Hatle <mark.hatle@windriver.com>.
41 ld/
42 * configure.in (--enable-poison-system-directories): New option.
43 * configure, config.in: Regenerate.
44 * ldfile.c (ldfile_add_library_path): If
45 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
46 /usr/lib, /usr/local/lib or /usr/X11R6/lib.
47
48Upstream-Status: Pending
49
50Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
51Signed-off-by: Scott Garman <scott.a.garman@intel.com>
52Signed-off-by: Khem Raj <raj.khem@gmail.com>
53---
54 ld/config.in | 3 +++
55 ld/configure | 16 ++++++++++++++++
56 ld/configure.ac | 10 ++++++++++
57 ld/ld.h | 8 ++++++++
58 ld/ld.texi | 12 ++++++++++++
59 ld/ldfile.c | 17 +++++++++++++++++
60 ld/ldlex.h | 2 ++
61 ld/ldmain.c | 2 ++
62 ld/lexsup.c | 16 ++++++++++++++++
63 9 files changed, 86 insertions(+)
64
65diff --git a/ld/config.in b/ld/config.in
66index d93c9b0830..5da2742bea 100644
67--- a/ld/config.in
68+++ b/ld/config.in
69@@ -31,6 +31,9 @@
70 language is requested. */
71 #undef ENABLE_NLS
72
73+/* Define to warn for use of native system library directories */
74+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
75+
76 /* Additional extension a shared object might have. */
77 #undef EXTRA_SHLIB_EXTENSION
78
79diff --git a/ld/configure b/ld/configure
80index 2b291f0da8..facc386563 100755
81--- a/ld/configure
82+++ b/ld/configure
83@@ -826,6 +826,7 @@ with_lib_path
84 enable_targets
85 enable_64_bit_bfd
86 with_sysroot
87+enable_poison_system_directories
88 enable_gold
89 enable_got
90 enable_compressed_debug_sections
91@@ -1490,6 +1491,8 @@ Optional Features:
92 --disable-largefile omit support for large files
93 --enable-targets alternative target configurations
94 --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
95+ --enable-poison-system-directories
96+ warn for use of native system library directories
97 --enable-gold[=ARG] build gold [ARG={default,yes,no}]
98 --enable-got=<type> GOT handling scheme (target, single, negative,
99 multigot)
100@@ -16618,6 +16621,19 @@ fi
101
102
103
104+# Check whether --enable-poison-system-directories was given.
105+if test "${enable_poison_system_directories+set}" = set; then :
106+ enableval=$enable_poison_system_directories;
107+else
108+ enable_poison_system_directories=no
109+fi
110+
111+if test "x${enable_poison_system_directories}" = "xyes"; then
112+
113+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
114+
115+fi
116+
117 # Check whether --enable-gold was given.
118 if test "${enable_gold+set}" = set; then :
119 enableval=$enable_gold; case "${enableval}" in
120diff --git a/ld/configure.ac b/ld/configure.ac
121index d10c553650..9f1b57b120 100644
122--- a/ld/configure.ac
123+++ b/ld/configure.ac
124@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot)
125 AC_SUBST(TARGET_SYSTEM_ROOT)
126 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
127
128+AC_ARG_ENABLE([poison-system-directories],
129+ AS_HELP_STRING([--enable-poison-system-directories],
130+ [warn for use of native system library directories]),,
131+ [enable_poison_system_directories=no])
132+if test "x${enable_poison_system_directories}" = "xyes"; then
133+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
134+ [1],
135+ [Define to warn for use of native system library directories])
136+fi
137+
138 dnl Use --enable-gold to decide if this linker should be the default.
139 dnl "install_as_default" is set to false if gold is the default linker.
140 dnl "installed_linker" is the installed BFD linker name.
141diff --git a/ld/ld.h b/ld/ld.h
142index ba914b921e..9df17dab6c 100644
143--- a/ld/ld.h
144+++ b/ld/ld.h
145@@ -180,6 +180,14 @@ typedef struct
146 in the linker script. */
147 bfd_boolean force_group_allocation;
148
149+ /* If TRUE (the default) warn for uses of system directories when
150+ cross linking. */
151+ bfd_boolean poison_system_directories;
152+
153+ /* If TRUE (default FALSE) give an error for uses of system
154+ directories when cross linking instead of a warning. */
155+ bfd_boolean error_poison_system_directories;
156+
157 /* Big or little endian as set on command line. */
158 enum endian_enum endian;
159
160diff --git a/ld/ld.texi b/ld/ld.texi
161index b9fe2324da..43486605e0 100644
162--- a/ld/ld.texi
163+++ b/ld/ld.texi
164@@ -2479,6 +2479,18 @@ string identifying the original linked file does not change.
165
166 Passing @code{none} for @var{style} disables the setting from any
167 @code{--build-id} options earlier on the command line.
168+
169+@kindex --no-poison-system-directories
170+@item --no-poison-system-directories
171+Do not warn for @option{-L} options using system directories such as
172+@file{/usr/lib} when cross linking. This option is intended for use
173+in chroot environments when such directories contain the correct
174+libraries for the target system rather than the host.
175+
176+@kindex --error-poison-system-directories
177+@item --error-poison-system-directories
178+Give an error instead of a warning for @option{-L} options using
179+system directories when cross linking.
180 @end table
181
182 @c man end
183diff --git a/ld/ldfile.c b/ld/ldfile.c
184index a72ff13526..dc5148f748 100644
185--- a/ld/ldfile.c
186+++ b/ld/ldfile.c
187@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
188 new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
189 else
190 new_dirs->name = xstrdup (name);
191+
192+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
193+ if (command_line.poison_system_directories
194+ && ((!strncmp (name, "/lib", 4))
195+ || (!strncmp (name, "/usr/lib", 8))
196+ || (!strncmp (name, "/usr/local/lib", 14))
197+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
198+ {
199+ if (command_line.error_poison_system_directories)
200+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
201+ "cross-compilation\n"), name);
202+ else
203+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
204+ "cross-compilation\n"), name);
205+ }
206+#endif
207+
208 }
209
210 /* Try to open a BFD for a lang_input_statement. */
211diff --git a/ld/ldlex.h b/ld/ldlex.h
212index 04d6fd5f96..d7df005bb2 100644
213--- a/ld/ldlex.h
214+++ b/ld/ldlex.h
215@@ -148,6 +148,8 @@ enum option_values
216 OPTION_REQUIRE_DEFINED_SYMBOL,
217 OPTION_ORPHAN_HANDLING,
218 OPTION_FORCE_GROUP_ALLOCATION,
219+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
220+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
221 };
222
223 /* The initial parser states. */
224diff --git a/ld/ldmain.c b/ld/ldmain.c
225index f31eeb29c3..25f8497888 100644
226--- a/ld/ldmain.c
227+++ b/ld/ldmain.c
228@@ -268,6 +268,8 @@ main (int argc, char **argv)
229 command_line.warn_mismatch = TRUE;
230 command_line.warn_search_mismatch = TRUE;
231 command_line.check_section_addresses = -1;
232+ command_line.poison_system_directories = TRUE;
233+ command_line.error_poison_system_directories = FALSE;
234
235 /* We initialize DEMANGLING based on the environment variable
236 COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
237diff --git a/ld/lexsup.c b/ld/lexsup.c
238index 86a033a383..4a40d48020 100644
239--- a/ld/lexsup.c
240+++ b/ld/lexsup.c
241@@ -543,6 +543,14 @@ static const struct ld_option ld_options[] =
242 { {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING},
243 '\0', N_("=MODE"), N_("Control how orphan sections are handled."),
244 TWO_DASHES },
245+ { {"no-poison-system-directories", no_argument, NULL,
246+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
247+ '\0', NULL, N_("Do not warn for -L options using system directories"),
248+ TWO_DASHES },
249+ { {"error-poison-system-directories", no_argument, NULL,
250+ + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
251+ '\0', NULL, N_("Give an error for -L options using system directories"),
252+ TWO_DASHES },
253 };
254
255 #define OPTION_COUNT ARRAY_SIZE (ld_options)
256@@ -1577,6 +1585,14 @@ parse_args (unsigned argc, char **argv)
257 einfo (_("%F%P: invalid argument to option"
258 " \"--orphan-handling\"\n"));
259 break;
260+
261+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
262+ command_line.poison_system_directories = FALSE;
263+ break;
264+
265+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
266+ command_line.error_poison_system_directories = TRUE;
267+ break;
268 }
269 }
270
271--
2722.18.0
273