diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-08 22:46:13 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-08 22:46:13 +0200 |
commit | 8d89651ef729e560ad96dcfc002fcde6ff7f923b (patch) | |
tree | eb5be01c25f735d12fe9881ee6327c9b7e8bbe39 /meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch | |
download | meta-linaro-dizzy-enea.tar.gz |
initial commit for Enea Linux 5.0 armdizzy-enea
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch')
-rw-r--r-- | meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch new file mode 100644 index 0000000..475ef96 --- /dev/null +++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.9/0016-gcc-poison-system-directories.patch | |||
@@ -0,0 +1,190 @@ | |||
1 | From 160397ef3c3331099af028f1b8d3e085b07d88ad Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 29 Mar 2013 08:59:00 +0400 | ||
4 | Subject: [PATCH 16/35] gcc: poison-system-directories | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | |||
8 | Upstream-Status: Inappropriate [distribution: codesourcery] | ||
9 | --- | ||
10 | gcc/Makefile.in | 2 +- | ||
11 | gcc/common.opt | 4 ++++ | ||
12 | gcc/config.in | 6 ++++++ | ||
13 | gcc/configure | 20 ++++++++++++++++++-- | ||
14 | gcc/configure.ac | 10 ++++++++++ | ||
15 | gcc/doc/invoke.texi | 9 +++++++++ | ||
16 | gcc/gcc.c | 2 ++ | ||
17 | gcc/incpath.c | 19 +++++++++++++++++++ | ||
18 | 8 files changed, 69 insertions(+), 3 deletions(-) | ||
19 | |||
20 | Index: gcc-4.9-20140316/gcc/common.opt | ||
21 | =================================================================== | ||
22 | --- gcc-4.9-20140316.orig/gcc/common.opt | ||
23 | +++ gcc-4.9-20140316/gcc/common.opt | ||
24 | @@ -603,6 +603,10 @@ Wpedantic | ||
25 | Common Var(pedantic) Warning | ||
26 | Issue warnings needed for strict compliance to the standard | ||
27 | |||
28 | +Wpoison-system-directories | ||
29 | +Common Var(flag_poison_system_directories) Init(1) Warning | ||
30 | +Warn for -I and -L options using system directories if cross compiling | ||
31 | + | ||
32 | Wshadow | ||
33 | Common Var(warn_shadow) Warning | ||
34 | Warn when one local variable shadows another | ||
35 | Index: gcc-4.9-20140316/gcc/config.in | ||
36 | =================================================================== | ||
37 | --- gcc-4.9-20140316.orig/gcc/config.in | ||
38 | +++ gcc-4.9-20140316/gcc/config.in | ||
39 | @@ -138,6 +138,12 @@ | ||
40 | #endif | ||
41 | |||
42 | |||
43 | +/* Define to warn for use of native system header directories */ | ||
44 | +#ifndef USED_FOR_TARGET | ||
45 | +#undef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
46 | +#endif | ||
47 | + | ||
48 | + | ||
49 | /* Define if you want all operations on RTL (the basic data structure of the | ||
50 | optimizer and back end) to be checked for dynamic type safety at runtime. | ||
51 | This is quite expensive. */ | ||
52 | Index: gcc-4.9-20140316/gcc/configure | ||
53 | =================================================================== | ||
54 | --- gcc-4.9-20140316.orig/gcc/configure | ||
55 | +++ gcc-4.9-20140316/gcc/configure | ||
56 | @@ -928,6 +928,7 @@ with_system_zlib | ||
57 | enable_maintainer_mode | ||
58 | enable_link_mutex | ||
59 | enable_version_specific_runtime_libs | ||
60 | +enable_poison_system_directories | ||
61 | enable_plugin | ||
62 | enable_host_shared | ||
63 | enable_libquadmath_support | ||
64 | @@ -1648,6 +1649,8 @@ Optional Features: | ||
65 | --enable-version-specific-runtime-libs | ||
66 | specify that runtime libraries should be installed | ||
67 | in a compiler-specific directory | ||
68 | + --enable-poison-system-directories | ||
69 | + warn for use of native system header directories | ||
70 | --enable-plugin enable plugin support | ||
71 | --enable-host-shared build host code as shared libraries | ||
72 | --disable-libquadmath-support | ||
73 | @@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti | ||
74 | fi | ||
75 | |||
76 | |||
77 | +# Check whether --enable-poison-system-directories was given. | ||
78 | +if test "${enable_poison_system_directories+set}" = set; then : | ||
79 | + enableval=$enable_poison_system_directories; | ||
80 | +else | ||
81 | + enable_poison_system_directories=no | ||
82 | +fi | ||
83 | + | ||
84 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
85 | + | ||
86 | +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h | ||
87 | + | ||
88 | +fi | ||
89 | + | ||
90 | # Substitute configuration variables | ||
91 | |||
92 | |||
93 | Index: gcc-4.9-20140316/gcc/configure.ac | ||
94 | =================================================================== | ||
95 | --- gcc-4.9-20140316.orig/gcc/configure.ac | ||
96 | +++ gcc-4.9-20140316/gcc/configure.ac | ||
97 | @@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l | ||
98 | [specify that runtime libraries should be | ||
99 | installed in a compiler-specific directory])]) | ||
100 | |||
101 | +AC_ARG_ENABLE([poison-system-directories], | ||
102 | + AS_HELP_STRING([--enable-poison-system-directories], | ||
103 | + [warn for use of native system header directories]),, | ||
104 | + [enable_poison_system_directories=no]) | ||
105 | +if test "x${enable_poison_system_directories}" = "xyes"; then | ||
106 | + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], | ||
107 | + [1], | ||
108 | + [Define to warn for use of native system header directories]) | ||
109 | +fi | ||
110 | + | ||
111 | # Substitute configuration variables | ||
112 | AC_SUBST(subdirs) | ||
113 | AC_SUBST(srcdir) | ||
114 | Index: gcc-4.9-20140316/gcc/doc/invoke.texi | ||
115 | =================================================================== | ||
116 | --- gcc-4.9-20140316.orig/gcc/doc/invoke.texi | ||
117 | +++ gcc-4.9-20140316/gcc/doc/invoke.texi | ||
118 | @@ -260,6 +260,7 @@ Objective-C and Objective-C++ Dialects}. | ||
119 | -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol | ||
120 | -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol | ||
121 | -Wpointer-arith -Wno-pointer-to-int-cast @gol | ||
122 | +-Wno-poison-system-directories @gol | ||
123 | -Wredundant-decls -Wno-return-local-addr @gol | ||
124 | -Wreturn-type -Wsequence-point -Wshadow @gol | ||
125 | -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol | ||
126 | @@ -4230,6 +4231,14 @@ headers---for that, @option{-Wunknown-pr | ||
127 | for most targets, it is made up of code and thus requires the stack | ||
128 | to be made executable in order for the program to work properly. | ||
129 | |||
130 | +@item -Wno-poison-system-directories | ||
131 | +@opindex Wno-poison-system-directories | ||
132 | +Do not warn for @option{-I} or @option{-L} options using system | ||
133 | +directories such as @file{/usr/include} when cross compiling. This | ||
134 | +option is intended for use in chroot environments when such | ||
135 | +directories contain the correct headers and libraries for the target | ||
136 | +system rather than the host. | ||
137 | + | ||
138 | @item -Wfloat-equal | ||
139 | @opindex Wfloat-equal | ||
140 | @opindex Wno-float-equal | ||
141 | Index: gcc-4.9-20140316/gcc/gcc.c | ||
142 | =================================================================== | ||
143 | --- gcc-4.9-20140316.orig/gcc/gcc.c | ||
144 | +++ gcc-4.9-20140316/gcc/gcc.c | ||
145 | @@ -764,6 +764,8 @@ proper position among the other output f | ||
146 | "%{fuse-ld=*:-fuse-ld=%*}\ | ||
147 | %X %{o*} %{e*} %{N} %{n} %{r}\ | ||
148 | %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \ | ||
149 | + %{Wno-poison-system-directories:--no-poison-system-directories}\ | ||
150 | + %{Werror=poison-system-directories:--error-poison-system-directories}\ | ||
151 | %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\ | ||
152 | %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ | ||
153 | %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ | ||
154 | Index: gcc-4.9-20140316/gcc/incpath.c | ||
155 | =================================================================== | ||
156 | --- gcc-4.9-20140316.orig/gcc/incpath.c | ||
157 | +++ gcc-4.9-20140316/gcc/incpath.c | ||
158 | @@ -28,6 +28,7 @@ | ||
159 | #include "intl.h" | ||
160 | #include "incpath.h" | ||
161 | #include "cppdefault.h" | ||
162 | +#include "diagnostic-core.h" | ||
163 | |||
164 | /* Microsoft Windows does not natively support inodes. | ||
165 | VMS has non-numeric inodes. */ | ||
166 | @@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo | ||
167 | } | ||
168 | fprintf (stderr, _("End of search list.\n")); | ||
169 | } | ||
170 | + | ||
171 | +#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES | ||
172 | + if (flag_poison_system_directories) | ||
173 | + { | ||
174 | + struct cpp_dir *p; | ||
175 | + | ||
176 | + for (p = heads[QUOTE]; p; p = p->next) | ||
177 | + { | ||
178 | + if ((!strncmp (p->name, "/usr/include", 12)) | ||
179 | + || (!strncmp (p->name, "/usr/local/include", 18)) | ||
180 | + || (!strncmp (p->name, "/usr/X11R6/include", 18))) | ||
181 | + warning (OPT_Wpoison_system_directories, | ||
182 | + "include location \"%s\" is unsafe for " | ||
183 | + "cross-compilation", | ||
184 | + p->name); | ||
185 | + } | ||
186 | + } | ||
187 | +#endif | ||
188 | } | ||
189 | |||
190 | /* Use given -I paths for #include "..." but not #include <...>, and | ||