summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils-2.21
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2011-01-19 11:24:41 -0800
committerSaul Wold <sgw@linux.intel.com>2011-01-21 01:36:15 -0800
commitce175a948e296c7c5fe6249723e799db47e97932 (patch)
tree67ea9b5fd5a0d3f4d5163df26e357a0cd2a63450 /meta/recipes-devtools/binutils/binutils-2.21
parentc15f20a124cdc4966014ff624a06ab5a325042cd (diff)
downloadpoky-ce175a948e296c7c5fe6249723e799db47e97932.tar.gz
binutils: forward-port the binutils-poison.patch
Update the binutils-poison.patch to apply cleanly on binutils 2.21 Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils-2.21')
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.21/binutils-poison.patch314
1 files changed, 153 insertions, 161 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.21/binutils-poison.patch b/meta/recipes-devtools/binutils/binutils-2.21/binutils-poison.patch
index c2f19276f8..1fe713af8f 100644
--- a/meta/recipes-devtools/binutils/binutils-2.21/binutils-poison.patch
+++ b/meta/recipes-devtools/binutils/binutils-2.21/binutils-poison.patch
@@ -1,57 +1,58 @@
1This patch is recived from Mark Hatle 1Patch originally created by Mark Hatle, forward-ported to
2binutils 2.21 by Scott Garman.
2 3
3purpose: warn for uses of system directories when cross linking 4purpose: warn for uses of system directories when cross linking
4 5
5Signed-Off-By: Mark Hatle <mark.hatle@windriver.com>
6
7Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 6Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
8 7
92008-07-02 Joseph Myers <joseph@codesourcery.com> 82008-07-02 Joseph Myers <joseph@codesourcery.com>
10 9
11 ld/ 10 ld/
12 * ld.h (args_type): Add error_poison_system_directories. 11 * ld.h (args_type): Add error_poison_system_directories.
13 * ld.texinfo (--error-poison-system-directories): Document. 12 * ld.texinfo (--error-poison-system-directories): Document.
14 * ldfile.c (ldfile_add_library_path): Check 13 * ldfile.c (ldfile_add_library_path): Check
15 command_line.error_poison_system_directories. 14 command_line.error_poison_system_directories.
16 * ldmain.c (main): Initialize 15 * ldmain.c (main): Initialize
17 command_line.error_poison_system_directories. 16 command_line.error_poison_system_directories.
18 * lexsup.c (enum option_values): Add 17 * lexsup.c (enum option_values): Add
19 OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. 18 OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
20 (ld_options): Add --error-poison-system-directories. 19 (ld_options): Add --error-poison-system-directories.
21 (parse_args): Handle new option. 20 (parse_args): Handle new option.
22 21
232007-06-13 Joseph Myers <joseph@codesourcery.com> 222007-06-13 Joseph Myers <joseph@codesourcery.com>
24 23
25 ld/ 24 ld/
26 * config.in: Regenerate. 25 * config.in: Regenerate.
27 * ld.h (args_type): Add poison_system_directories. 26 * ld.h (args_type): Add poison_system_directories.
28 * ld.texinfo (--no-poison-system-directories): Document. 27 * ld.texinfo (--no-poison-system-directories): Document.
29 * ldfile.c (ldfile_add_library_path): Check 28 * ldfile.c (ldfile_add_library_path): Check
30 command_line.poison_system_directories. 29 command_line.poison_system_directories.
31 * ldmain.c (main): Initialize 30 * ldmain.c (main): Initialize
32 command_line.poison_system_directories. 31 command_line.poison_system_directories.
33 * lexsup.c (enum option_values): Add 32 * lexsup.c (enum option_values): Add
34 OPTION_NO_POISON_SYSTEM_DIRECTORIES. 33 OPTION_NO_POISON_SYSTEM_DIRECTORIES.
35 (ld_options): Add --no-poison-system-directories. 34 (ld_options): Add --no-poison-system-directories.
36 (parse_args): Handle new option. 35 (parse_args): Handle new option.
37 36
382007-04-20 Joseph Myers <joseph@codesourcery.com> 372007-04-20 Joseph Myers <joseph@codesourcery.com>
39 38
40 Merge from Sourcery G++ binutils 2.17: 39 Merge from Sourcery G++ binutils 2.17:
40
41 2007-03-20 Joseph Myers <joseph@codesourcery.com>
42 Based on patch by Mark Hatle <mark.hatle@windriver.com>.
43 ld/
44 * configure.in (--enable-poison-system-directories): New option.
45 * configure, config.in: Regenerate.
46 * ldfile.c (ldfile_add_library_path): If
47 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
48 /usr/lib, /usr/local/lib or /usr/X11R6/lib.
41 49
42 2007-03-20 Joseph Myers <joseph@codesourcery.com> 50Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
43 Based on patch by Mark Hatle <mark.hatle@windriver.com>. 51Signed-off-by: Scott Garman <scott.a.garman@intel.com>
44 ld/
45 * configure.in (--enable-poison-system-directories): New option.
46 * configure, config.in: Regenerate.
47 * ldfile.c (ldfile_add_library_path): If
48 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
49 /usr/lib, /usr/local/lib or /usr/X11R6/lib.
50 52
51Index: binutils-2.20.1/ld/config.in 53diff -urN binutils-2.21.orig//ld/config.in binutils-2.21/ld/config.in
52=================================================================== 54--- binutils-2.21.orig//ld/config.in 2010-11-05 03:34:27.000000000 -0700
53--- binutils-2.20.1.orig/ld/config.in 55+++ binutils-2.21/ld/config.in 2011-01-19 10:48:15.147301022 -0800
54+++ binutils-2.20.1/ld/config.in
55@@ -4,6 +4,9 @@ 56@@ -4,6 +4,9 @@
56 language is requested. */ 57 language is requested. */
57 #undef ENABLE_NLS 58 #undef ENABLE_NLS
@@ -62,32 +63,96 @@ Index: binutils-2.20.1/ld/config.in
62 /* Additional extension a shared object might have. */ 63 /* Additional extension a shared object might have. */
63 #undef EXTRA_SHLIB_EXTENSION 64 #undef EXTRA_SHLIB_EXTENSION
64 65
65Index: binutils-2.20.1/ld/configure.in 66diff -urN binutils-2.21.orig//ld/configure binutils-2.21/ld/configure
66=================================================================== 67--- binutils-2.21.orig//ld/configure 2011-01-19 10:46:46.997571921 -0800
67--- binutils-2.20.1.orig/ld/configure.in 68+++ binutils-2.21/ld/configure 2011-01-19 11:03:50.577832729 -0800
68+++ binutils-2.20.1/ld/configure.in 69@@ -768,6 +768,7 @@
69@@ -69,6 +69,16 @@ AC_SUBST(use_sysroot) 70 enable_targets
71 enable_64_bit_bfd
72 with_sysroot
73+enable_poison_system_directories
74 enable_gold
75 enable_got
76 enable_werror
77@@ -1418,6 +1419,8 @@
78 (and sometimes confusing) to the casual installer
79 --enable-targets alternative target configurations
80 --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
81+ --enable-poison-system-directories
82+ warn for use of native system library directories
83 --enable-gold[=ARG] build gold [ARG={default,yes,no}]
84 --enable-got=<type> GOT handling scheme (target, single, negative,
85 multigot)
86@@ -4203,7 +4206,18 @@
87 fi
88
89
90+# Check whether --enable-poison-system-directories was given.
91+if test "${enable_poison_system_directories+set}" = set; then :
92+ enableval=$enable_poison_system_directories;
93+else
94+ enable_poison_system_directories=no
95+fi
96+
97+if test "x${enable_poison_system_directories}" = "xyes"; then
98
99+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
100+
101+fi
102
103 # Check whether --enable-got was given.
104 if test "${enable_got+set}" = set; then :
105diff -urN binutils-2.21.orig//ld/configure.in binutils-2.21/ld/configure.in
106--- binutils-2.21.orig//ld/configure.in 2010-11-23 05:50:32.000000000 -0800
107+++ binutils-2.21/ld/configure.in 2011-01-19 10:50:57.378398946 -0800
108@@ -69,6 +69,16 @@
70 AC_SUBST(TARGET_SYSTEM_ROOT) 109 AC_SUBST(TARGET_SYSTEM_ROOT)
71 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) 110 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
72 111
73+AC_ARG_ENABLE([poison-system-directories], 112+AC_ARG_ENABLE([poison-system-directories],
74+ AS_HELP_STRING([--enable-poison-system-directories], 113+ AS_HELP_STRING([--enable-poison-system-directories],
75+ [warn for use of native system library directories]),, 114+ [warn for use of native system library directories]),,
76+ [enable_poison_system_directories=no]) 115+ [enable_poison_system_directories=no])
77+if test "x${enable_poison_system_directories}" = "xyes"; then 116+if test "x${enable_poison_system_directories}" = "xyes"; then
78+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], 117+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
79+ [1], 118+ [1],
80+ [Define to warn for use of native system library directories]) 119+ [Define to warn for use of native system library directories])
81+fi 120+fi
82+ 121+
83 AC_ARG_ENABLE([got], 122 dnl Use --enable-gold to decide if this linker should be the default.
84 AS_HELP_STRING([--enable-got=<type>], 123 dnl "install_as_default" is set to false if gold is the default linker.
85 [GOT handling scheme (target, single, negative, multigot)]), 124 dnl "installed_linker" is the installed BFD linker name.
86Index: binutils-2.20.1/ld/ld.h 125diff -urN binutils-2.21.orig//ld/ldfile.c binutils-2.21/ld/ldfile.c
87=================================================================== 126--- binutils-2.21.orig//ld/ldfile.c 2011-01-19 10:46:47.157553281 -0800
88--- binutils-2.20.1.orig/ld/ld.h 127+++ binutils-2.21/ld/ldfile.c 2011-01-19 10:58:30.035468447 -0800
89+++ binutils-2.20.1/ld/ld.h 128@@ -124,6 +124,23 @@
90@@ -176,6 +176,14 @@ typedef struct { 129 {
130 new_dirs->name = xstrdup (name);
131 new_dirs->sysrooted = is_sysrooted_pathname (name, FALSE);
132+
133+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
134+ if (command_line.poison_system_directories
135+ && ((!strncmp (name, "/lib", 4))
136+ || (!strncmp (name, "/usr/lib", 8))
137+ || (!strncmp (name, "/usr/local/lib", 14))
138+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
139+ {
140+ if (command_line.error_poison_system_directories)
141+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
142+ "cross-compilation\n"), name);
143+ else
144+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
145+ "cross-compilation\n"), name);
146+ }
147+#endif
148+
149 }
150 }
151
152diff -urN binutils-2.21.orig//ld/ld.h binutils-2.21/ld/ld.h
153--- binutils-2.21.orig//ld/ld.h 2009-11-26 05:45:25.000000000 -0800
154+++ binutils-2.21/ld/ld.h 2011-01-19 10:52:54.814716478 -0800
155@@ -198,6 +198,14 @@
91 input files. */ 156 input files. */
92 bfd_boolean accept_unknown_input_arch; 157 bfd_boolean accept_unknown_input_arch;
93 158
@@ -102,11 +167,22 @@ Index: binutils-2.20.1/ld/ld.h
102 /* Big or little endian as set on command line. */ 167 /* Big or little endian as set on command line. */
103 enum endian_enum endian; 168 enum endian_enum endian;
104 169
105Index: binutils-2.20.1/ld/ld.texinfo 170diff -urN binutils-2.21.orig//ld/ldmain.c binutils-2.21/ld/ldmain.c
106=================================================================== 171--- binutils-2.21.orig//ld/ldmain.c 2010-11-05 00:20:07.000000000 -0700
107--- binutils-2.20.1.orig/ld/ld.texinfo 172+++ binutils-2.21/ld/ldmain.c 2011-01-19 10:59:18.579767697 -0800
108+++ binutils-2.20.1/ld/ld.texinfo 173@@ -259,6 +259,8 @@
109@@ -2084,6 +2084,18 @@ string identifying the original linked f 174 command_line.warn_search_mismatch = TRUE;
175 command_line.check_section_addresses = -1;
176 command_line.disable_target_specific_optimizations = -1;
177+ command_line.poison_system_directories = TRUE;
178+ command_line.error_poison_system_directories = FALSE;
179
180 /* We initialize DEMANGLING based on the environment variable
181 COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
182diff -urN binutils-2.21.orig//ld/ld.texinfo binutils-2.21/ld/ld.texinfo
183--- binutils-2.21.orig//ld/ld.texinfo 2010-10-28 04:40:26.000000000 -0700
184+++ binutils-2.21/ld/ld.texinfo 2011-01-19 10:56:04.452567113 -0800
185@@ -2133,6 +2133,18 @@
110 186
111 Passing @code{none} for @var{style} disables the setting from any 187 Passing @code{none} for @var{style} disables the setting from any
112 @code{--build-id} options earlier on the command line. 188 @code{--build-id} options earlier on the command line.
@@ -125,63 +201,19 @@ Index: binutils-2.20.1/ld/ld.texinfo
125 @end table 201 @end table
126 202
127 @c man end 203 @c man end
128Index: binutils-2.20.1/ld/ldfile.c 204diff -urN binutils-2.21.orig//ld/lexsup.c binutils-2.21/ld/lexsup.c
129=================================================================== 205--- binutils-2.21.orig//ld/lexsup.c 2010-10-27 23:45:33.000000000 -0700
130--- binutils-2.20.1.orig/ld/ldfile.c 206+++ binutils-2.21/ld/lexsup.c 2011-01-19 11:02:07.799898432 -0800
131+++ binutils-2.20.1/ld/ldfile.c 207@@ -175,6 +175,8 @@
132@@ -120,6 +120,23 @@ ldfile_add_library_path (const char *nam 208 OPTION_PLUGIN_OPT,
133 { 209 #endif /* ENABLE_PLUGINS */
134 new_dirs->name = xstrdup (name); 210 OPTION_DEFAULT_SCRIPT,
135 new_dirs->sysrooted = is_sysrooted_pathname (name, FALSE);
136+
137+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
138+ if (command_line.poison_system_directories
139+ && ((!strncmp (name, "/lib", 4))
140+ || (!strncmp (name, "/usr/lib", 8))
141+ || (!strncmp (name, "/usr/local/lib", 14))
142+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
143+ {
144+ if (command_line.error_poison_system_directories)
145+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
146+ "cross-compilation\n"), name);
147+ else
148+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
149+ "cross-compilation\n"), name);
150+ }
151+#endif
152+
153 }
154 }
155
156Index: binutils-2.20.1/ld/ldmain.c
157===================================================================
158--- binutils-2.20.1.orig/ld/ldmain.c
159+++ binutils-2.20.1/ld/ldmain.c
160@@ -252,6 +252,8 @@ main (int argc, char **argv)
161 command_line.warn_mismatch = TRUE;
162 command_line.warn_search_mismatch = TRUE;
163 command_line.check_section_addresses = -1;
164+ command_line.poison_system_directories = TRUE;
165+ command_line.error_poison_system_directories = FALSE;
166
167 /* We initialize DEMANGLING based on the environment variable
168 COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
169Index: binutils-2.20.1/ld/lexsup.c
170===================================================================
171--- binutils-2.20.1.orig/ld/lexsup.c
172+++ binutils-2.20.1/ld/lexsup.c
173@@ -166,7 +166,9 @@ enum option_values
174 OPTION_WARN_SHARED_TEXTREL,
175 OPTION_WARN_ALTERNATE_EM,
176 OPTION_REDUCE_MEMORY_OVERHEADS,
177- OPTION_DEFAULT_SCRIPT
178+ OPTION_DEFAULT_SCRIPT,
179+ OPTION_NO_POISON_SYSTEM_DIRECTORIES, 211+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
180+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES 212+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES
181 }; 213 };
182 214
183 /* The long options. This structure is used for both the option 215 /* The long options. This structure is used for both the option
184@@ -575,6 +577,14 @@ static const struct ld_option ld_options 216@@ -603,6 +605,14 @@
185 TWO_DASHES }, 217 TWO_DASHES },
186 { {"wrap", required_argument, NULL, OPTION_WRAP}, 218 { {"wrap", required_argument, NULL, OPTION_WRAP},
187 '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES }, 219 '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
@@ -196,58 +228,18 @@ Index: binutils-2.20.1/ld/lexsup.c
196 }; 228 };
197 229
198 #define OPTION_COUNT ARRAY_SIZE (ld_options) 230 #define OPTION_COUNT ARRAY_SIZE (ld_options)
199@@ -1480,6 +1490,14 @@ parse_args (unsigned argc, char **argv) 231@@ -1518,6 +1528,14 @@
200 einfo (_("%P%X: --hash-size needs a numeric argument\n")); 232 einfo (_("%P%X: --hash-size needs a numeric argument\n"));
201 } 233 }
202 break; 234 break;
203+ 235+
204+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES: 236+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
205+ command_line.poison_system_directories = FALSE; 237+ command_line.poison_system_directories = FALSE;
206+ break; 238+ break;
207+ 239+
208+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: 240+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
209+ command_line.error_poison_system_directories = TRUE; 241+ command_line.error_poison_system_directories = TRUE;
210+ break; 242+ break;
211 } 243 }
212 } 244 }
213 245
214diff -ur binutils-2.20.1.orig/ld/configure binutils-2.20.1/ld/configure
215--- binutils-2.20.1.orig/ld/configure 2010-03-03 08:06:22.000000000 -0600
216+++ binutils-2.20.1/ld/configure 2010-09-30 11:19:35.776990594 -0500
217@@ -901,6 +904,7 @@
218 enable_targets
219 enable_64_bit_bfd
220 with_sysroot
221+enable_poison_system_directories
222 enable_got
223 enable_werror
224 enable_build_warnings
225@@ -1548,6 +1552,8 @@
226 (and sometimes confusing) to the casual installer
227 --enable-targets alternative target configurations
228 --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
229+ --enable-poison-system-directories
230+ warn for use of native system library directories
231 --enable-got=<type> GOT handling scheme (target, single, negative,
232 multigot)
233 --enable-werror treat compile warnings as errors
234@@ -4302,6 +4334,19 @@
235
236
237
238+# Check whether --enable-poison-system-directories was given.
239+if test "${enable_poison_system_directories+set}" = set; then :
240+ enableval=$enable_poison_system_directories;
241+else
242+ enable_poison_system_directories=no
243+fi
244+
245+if test "x${enable_poison_system_directories}" = "xyes"; then
246+
247+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
248+
249+fi
250+
251 # Check whether --enable-got was given.
252 if test "${enable_got+set}" = set; then :
253 enableval=$enable_got; case "${enableval}" in