Gentoo Archives: gentoo-commits

From: "Ryan Hill (rhill)" <rhill@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/gcc/4.9.0/gentoo: 67_all_gcc-poison-system-directories.patch 67_all_gcc-poison-system-directories.patch.updateme README.history
Date: Sat, 24 May 2014 09:20:11
Message-Id: 20140524092008.59F802004E@flycatcher.gentoo.org
1 rhill 14/05/24 09:20:08
2
3 Modified: README.history
4 Added: 67_all_gcc-poison-system-directories.patch
5 Removed: 67_all_gcc-poison-system-directories.patch.updateme
6 Log:
7 Update poison-path patch from openembedded.
8
9 Revision Changes Path
10 1.10 src/patchsets/gcc/4.9.0/gentoo/README.history
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history?rev=1.10&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history?rev=1.10&content-type=text/plain
14 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history?r1=1.9&r2=1.10
15
16 Index: README.history
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history,v
19 retrieving revision 1.9
20 retrieving revision 1.10
21 diff -u -r1.9 -r1.10
22 --- README.history 22 May 2014 21:09:13 -0000 1.9
23 +++ README.history 24 May 2014 09:20:08 -0000 1.10
24 @@ -1,3 +1,6 @@
25 +1.1 (pending)
26 + U 67_all_gcc-poison-system-directories.patch
27 +
28 1.0 18 May 2014
29 U 09_all_default-ssp.patch
30 U 10_all_default-fortify-source.patch
31
32
33
34 1.1 src/patchsets/gcc/4.9.0/gentoo/67_all_gcc-poison-system-directories.patch
35
36 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/67_all_gcc-poison-system-directories.patch?rev=1.1&view=markup
37 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/67_all_gcc-poison-system-directories.patch?rev=1.1&content-type=text/plain
38
39 Index: 67_all_gcc-poison-system-directories.patch
40 ===================================================================
41 http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
42
43 From: Khem Raj <raj.khem@×××××.com>
44 Date: Fri, 29 Mar 2013 08:59:00 +0400
45 Subject: [PATCH 16/35] gcc: poison-system-directories
46
47 Signed-off-by: Khem Raj <raj.khem@×××××.com>
48
49 Upstream-Status: Inappropriate [distribution: codesourcery]
50 ---
51 gcc/Makefile.in | 2 +-
52 gcc/common.opt | 4 ++++
53 gcc/config.in | 6 ++++++
54 gcc/configure | 20 ++++++++++++++++++--
55 gcc/configure.ac | 10 ++++++++++
56 gcc/doc/invoke.texi | 9 +++++++++
57 gcc/gcc.c | 2 ++
58 gcc/incpath.c | 19 +++++++++++++++++++
59 8 files changed, 69 insertions(+), 3 deletions(-)
60
61 --- gcc-4.9-20140316.orig/gcc/common.opt
62 +++ gcc-4.9-20140316/gcc/common.opt
63 @@ -603,6 +603,10 @@ Wpedantic
64 Common Var(pedantic) Warning
65 Issue warnings needed for strict compliance to the standard
66
67 +Wpoison-system-directories
68 +Common Var(flag_poison_system_directories) Init(1) Warning
69 +Warn for -I and -L options using system directories if cross compiling
70 +
71 Wshadow
72 Common Var(warn_shadow) Warning
73 Warn when one local variable shadows another
74 --- gcc-4.9-20140316.orig/gcc/configure.ac
75 +++ gcc-4.9-20140316/gcc/configure.ac
76 @@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l
77 [specify that runtime libraries should be
78 installed in a compiler-specific directory])])
79
80 +AC_ARG_ENABLE([poison-system-directories],
81 + AS_HELP_STRING([--enable-poison-system-directories],
82 + [warn for use of native system header directories]),,
83 + [enable_poison_system_directories=no])
84 +if test "x${enable_poison_system_directories}" = "xyes"; then
85 + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
86 + [1],
87 + [Define to warn for use of native system header directories])
88 +fi
89 +
90 # Substitute configuration variables
91 AC_SUBST(subdirs)
92 AC_SUBST(srcdir)
93 --- gcc-4.9-20140316.orig/gcc/configure
94 +++ gcc-4.9-20140316/gcc/configure
95 @@ -928,6 +928,7 @@ with_system_zlib
96 enable_maintainer_mode
97 enable_link_mutex
98 enable_version_specific_runtime_libs
99 +enable_poison_system_directories
100 enable_plugin
101 enable_host_shared
102 enable_libquadmath_support
103 @@ -1648,6 +1649,8 @@ Optional Features:
104 --enable-version-specific-runtime-libs
105 specify that runtime libraries should be installed
106 in a compiler-specific directory
107 + --enable-poison-system-directories
108 + warn for use of native system header directories
109 --enable-plugin enable plugin support
110 --enable-host-shared build host code as shared libraries
111 --disable-libquadmath-support
112 @@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti
113 fi
114
115
116 +# Check whether --enable-poison-system-directories was given.
117 +if test "${enable_poison_system_directories+set}" = set; then :
118 + enableval=$enable_poison_system_directories;
119 +else
120 + enable_poison_system_directories=no
121 +fi
122 +
123 +if test "x${enable_poison_system_directories}" = "xyes"; then
124 +
125 +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
126 +
127 +fi
128 +
129 # Substitute configuration variables
130
131
132 --- gcc-4.9-20140316.orig/gcc/config.in
133 +++ gcc-4.9-20140316/gcc/config.in
134 @@ -138,6 +138,12 @@
135 #endif
136
137
138 +/* Define to warn for use of native system header directories */
139 +#ifndef USED_FOR_TARGET
140 +#undef ENABLE_POISON_SYSTEM_DIRECTORIES
141 +#endif
142 +
143 +
144 /* Define if you want all operations on RTL (the basic data structure of the
145 optimizer and back end) to be checked for dynamic type safety at runtime.
146 This is quite expensive. */
147 --- gcc-4.9-20140316.orig/gcc/gcc.c
148 +++ gcc-4.9-20140316/gcc/gcc.c
149 @@ -764,6 +764,8 @@ proper position among the other output f
150 "%{fuse-ld=*:-fuse-ld=%*}\
151 %X %{o*} %{e*} %{N} %{n} %{r}\
152 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
153 + %{Wno-poison-system-directories:--no-poison-system-directories}\
154 + %{Werror=poison-system-directories:--error-poison-system-directories}\
155 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
156 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
157 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
158 --- gcc-4.9-20140316.orig/gcc/incpath.c
159 +++ gcc-4.9-20140316/gcc/incpath.c
160 @@ -28,6 +28,7 @@
161 #include "intl.h"
162 #include "incpath.h"
163 #include "cppdefault.h"
164 +#include "diagnostic-core.h"
165
166 /* Microsoft Windows does not natively support inodes.
167 VMS has non-numeric inodes. */
168 @@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo
169 }
170 fprintf (stderr, _("End of search list.\n"));
171 }
172 +
173 +#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
174 + if (flag_poison_system_directories)
175 + {
176 + struct cpp_dir *p;
177 +
178 + for (p = heads[QUOTE]; p; p = p->next)
179 + {
180 + if ((!strncmp (p->name, "/usr/include", 12))
181 + || (!strncmp (p->name, "/usr/local/include", 18))
182 + || (!strncmp (p->name, "/usr/X11R6/include", 18)))
183 + warning (OPT_Wpoison_system_directories,
184 + "include location \"%s\" is unsafe for "
185 + "cross-compilation",
186 + p->name);
187 + }
188 + }
189 +#endif
190 }
191
192 /* Use given -I paths for #include "..." but not #include <...>, and
193 --- a/gcc/doc/gcc.info
194 +++ b/gcc/doc/gcc.info
195 @@ -558,6 +558,7 @@ _Warning Options_
196 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded
197 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format
198 -Wpointer-arith -Wno-pointer-to-int-cast
199 + -Wno-poison-system-directories
200 -Wredundant-decls -Wno-return-local-addr
201 -Wreturn-type -Wsequence-point -Wshadow
202 -Wsign-compare -Wsign-conversion -Wfloat-conversion
203 @@ -4010,6 +4011,13 @@ compiler warns that an unrecognized option is present.
204 pragmas in system headers--for that, '-Wunknown-pragmas' must also
205 be used.
206
207 +'-Wno-poison-system-directories'
208 + Do not warn for @option{-I} or @option{-L} options using system
209 + directories such as @file{/usr/include} when cross compiling. This
210 + option is intended for use in chroot environments when such
211 + directories contain the correct headers and libraries for the target
212 + system rather than the host.
213 +
214 '-Wtrampolines'
215 Warn about trampolines generated for pointers to nested functions.