summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch149
1 files changed, 149 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch
new file mode 100644
index 0000000000..e68a2de2a2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch
@@ -0,0 +1,149 @@
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
28Index: gcc-4.5.0/gcc/common.opt
29===================================================================
30--- gcc-4.5.0.orig/gcc/common.opt 2010-03-17 20:01:09.000000000 -0700
31+++ gcc-4.5.0/gcc/common.opt 2010-06-25 11:35:39.965383734 -0700
32@@ -152,6 +152,10 @@
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)
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
43Index: gcc-4.5.0/gcc/config.in
44===================================================================
45--- gcc-4.5.0.orig/gcc/config.in 2010-04-14 02:30:07.000000000 -0700
46+++ gcc-4.5.0/gcc/config.in 2010-06-25 11:35:39.969383588 -0700
47@@ -132,6 +132,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. */
60Index: gcc-4.5.0/gcc/configure.ac
61===================================================================
62--- gcc-4.5.0.orig/gcc/configure.ac 2010-06-25 11:34:01.433382161 -0700
63+++ gcc-4.5.0/gcc/configure.ac 2010-06-25 11:35:39.969383588 -0700
64@@ -4276,6 +4276,16 @@
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)
81Index: gcc-4.5.0/gcc/doc/invoke.texi
82===================================================================
83--- gcc-4.5.0.orig/gcc/doc/invoke.texi 2010-04-06 07:02:22.000000000 -0700
84+++ gcc-4.5.0/gcc/doc/invoke.texi 2010-06-25 11:35:39.992666345 -0700
85@@ -252,6 +252,7 @@
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@@ -3603,6 +3604,14 @@
94 option will @emph{not} warn about unknown pragmas in system
95 headers---for that, @option{-Wunknown-pragmas} must also be used.
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
108Index: gcc-4.5.0/gcc/gcc.c
109===================================================================
110--- gcc-4.5.0.orig/gcc/gcc.c 2010-02-11 04:23:08.000000000 -0800
111+++ gcc-4.5.0/gcc/gcc.c 2010-06-25 11:35:40.009381858 -0700
112@@ -792,6 +792,8 @@
113 %{flto} %{fwhopr} %l " LINK_PIE_SPEC \
114 "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
115 %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!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)} %(mflib)\
120 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
121Index: gcc-4.5.0/gcc/incpath.c
122===================================================================
123--- gcc-4.5.0.orig/gcc/incpath.c 2009-11-25 02:55:54.000000000 -0800
124+++ gcc-4.5.0/gcc/incpath.c 2010-06-25 11:35:40.017209818 -0700
125@@ -353,6 +353,24 @@
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