diff options
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils-2.23.2/binutils-poison.patch')
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.23.2/binutils-poison.patch | 259 |
1 files changed, 259 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.2/binutils-poison.patch b/meta/recipes-devtools/binutils/binutils-2.23.2/binutils-poison.patch new file mode 100644 index 0000000000..39cae5155d --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.2/binutils-poison.patch | |||
| @@ -0,0 +1,259 @@ | |||
| 1 | Upstream-Status: Inappropriate [distribution: codesourcery] | ||
| 2 | |||
| 3 | Patch originally created by Mark Hatle, forward-ported to | ||
| 4 | binutils 2.21 by Scott Garman. | ||
| 5 | |||
| 6 | purpose: warn for uses of system directories when cross linking | ||
| 7 | |||
| 8 | Code Merged from Sourcery G++ binutils 2.19 - 4.4-277 | ||
| 9 | |||
| 10 | 2008-07-02 Joseph Myers <joseph@codesourcery.com> | ||
| 11 | |||
| 12 | ld/ | ||
| 13 | * ld.h (args_type): Add error_poison_system_directories. | ||
| 14 | * ld.texinfo (--error-poison-system-directories): Document. | ||
| 15 | * ldfile.c (ldfile_add_library_path): Check | ||
| 16 | command_line.error_poison_system_directories. | ||
| 17 | * ldmain.c (main): Initialize | ||
| 18 | command_line.error_poison_system_directories. | ||
| 19 | * lexsup.c (enum option_values): Add | ||
| 20 | OPTION_ERROR_POISON_SYSTEM_DIRECTORIES. | ||
| 21 | (ld_options): Add --error-poison-system-directories. | ||
| 22 | (parse_args): Handle new option. | ||
| 23 | |||
| 24 | 2007-06-13 Joseph Myers <joseph@codesourcery.com> | ||
| 25 | |||
| 26 | ld/ | ||
| 27 | * config.in: Regenerate. | ||
| 28 | * ld.h (args_type): Add poison_system_directories. | ||
| 29 | * ld.texinfo (--no-poison-system-directories): Document. | ||
| 30 | * ldfile.c (ldfile_add_library_path): Check | ||
| 31 | command_line.poison_system_directories. | ||
| 32 | * ldmain.c (main): Initialize | ||
| 33 | command_line.poison_system_directories. | ||
| 34 | * lexsup.c (enum option_values): Add | ||
| 35 | OPTION_NO_POISON_SYSTEM_DIRECTORIES. | ||
| 36 | (ld_options): Add --no-poison-system-directories. | ||
| 37 | (parse_args): Handle new option. | ||
| 38 | |||
| 39 | 2007-04-20 Joseph Myers <joseph@codesourcery.com> | ||
| 40 | |||
| 41 | Merge from Sourcery G++ binutils 2.17: | ||
| 42 | |||
| 43 | 2007-03-20 Joseph Myers <joseph@codesourcery.com> | ||
| 44 | Based on patch by Mark Hatle <mark.hatle@windriver.com>. | ||
| 45 | ld/ | ||
| 46 | * configure.in (--enable-poison-system-directories): New option. | ||
| 47 | * configure, config.in: Regenerate. | ||
| 48 | * ldfile.c (ldfile_add_library_path): If | ||
| 49 | ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib, | ||
| 50 | /usr/lib, /usr/local/lib or /usr/X11R6/lib. | ||
| 51 | |||
| 52 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
| 53 | Signed-off-by: Scott Garman <scott.a.garman@intel.com> | ||
| 54 | |||
| 55 | Index: binutils-2.22.90/ld/config.in | ||
| 56 | =================================================================== | ||
| 57 | --- binutils-2.22.90.orig/ld/config.in 2012-05-17 08:13:21.000000000 -0700 | ||
| 58 | +++ binutils-2.22.90/ld/config.in 2012-08-07 23:09:34.834490113 -0700 | ||
| 59 | @@ -11,6 +11,9 @@ | ||
| 60 | language is requested. */ | ||
| 61 | #undef ENABLE_NLS | ||
| 62 | |||
| 63 | +/* Define to warn for use of native system library directories */ | ||
| 64 | +#undef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
| 65 | + | ||
| 66 | /* Additional extension a shared object might have. */ | ||
| 67 | #undef EXTRA_SHLIB_EXTENSION | ||
| 68 | |||
| 69 | Index: binutils-2.22.90/ld/configure | ||
| 70 | =================================================================== | ||
| 71 | --- binutils-2.22.90.orig/ld/configure 2012-08-07 23:08:50.000000000 -0700 | ||
| 72 | +++ binutils-2.22.90/ld/configure 2012-08-07 23:09:34.838490177 -0700 | ||
| 73 | @@ -776,6 +776,7 @@ | ||
| 74 | enable_targets | ||
| 75 | enable_64_bit_bfd | ||
| 76 | with_sysroot | ||
| 77 | +enable_poison_system_directories | ||
| 78 | enable_gold | ||
| 79 | enable_got | ||
| 80 | enable_werror | ||
| 81 | @@ -1432,6 +1433,8 @@ | ||
| 82 | (and sometimes confusing) to the casual installer | ||
| 83 | --enable-targets alternative target configurations | ||
| 84 | --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) | ||
| 85 | + --enable-poison-system-directories | ||
| 86 | + warn for use of native system library directories | ||
| 87 | --enable-gold[=ARG] build gold [ARG={default,yes,no}] | ||
| 88 | --enable-got=<type> GOT handling scheme (target, single, negative, | ||
| 89 | multigot) | ||
| 90 | @@ -4344,7 +4347,18 @@ | ||
| 91 | fi | ||
| 92 | |||
| 93 | |||
| 94 | +# Check whether --enable-poison-system-directories was given. | ||
| 95 | +if test "${enable_poison_system_directories+set}" = set; then : | ||
| 96 | + enableval=$enable_poison_system_directories; | ||
| 97 | +else | ||
| 98 | + enable_poison_system_directories=no | ||
| 99 | +fi | ||
| 100 | + | ||
| 101 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
| 102 | |||
| 103 | +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h | ||
| 104 | + | ||
| 105 | +fi | ||
| 106 | |||
| 107 | # Check whether --enable-got was given. | ||
| 108 | if test "${enable_got+set}" = set; then : | ||
| 109 | Index: binutils-2.22.90/ld/configure.in | ||
| 110 | =================================================================== | ||
| 111 | --- binutils-2.22.90.orig/ld/configure.in 2012-05-17 08:13:23.000000000 -0700 | ||
| 112 | +++ binutils-2.22.90/ld/configure.in 2012-08-07 23:09:34.838490177 -0700 | ||
| 113 | @@ -70,6 +70,16 @@ | ||
| 114 | AC_SUBST(TARGET_SYSTEM_ROOT) | ||
| 115 | AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) | ||
| 116 | |||
| 117 | +AC_ARG_ENABLE([poison-system-directories], | ||
| 118 | + AS_HELP_STRING([--enable-poison-system-directories], | ||
| 119 | + [warn for use of native system library directories]),, | ||
| 120 | + [enable_poison_system_directories=no]) | ||
| 121 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
| 122 | + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], | ||
| 123 | + [1], | ||
| 124 | + [Define to warn for use of native system library directories]) | ||
| 125 | +fi | ||
| 126 | + | ||
| 127 | dnl Use --enable-gold to decide if this linker should be the default. | ||
| 128 | dnl "install_as_default" is set to false if gold is the default linker. | ||
| 129 | dnl "installed_linker" is the installed BFD linker name. | ||
| 130 | Index: binutils-2.22.90/ld/ldfile.c | ||
| 131 | =================================================================== | ||
| 132 | --- binutils-2.22.90.orig/ld/ldfile.c 2012-07-13 06:20:26.000000000 -0700 | ||
| 133 | +++ binutils-2.22.90/ld/ldfile.c 2012-08-07 23:30:35.166538044 -0700 | ||
| 134 | @@ -116,6 +116,23 @@ | ||
| 135 | new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); | ||
| 136 | else | ||
| 137 | new_dirs->name = xstrdup (name); | ||
| 138 | + | ||
| 139 | +#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
| 140 | + if (command_line.poison_system_directories | ||
| 141 | + && ((!strncmp (name, "/lib", 4)) | ||
| 142 | + || (!strncmp (name, "/usr/lib", 8)) | ||
| 143 | + || (!strncmp (name, "/usr/local/lib", 14)) | ||
| 144 | + || (!strncmp (name, "/usr/X11R6/lib", 14)))) | ||
| 145 | + { | ||
| 146 | + if (command_line.error_poison_system_directories) | ||
| 147 | + einfo (_("%X%P: error: library search path \"%s\" is unsafe for " | ||
| 148 | + "cross-compilation\n"), name); | ||
| 149 | + else | ||
| 150 | + einfo (_("%P: warning: library search path \"%s\" is unsafe for " | ||
| 151 | + "cross-compilation\n"), name); | ||
| 152 | + } | ||
| 153 | +#endif | ||
| 154 | + | ||
| 155 | } | ||
| 156 | |||
| 157 | /* Try to open a BFD for a lang_input_statement. */ | ||
| 158 | Index: binutils-2.22.90/ld/ld.h | ||
| 159 | =================================================================== | ||
| 160 | --- binutils-2.22.90.orig/ld/ld.h 2012-07-09 23:50:55.000000000 -0700 | ||
| 161 | +++ binutils-2.22.90/ld/ld.h 2012-08-07 23:09:34.838490177 -0700 | ||
| 162 | @@ -203,6 +203,14 @@ | ||
| 163 | /* If TRUE we'll just print the default output on stdout. */ | ||
| 164 | bfd_boolean print_output_format; | ||
| 165 | |||
| 166 | + /* If TRUE (the default) warn for uses of system directories when | ||
| 167 | + cross linking. */ | ||
| 168 | + bfd_boolean poison_system_directories; | ||
| 169 | + | ||
| 170 | + /* If TRUE (default FALSE) give an error for uses of system | ||
| 171 | + directories when cross linking instead of a warning. */ | ||
| 172 | + bfd_boolean error_poison_system_directories; | ||
| 173 | + | ||
| 174 | /* Big or little endian as set on command line. */ | ||
| 175 | enum endian_enum endian; | ||
| 176 | |||
| 177 | Index: binutils-2.22.90/ld/ldmain.c | ||
| 178 | =================================================================== | ||
| 179 | --- binutils-2.22.90.orig/ld/ldmain.c 2012-07-13 06:20:26.000000000 -0700 | ||
| 180 | +++ binutils-2.22.90/ld/ldmain.c 2012-08-07 23:09:34.846490172 -0700 | ||
| 181 | @@ -265,6 +265,8 @@ | ||
| 182 | command_line.warn_search_mismatch = TRUE; | ||
| 183 | command_line.check_section_addresses = -1; | ||
| 184 | command_line.disable_target_specific_optimizations = -1; | ||
| 185 | + command_line.poison_system_directories = TRUE; | ||
| 186 | + command_line.error_poison_system_directories = FALSE; | ||
| 187 | |||
| 188 | /* We initialize DEMANGLING based on the environment variable | ||
| 189 | COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the | ||
| 190 | Index: binutils-2.22.90/ld/ld.texinfo | ||
| 191 | =================================================================== | ||
| 192 | --- binutils-2.22.90.orig/ld/ld.texinfo 2012-07-09 23:50:55.000000000 -0700 | ||
| 193 | +++ binutils-2.22.90/ld/ld.texinfo 2012-08-07 23:09:34.850490143 -0700 | ||
| 194 | @@ -2147,6 +2147,18 @@ | ||
| 195 | |||
| 196 | Passing @code{none} for @var{style} disables the setting from any | ||
| 197 | @code{--build-id} options earlier on the command line. | ||
| 198 | + | ||
| 199 | +@kindex --no-poison-system-directories | ||
| 200 | +@item --no-poison-system-directories | ||
| 201 | +Do not warn for @option{-L} options using system directories such as | ||
| 202 | +@file{/usr/lib} when cross linking. This option is intended for use | ||
| 203 | +in chroot environments when such directories contain the correct | ||
| 204 | +libraries for the target system rather than the host. | ||
| 205 | + | ||
| 206 | +@kindex --error-poison-system-directories | ||
| 207 | +@item --error-poison-system-directories | ||
| 208 | +Give an error instead of a warning for @option{-L} options using | ||
| 209 | +system directories when cross linking. | ||
| 210 | @end table | ||
| 211 | |||
| 212 | @c man end | ||
| 213 | Index: binutils-2.22.90/ld/lexsup.c | ||
| 214 | =================================================================== | ||
| 215 | --- binutils-2.22.90.orig/ld/lexsup.c 2012-07-13 06:20:26.000000000 -0700 | ||
| 216 | +++ binutils-2.22.90/ld/lexsup.c 2012-08-07 23:09:34.850490143 -0700 | ||
| 217 | @@ -496,6 +496,14 @@ | ||
| 218 | TWO_DASHES }, | ||
| 219 | { {"wrap", required_argument, NULL, OPTION_WRAP}, | ||
| 220 | '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES }, | ||
| 221 | + { {"no-poison-system-directories", no_argument, NULL, | ||
| 222 | + OPTION_NO_POISON_SYSTEM_DIRECTORIES}, | ||
| 223 | + '\0', NULL, N_("Do not warn for -L options using system directories"), | ||
| 224 | + TWO_DASHES }, | ||
| 225 | + { {"error-poison-system-directories", no_argument, NULL, | ||
| 226 | + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES}, | ||
| 227 | + '\0', NULL, N_("Give an error for -L options using system directories"), | ||
| 228 | + TWO_DASHES }, | ||
| 229 | }; | ||
| 230 | |||
| 231 | #define OPTION_COUNT ARRAY_SIZE (ld_options) | ||
| 232 | @@ -1424,6 +1432,14 @@ | ||
| 233 | einfo (_("%P%X: --hash-size needs a numeric argument\n")); | ||
| 234 | } | ||
| 235 | break; | ||
| 236 | + | ||
| 237 | + case OPTION_NO_POISON_SYSTEM_DIRECTORIES: | ||
| 238 | + command_line.poison_system_directories = FALSE; | ||
| 239 | + break; | ||
| 240 | + | ||
| 241 | + case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES: | ||
| 242 | + command_line.error_poison_system_directories = TRUE; | ||
| 243 | + break; | ||
| 244 | } | ||
| 245 | } | ||
| 246 | |||
| 247 | Index: binutils-2.22.90/ld/ldlex.h | ||
| 248 | =================================================================== | ||
| 249 | --- binutils-2.22.90.orig/ld/ldlex.h 2012-05-26 04:13:19.000000000 -0700 | ||
| 250 | +++ binutils-2.22.90/ld/ldlex.h 2012-08-07 23:34:17.122546581 -0700 | ||
| 251 | @@ -135,6 +135,8 @@ | ||
| 252 | #endif /* ENABLE_PLUGINS */ | ||
| 253 | OPTION_DEFAULT_SCRIPT, | ||
| 254 | OPTION_PRINT_OUTPUT_FORMAT, | ||
| 255 | + OPTION_NO_POISON_SYSTEM_DIRECTORIES, | ||
| 256 | + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES | ||
| 257 | }; | ||
| 258 | |||
| 259 | /* The initial parser states. */ | ||
