summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.8/gcc-poison-system-directories.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.8/gcc-poison-system-directories.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.8/gcc-poison-system-directories.patch231
1 files changed, 231 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.8/gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..afb98d7336
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/gcc-poison-system-directories.patch
@@ -0,0 +1,231 @@
1Upstream-Status: Inappropriate [distribution: codesourcery]
2
3 gcc/
4 2008-07-02 Joseph Myers <joseph@codesourcery.com>
5 * c-incpath.c: Include toplev.h.
6 (merge_include_chains): Use warning instead of cpp_error for
7 system directory poisoning diagnostic.
8 * Makefile.in (c-incpath.o): Depend on toplev.h.
9 * gcc.c (LINK_COMMAND_SPEC): Pass
10 --error-poison-system-directories if
11 -Werror=poison-system-directories.
12
13 2007-06-13 Joseph Myers <joseph@codesourcery.com>
14 * common.opt (--Wno-poison-system-directories): New.
15 * doc/invoke.texi (-Wno-poison-system-directories): Document.
16 * c-incpath.c: Include flags.h.
17 (merge_include_chains): Check flag_poison_system_directories.
18 * gcc.c (LINK_COMMAND_SPEC): Pass --no-poison-system-directories
19 to linker if -Wno-poison-system-directories.
20 * Makefile.in (c-incpath.o): Depend on $(FLAGS_H).
21
22 2007-03-20 Daniel Jacobowitz <dan@codesourcery.com>
23 Joseph Myers <joseph@codesourcery.com>
24 * configure.ac (--enable-poison-system-directories): New option.
25 * configure, config.in: Regenerate.
26 * c-incpath.c (merge_include_chains): If
27 ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of
28 /usr/include, /usr/local/include or /usr/X11R6/include.
29
30Index: gcc-4.8.0/gcc/common.opt
31===================================================================
32--- gcc-4.8.0.orig/gcc/common.opt 2013-03-26 14:10:58.485914988 -0700
33+++ gcc-4.8.0/gcc/common.opt 2013-03-26 14:11:01.893915049 -0700
34@@ -595,6 +595,10 @@
35 Common Var(pedantic) Warning
36 Issue warnings needed for strict compliance to the standard
37
38+Wpoison-system-directories
39+Common Var(flag_poison_system_directories) Init(1) Warning
40+Warn for -I and -L options using system directories if cross compiling
41+
42 Wshadow
43 Common Var(warn_shadow) Warning
44 Warn when one local variable shadows another
45Index: gcc-4.8.0/gcc/config.in
46===================================================================
47--- gcc-4.8.0.orig/gcc/config.in 2013-03-26 14:10:58.485914988 -0700
48+++ gcc-4.8.0/gcc/config.in 2013-03-26 14:11:01.893915049 -0700
49@@ -138,6 +138,12 @@
50 #endif
51
52
53+/* Define to warn for use of native system header directories */
54+#ifndef USED_FOR_TARGET
55+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
56+#endif
57+
58+
59 /* Define if you want all operations on RTL (the basic data structure of the
60 optimizer and back end) to be checked for dynamic type safety at runtime.
61 This is quite expensive. */
62Index: gcc-4.8.0/gcc/configure.ac
63===================================================================
64--- gcc-4.8.0.orig/gcc/configure.ac 2013-03-26 14:11:01.553915046 -0700
65+++ gcc-4.8.0/gcc/configure.ac 2013-03-26 14:19:57.317925096 -0700
66@@ -5063,6 +5063,16 @@
67 [specify that runtime libraries should be
68 installed in a compiler-specific directory])])
69
70+AC_ARG_ENABLE([poison-system-directories],
71+ AS_HELP_STRING([--enable-poison-system-directories],
72+ [warn for use of native system header directories]),,
73+ [enable_poison_system_directories=no])
74+if test "x${enable_poison_system_directories}" = "xyes"; then
75+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
76+ [1],
77+ [Define to warn for use of native system header directories])
78+fi
79+
80 # Substitute configuration variables
81 AC_SUBST(subdirs)
82 AC_SUBST(srcdir)
83Index: gcc-4.8.0/gcc/doc/invoke.texi
84===================================================================
85--- gcc-4.8.0.orig/gcc/doc/invoke.texi 2013-03-26 14:10:58.485914988 -0700
86+++ gcc-4.8.0/gcc/doc/invoke.texi 2013-03-26 14:19:57.437925099 -0700
87@@ -258,6 +258,7 @@
88 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
89 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
90 -Wpointer-arith -Wno-pointer-to-int-cast @gol
91+-Wno-poison-system-directories @gol
92 -Wredundant-decls -Wno-return-local-addr @gol
93 -Wreturn-type -Wsequence-point -Wshadow @gol
94 -Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess @gol
95@@ -4007,6 +4008,14 @@
96 for most targets, it is made up of code and thus requires the stack
97 to be made executable in order for the program to work properly.
98
99+@item -Wno-poison-system-directories
100+@opindex Wno-poison-system-directories
101+Do not warn for @option{-I} or @option{-L} options using system
102+directories such as @file{/usr/include} when cross compiling. This
103+option is intended for use in chroot environments when such
104+directories contain the correct headers and libraries for the target
105+system rather than the host.
106+
107 @item -Wfloat-equal
108 @opindex Wfloat-equal
109 @opindex Wno-float-equal
110Index: gcc-4.8.0/gcc/gcc.c
111===================================================================
112--- gcc-4.8.0.orig/gcc/gcc.c 2013-03-26 14:10:58.485914988 -0700
113+++ gcc-4.8.0/gcc/gcc.c 2013-03-26 14:19:57.425925095 -0700
114@@ -740,6 +740,8 @@
115 "%{fuse-ld=*:-fuse-ld=%*}\
116 %X %{o*} %{e*} %{N} %{n} %{r}\
117 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
118+ %{Wno-poison-system-directories:--no-poison-system-directories}\
119+ %{Werror=poison-system-directories:--error-poison-system-directories}\
120 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
121 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
122 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
123Index: gcc-4.8.0/gcc/incpath.c
124===================================================================
125--- gcc-4.8.0.orig/gcc/incpath.c 2013-03-26 14:10:58.485914988 -0700
126+++ gcc-4.8.0/gcc/incpath.c 2013-03-26 14:43:10.397951230 -0700
127@@ -28,6 +28,7 @@
128 #include "intl.h"
129 #include "incpath.h"
130 #include "cppdefault.h"
131+#include "diagnostic-core.h"
132
133 /* Microsoft Windows does not natively support inodes.
134 VMS has non-numeric inodes. */
135@@ -382,6 +383,24 @@
136 }
137 fprintf (stderr, _("End of search list.\n"));
138 }
139+
140+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
141+ if (flag_poison_system_directories)
142+ {
143+ struct cpp_dir *p;
144+
145+ for (p = heads[QUOTE]; p; p = p->next)
146+ {
147+ if ((!strncmp (p->name, "/usr/include", 12))
148+ || (!strncmp (p->name, "/usr/local/include", 18))
149+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
150+ warning (OPT_Wpoison_system_directories,
151+ "include location \"%s\" is unsafe for "
152+ "cross-compilation",
153+ p->name);
154+ }
155+ }
156+#endif
157 }
158
159 /* Use given -I paths for #include "..." but not #include <...>, and
160Index: gcc-4.8.0/gcc/Makefile.in
161===================================================================
162--- gcc-4.8.0.orig/gcc/Makefile.in 2013-03-26 14:10:58.485914988 -0700
163+++ gcc-4.8.0/gcc/Makefile.in 2013-03-26 14:19:57.165925091 -0700
164@@ -2018,7 +2018,7 @@
165
166 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
167 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
168- $(MACHMODE_H)
169+ $(MACHMODE_H) $(FLAGS_H) toplev.h
170
171 CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
172 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
173Index: gcc-4.8.0/gcc/configure
174===================================================================
175--- gcc-4.8.0.orig/gcc/configure 2013-03-26 14:11:01.561915044 -0700
176+++ gcc-4.8.0/gcc/configure 2013-03-26 14:19:57.301925093 -0700
177@@ -917,6 +917,7 @@
178 with_system_zlib
179 enable_maintainer_mode
180 enable_version_specific_runtime_libs
181+enable_poison_system_directories
182 enable_plugin
183 enable_libquadmath_support
184 with_linker_hash_style
185@@ -1630,6 +1631,8 @@
186 --enable-version-specific-runtime-libs
187 specify that runtime libraries should be installed
188 in a compiler-specific directory
189+ --enable-poison-system-directories
190+ warn for use of native system header directories
191 --enable-plugin enable plugin support
192 --disable-libquadmath-support
193 disable libquadmath support for Fortran
194@@ -17828,7 +17831,7 @@
195 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
196 lt_status=$lt_dlunknown
197 cat > conftest.$ac_ext <<_LT_EOF
198-#line 17831 "configure"
199+#line 17834 "configure"
200 #include "confdefs.h"
201
202 #if HAVE_DLFCN_H
203@@ -17934,7 +17937,7 @@
204 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
205 lt_status=$lt_dlunknown
206 cat > conftest.$ac_ext <<_LT_EOF
207-#line 17937 "configure"
208+#line 17940 "configure"
209 #include "confdefs.h"
210
211 #if HAVE_DLFCN_H
212@@ -27103,6 +27106,19 @@
213 fi
214
215
216+# Check whether --enable-poison-system-directories was given.
217+if test "${enable_poison_system_directories+set}" = set; then :
218+ enableval=$enable_poison_system_directories;
219+else
220+ enable_poison_system_directories=no
221+fi
222+
223+if test "x${enable_poison_system_directories}" = "xyes"; then
224+
225+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
226+
227+fi
228+
229 # Substitute configuration variables
230
231