diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-02-10 10:37:19 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-16 09:46:28 +0000 |
commit | 6957ff06a0ab978f73221766541c9541b9f7d1dd (patch) | |
tree | 08194d403a20d2b0ae4d6a23f59e088b97eac65c /meta/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch | |
parent | 1239b8e3e28516dd97df4f51d6c2f6d71eda1d46 (diff) | |
download | poky-6957ff06a0ab978f73221766541c9541b9f7d1dd.tar.gz |
binutils: Upgrade to 2.38 release
Release Notes are here [1]
[1] https://lists.gnu.org/archive/html/info-gnu/2022-02/msg00009.html
(From OE-Core rev: 77a1038828e638518dceda969da0817aa13eb5d3)
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/0008-warn-for-uses-of-system-directories-when-cross-linki.patch')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch | 270 |
1 files changed, 0 insertions, 270 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch b/meta/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch deleted file mode 100644 index c724dfd7a7..0000000000 --- a/meta/recipes-devtools/binutils/binutils/0008-warn-for-uses-of-system-directories-when-cross-linki.patch +++ /dev/null | |||
@@ -1,270 +0,0 @@ | |||
1 | From 99e1565b9d2b929d4ee4e9da6f63766b22b23fc3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 15 Jan 2016 06:31:09 +0000 | ||
4 | Subject: [PATCH] warn for uses of system directories when cross linking | ||
5 | |||
6 | 2008-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 | |||
20 | 2007-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 | |||
35 | 2007-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 | |||
48 | Upstream-Status: Pending | ||
49 | |||
50 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
51 | Signed-off-by: Scott Garman <scott.a.garman@intel.com> | ||
52 | Signed-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 | |||
65 | --- a/ld/config.in | ||
66 | +++ b/ld/config.in | ||
67 | @@ -43,6 +43,9 @@ | ||
68 | language is requested. */ | ||
69 | #undef ENABLE_NLS | ||
70 | |||
71 | +/* Define to warn for use of native system library directories */ | ||
72 | +#undef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
73 | + | ||
74 | /* Additional extension a shared object might have. */ | ||
75 | #undef EXTRA_SHLIB_EXTENSION | ||
76 | |||
77 | --- a/ld/configure | ||
78 | +++ b/ld/configure | ||
79 | @@ -829,6 +829,7 @@ with_lib_path | ||
80 | enable_targets | ||
81 | enable_64_bit_bfd | ||
82 | with_sysroot | ||
83 | +enable_poison_system_directories | ||
84 | enable_gold | ||
85 | enable_got | ||
86 | enable_compressed_debug_sections | ||
87 | @@ -1498,6 +1499,8 @@ Optional Features: | ||
88 | --enable-checking enable run-time checks | ||
89 | --enable-targets alternative target configurations | ||
90 | --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) | ||
91 | + --enable-poison-system-directories | ||
92 | + warn for use of native system library directories | ||
93 | --enable-gold[=ARG] build gold [ARG={default,yes,no}] | ||
94 | --enable-got=<type> GOT handling scheme (target, single, negative, | ||
95 | multigot) | ||
96 | @@ -15215,6 +15218,19 @@ fi | ||
97 | |||
98 | |||
99 | |||
100 | +# Check whether --enable-poison-system-directories was given. | ||
101 | +if test "${enable_poison_system_directories+set}" = set; then : | ||
102 | + enableval=$enable_poison_system_directories; | ||
103 | +else | ||
104 | + enable_poison_system_directories=no | ||
105 | +fi | ||
106 | + | ||
107 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
108 | + | ||
109 | +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h | ||
110 | + | ||
111 | +fi | ||
112 | + | ||
113 | # Check whether --enable-gold was given. | ||
114 | if test "${enable_gold+set}" = set; then : | ||
115 | enableval=$enable_gold; case "${enableval}" in | ||
116 | --- a/ld/configure.ac | ||
117 | +++ b/ld/configure.ac | ||
118 | @@ -106,6 +106,16 @@ AC_SUBST(use_sysroot) | ||
119 | AC_SUBST(TARGET_SYSTEM_ROOT) | ||
120 | AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) | ||
121 | |||
122 | +AC_ARG_ENABLE([poison-system-directories], | ||
123 | + AS_HELP_STRING([--enable-poison-system-directories], | ||
124 | + [warn for use of native system library directories]),, | ||
125 | + [enable_poison_system_directories=no]) | ||
126 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
127 | + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], | ||
128 | + [1], | ||
129 | + [Define to warn for use of native system library directories]) | ||
130 | +fi | ||
131 | + | ||
132 | dnl Use --enable-gold to decide if this linker should be the default. | ||
133 | dnl "install_as_default" is set to false if gold is the default linker. | ||
134 | dnl "installed_linker" is the installed BFD linker name. | ||
135 | --- a/ld/ld.h | ||
136 | +++ b/ld/ld.h | ||
137 | @@ -162,6 +162,14 @@ typedef struct | ||
138 | in the linker script. */ | ||
139 | bool force_group_allocation; | ||
140 | |||
141 | + /* If TRUE (the default) warn for uses of system directories when | ||
142 | + cross linking. */ | ||
143 | + bool poison_system_directories; | ||
144 | + | ||
145 | + /* If TRUE (default FALSE) give an error for uses of system | ||
146 | + directories when cross linking instead of a warning. */ | ||
147 | + bool error_poison_system_directories; | ||
148 | + | ||
149 | /* Big or little endian as set on command line. */ | ||
150 | enum endian_enum endian; | ||
151 | |||
152 | --- a/ld/ld.texi | ||
153 | +++ b/ld/ld.texi | ||
154 | @@ -2863,6 +2863,18 @@ string identifying the original linked f | ||
155 | |||
156 | Passing @code{none} for @var{style} disables the setting from any | ||
157 | @code{--build-id} options earlier on the command line. | ||
158 | + | ||
159 | +@kindex --no-poison-system-directories | ||
160 | +@item --no-poison-system-directories | ||
161 | +Do not warn for @option{-L} options using system directories such as | ||
162 | +@file{/usr/lib} when cross linking. This option is intended for use | ||
163 | +in chroot environments when such directories contain the correct | ||
164 | +libraries for the target system rather than the host. | ||
165 | + | ||
166 | +@kindex --error-poison-system-directories | ||
167 | +@item --error-poison-system-directories | ||
168 | +Give an error instead of a warning for @option{-L} options using | ||
169 | +system directories when cross linking. | ||
170 | @end table | ||
171 | |||
172 | @c man end | ||
173 | --- a/ld/ldfile.c | ||
174 | +++ b/ld/ldfile.c | ||
175 | @@ -117,6 +117,23 @@ ldfile_add_library_path (const char *nam | ||
176 | new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL); | ||
177 | else | ||
178 | new_dirs->name = xstrdup (name); | ||
179 | + | ||
180 | +#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
181 | + if (command_line.poison_system_directories | ||
182 | + && ((!strncmp (name, "/lib", 4)) | ||
183 | + || (!strncmp (name, "/usr/lib", 8)) | ||
184 | + || (!strncmp (name, "/usr/local/lib", 14)) | ||
185 | + || (!strncmp (name, "/usr/X11R6/lib", 14)))) | ||
186 | + { | ||
187 | + if (command_line.error_poison_system_directories) | ||
188 | + einfo (_("%X%P: error: library search path \"%s\" is unsafe for " | ||
189 | + "cross-compilation\n"), name); | ||
190 | + else | ||
191 | + einfo (_("%P: warning: library search path \"%s\" is unsafe for " | ||
192 | + "cross-compilation\n"), name); | ||
193 | + } | ||
194 | +#endif | ||
195 | + | ||
196 | } | ||
197 | |||
198 | /* Try to open a BFD for a lang_input_statement. */ | ||
199 | --- a/ld/ldlex.h | ||
200 | +++ b/ld/ldlex.h | ||
201 | @@ -163,6 +163,8 @@ enum option_values | ||
202 | OPTION_CTF_VARIABLES, | ||
203 | OPTION_NO_CTF_VARIABLES, | ||
204 | OPTION_CTF_SHARE_TYPES, | ||
205 | + OPTION_NO_POISON_SYSTEM_DIRECTORIES, | ||
206 | + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES, | ||
207 | }; | ||
208 | |||
209 | /* The initial parser states. */ | ||
210 | --- a/ld/ldmain.c | ||
211 | +++ b/ld/ldmain.c | ||
212 | @@ -321,6 +321,8 @@ main (int argc, char **argv) | ||
213 | command_line.warn_mismatch = true; | ||
214 | command_line.warn_search_mismatch = true; | ||
215 | command_line.check_section_addresses = -1; | ||
216 | + command_line.poison_system_directories = true; | ||
217 | + command_line.error_poison_system_directories = false; | ||
218 | |||
219 | /* We initialize DEMANGLING based on the environment variable | ||
220 | COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the | ||
221 | @@ -1444,7 +1446,7 @@ undefined_symbol (struct bfd_link_info * | ||
222 | argv[1] = "undefined-symbol"; | ||
223 | argv[2] = (char *) name; | ||
224 | argv[3] = NULL; | ||
225 | - | ||
226 | + | ||
227 | if (verbose) | ||
228 | einfo (_("%P: About to run error handling script '%s' with arguments: '%s' '%s'\n"), | ||
229 | argv[0], argv[1], argv[2]); | ||
230 | @@ -1465,7 +1467,7 @@ undefined_symbol (struct bfd_link_info * | ||
231 | carry on to issue the normal error message. */ | ||
232 | } | ||
233 | #endif /* SUPPORT_ERROR_HANDLING_SCRIPT */ | ||
234 | - | ||
235 | + | ||
236 | if (section != NULL) | ||
237 | { | ||
238 | if (error_count < MAX_ERRORS_IN_A_ROW) | ||
239 | --- a/ld/lexsup.c | ||
240 | +++ b/ld/lexsup.c | ||
241 | @@ -595,6 +595,14 @@ static const struct ld_option ld_options | ||
242 | " <method> is: share-unconflicted (default),\n" | ||
243 | " share-duplicated"), | ||
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 | @@ -1686,6 +1694,14 @@ parse_args (unsigned argc, char **argv) | ||
257 | config.print_map_discarded = true; | ||
258 | break; | ||
259 | |||
260 | + case OPTION_NO_POISON_SYSTEM_DIRECTORIES: | ||
261 | + command_line.poison_system_directories = false; | ||
262 | + break; | ||
263 | + | ||
264 | + case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: | ||
265 | + command_line.error_poison_system_directories = true; | ||
266 | + break; | ||
267 | + | ||
268 | case OPTION_DEPENDENCY_FILE: | ||
269 | config.dependency_file = optarg; | ||
270 | break; | ||