diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch')
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch new file mode 100644 index 0000000000..e1b7131a81 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-poison-system-directories.patch | |||
| @@ -0,0 +1,221 @@ | |||
| 1 | gcc/ | ||
| 2 | 2008-07-02 Joseph Myers <joseph@codesourcery.com> | ||
| 3 | * c-incpath.c: Include toplev.h. | ||
| 4 | (merge_include_chains): Use warning instead of cpp_error for | ||
| 5 | system directory poisoning diagnostic. | ||
| 6 | * Makefile.in (c-incpath.o): Depend on toplev.h. | ||
| 7 | * gcc.c (LINK_COMMAND_SPEC): Pass | ||
| 8 | --error-poison-system-directories if | ||
| 9 | -Werror=poison-system-directories. | ||
| 10 | |||
| 11 | 2007-06-13 Joseph Myers <joseph@codesourcery.com> | ||
| 12 | * common.opt (--Wno-poison-system-directories): New. | ||
| 13 | * doc/invoke.texi (-Wno-poison-system-directories): Document. | ||
| 14 | * c-incpath.c: Include flags.h. | ||
| 15 | (merge_include_chains): Check flag_poison_system_directories. | ||
| 16 | * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories | ||
| 17 | to linker if -Wno-poison-system-directories. | ||
| 18 | * Makefile.in (c-incpath.o): Depend on $(FLAGS_H). | ||
| 19 | |||
| 20 | 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com> | ||
| 21 | Joseph Myers <joseph@codesourcery.com> | ||
| 22 | * configure.ac (--enable-poison-system-directories): New option. | ||
| 23 | * configure, config.in: Regenerate. | ||
| 24 | * c-incpath.c (merge_include_chains): If | ||
| 25 | ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of | ||
| 26 | /usr/include, /usr/local/include or /usr/X11R6/include. | ||
| 27 | |||
| 28 | Index: gcc-4.6.0/gcc/common.opt | ||
| 29 | =================================================================== | ||
| 30 | --- gcc-4.6.0.orig/gcc/common.opt | ||
| 31 | +++ gcc-4.6.0/gcc/common.opt | ||
| 32 | @@ -558,6 +558,10 @@ Wpadded | ||
| 33 | Common Var(warn_padded) Warning | ||
| 34 | Warn when padding is required to align structure members | ||
| 35 | |||
| 36 | +Wpoison-system-directories | ||
| 37 | +Common Var(flag_poison_system_directories) Init(1) Warning | ||
| 38 | +Warn for -I and -L options using system directories if cross compiling | ||
| 39 | + | ||
| 40 | Wshadow | ||
| 41 | Common Var(warn_shadow) Warning | ||
| 42 | Warn when one local variable shadows another | ||
| 43 | Index: gcc-4.6.0/gcc/config.in | ||
| 44 | =================================================================== | ||
| 45 | --- gcc-4.6.0.orig/gcc/config.in | ||
| 46 | +++ gcc-4.6.0/gcc/config.in | ||
| 47 | @@ -144,6 +144,12 @@ | ||
| 48 | #endif | ||
| 49 | |||
| 50 | |||
| 51 | +/* Define to warn for use of native system header directories */ | ||
| 52 | +#ifndef USED_FOR_TARGET | ||
| 53 | +#undef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
| 54 | +#endif | ||
| 55 | + | ||
| 56 | + | ||
| 57 | /* Define if you want all operations on RTL (the basic data structure of the | ||
| 58 | optimizer and back end) to be checked for dynamic type safety at runtime. | ||
| 59 | This is quite expensive. */ | ||
| 60 | Index: gcc-4.6.0/gcc/configure.ac | ||
| 61 | =================================================================== | ||
| 62 | --- gcc-4.6.0.orig/gcc/configure.ac | ||
| 63 | +++ gcc-4.6.0/gcc/configure.ac | ||
| 64 | @@ -4694,6 +4694,16 @@ else | ||
| 65 | fi) | ||
| 66 | AC_SUBST(slibdir) | ||
| 67 | |||
| 68 | +AC_ARG_ENABLE([poison-system-directories], | ||
| 69 | + AS_HELP_STRING([--enable-poison-system-directories], | ||
| 70 | + [warn for use of native system header directories]),, | ||
| 71 | + [enable_poison_system_directories=no]) | ||
| 72 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
| 73 | + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], | ||
| 74 | + [1], | ||
| 75 | + [Define to warn for use of native system header directories]) | ||
| 76 | +fi | ||
| 77 | + | ||
| 78 | # Substitute configuration variables | ||
| 79 | AC_SUBST(subdirs) | ||
| 80 | AC_SUBST(srcdir) | ||
| 81 | Index: gcc-4.6.0/gcc/doc/invoke.texi | ||
| 82 | =================================================================== | ||
| 83 | --- gcc-4.6.0.orig/gcc/doc/invoke.texi | ||
| 84 | +++ gcc-4.6.0/gcc/doc/invoke.texi | ||
| 85 | @@ -257,6 +257,7 @@ Objective-C and Objective-C++ Dialects}. | ||
| 86 | -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol | ||
| 87 | -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol | ||
| 88 | -Wpointer-arith -Wno-pointer-to-int-cast @gol | ||
| 89 | +-Wno-poison-system-directories @gol | ||
| 90 | -Wredundant-decls @gol | ||
| 91 | -Wreturn-type -Wsequence-point -Wshadow @gol | ||
| 92 | -Wsign-compare -Wsign-conversion -Wstack-protector @gol | ||
| 93 | @@ -3773,6 +3774,14 @@ headers---for that, @option{-Wunknown-pr | ||
| 94 | for most targets, it is made up of code and thus requires the stack | ||
| 95 | to be made executable in order for the program to work properly. | ||
| 96 | |||
| 97 | +@item -Wno-poison-system-directories | ||
| 98 | +@opindex Wno-poison-system-directories | ||
| 99 | +Do not warn for @option{-I} or @option{-L} options using system | ||
| 100 | +directories such as @file{/usr/include} when cross compiling. This | ||
| 101 | +option is intended for use in chroot environments when such | ||
| 102 | +directories contain the correct headers and libraries for the target | ||
| 103 | +system rather than the host. | ||
| 104 | + | ||
| 105 | @item -Wfloat-equal | ||
| 106 | @opindex Wfloat-equal | ||
| 107 | @opindex Wno-float-equal | ||
| 108 | Index: gcc-4.6.0/gcc/gcc.c | ||
| 109 | =================================================================== | ||
| 110 | --- gcc-4.6.0.orig/gcc/gcc.c | ||
| 111 | +++ gcc-4.6.0/gcc/gcc.c | ||
| 112 | @@ -659,6 +659,8 @@ proper position among the other output f | ||
| 113 | %{flto} %{flto=*} %l " LINK_PIE_SPEC \ | ||
| 114 | "%X %{o*} %{e*} %{N} %{n} %{r}\ | ||
| 115 | %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\ | ||
| 116 | + %{Wno-poison-system-directories:--no-poison-system-directories}\ | ||
| 117 | + %{Werror=poison-system-directories:--error-poison-system-directories}\ | ||
| 118 | %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ | ||
| 119 | %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ | ||
| 120 | %(mflib) " STACK_SPLIT_SPEC "\ | ||
| 121 | Index: gcc-4.6.0/gcc/incpath.c | ||
| 122 | =================================================================== | ||
| 123 | --- gcc-4.6.0.orig/gcc/incpath.c | ||
| 124 | +++ gcc-4.6.0/gcc/incpath.c | ||
| 125 | @@ -353,6 +353,24 @@ merge_include_chains (const char *sysroo | ||
| 126 | } | ||
| 127 | fprintf (stderr, _("End of search list.\n")); | ||
| 128 | } | ||
| 129 | + | ||
| 130 | +#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
| 131 | + if (flag_poison_system_directories) | ||
| 132 | + { | ||
| 133 | + struct cpp_dir *p; | ||
| 134 | + | ||
| 135 | + for (p = heads[QUOTE]; p; p = p->next) | ||
| 136 | + { | ||
| 137 | + if ((!strncmp (p->name, "/usr/include", 12)) | ||
| 138 | + || (!strncmp (p->name, "/usr/local/include", 18)) | ||
| 139 | + || (!strncmp (p->name, "/usr/X11R6/include", 18))) | ||
| 140 | + warning (OPT_Wpoison_system_directories, | ||
| 141 | + "include location \"%s\" is unsafe for " | ||
| 142 | + "cross-compilation", | ||
| 143 | + p->name); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | +#endif | ||
| 147 | } | ||
| 148 | |||
| 149 | /* Use given -I paths for #include "..." but not #include <...>, and | ||
| 150 | Index: gcc-4.6.0/gcc/Makefile.in | ||
| 151 | =================================================================== | ||
| 152 | --- gcc-4.6.0.orig/gcc/Makefile.in | ||
| 153 | +++ gcc-4.6.0/gcc/Makefile.in | ||
| 154 | @@ -2179,7 +2179,7 @@ attribs.o : attribs.c $(CONFIG_H) $(SYST | ||
| 155 | |||
| 156 | incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \ | ||
| 157 | intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \ | ||
| 158 | - $(MACHMODE_H) | ||
| 159 | + $(MACHMODE_H) $(FLAGS_H) toplev.h | ||
| 160 | |||
| 161 | prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) prefix.h \ | ||
| 162 | Makefile $(BASEVER) | ||
| 163 | Index: gcc-4.6.0/gcc/configure | ||
| 164 | =================================================================== | ||
| 165 | --- gcc-4.6.0.orig/gcc/configure | ||
| 166 | +++ gcc-4.6.0/gcc/configure | ||
| 167 | @@ -912,6 +912,7 @@ with_system_zlib | ||
| 168 | enable_maintainer_mode | ||
| 169 | enable_version_specific_runtime_libs | ||
| 170 | with_slibdir | ||
| 171 | +enable_poison_system_directories | ||
| 172 | enable_plugin | ||
| 173 | enable_libquadmath_support | ||
| 174 | ' | ||
| 175 | @@ -1623,6 +1624,8 @@ Optional Features: | ||
| 176 | --enable-version-specific-runtime-libs | ||
| 177 | specify that runtime libraries should be | ||
| 178 | installed in a compiler-specific directory | ||
| 179 | + --enable-poison-system-directories | ||
| 180 | + warn for use of native system header directories | ||
| 181 | --enable-plugin enable plugin support | ||
| 182 | --disable-libquadmath-support | ||
| 183 | disable libquadmath support for Fortran | ||
| 184 | @@ -17508,7 +17511,7 @@ else | ||
| 185 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 | ||
| 186 | lt_status=$lt_dlunknown | ||
| 187 | cat > conftest.$ac_ext <<_LT_EOF | ||
| 188 | -#line 17511 "configure" | ||
| 189 | +#line 17514 "configure" | ||
| 190 | #include "confdefs.h" | ||
| 191 | |||
| 192 | #if HAVE_DLFCN_H | ||
| 193 | @@ -17614,7 +17617,7 @@ else | ||
| 194 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 | ||
| 195 | lt_status=$lt_dlunknown | ||
| 196 | cat > conftest.$ac_ext <<_LT_EOF | ||
| 197 | -#line 17617 "configure" | ||
| 198 | +#line 17620 "configure" | ||
| 199 | #include "confdefs.h" | ||
| 200 | |||
| 201 | #if HAVE_DLFCN_H | ||
| 202 | @@ -26127,6 +26130,19 @@ fi | ||
| 203 | |||
| 204 | |||
| 205 | |||
| 206 | +# Check whether --enable-poison-system-directories was given. | ||
| 207 | +if test "${enable_poison_system_directories+set}" = set; then : | ||
| 208 | + enableval=$enable_poison_system_directories; | ||
| 209 | +else | ||
| 210 | + enable_poison_system_directories=no | ||
| 211 | +fi | ||
| 212 | + | ||
| 213 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
| 214 | + | ||
| 215 | +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h | ||
| 216 | + | ||
| 217 | +fi | ||
| 218 | + | ||
| 219 | # Substitute configuration variables | ||
| 220 | |||
| 221 | |||
