summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-09-29 15:18:01 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-01 16:30:43 +0100
commit23f522e7a53821a8fb036e1aebddc7379d6f584e (patch)
treeb6fd962477f8b0c773275b6030e164bcd25aa43c
parent9a1d4d0c8d8f995a12b341e44386d8d2c680f720 (diff)
downloadpoky-23f522e7a53821a8fb036e1aebddc7379d6f584e.tar.gz
gcc: Update poisoned include path checking
[BUGID #374] The poison directory patch that was included with gcc-4.5.0 was not previously enabled due to the lack of the configure file changes. The patch has been updated to include the configure fragment. It was also noted that this patch preformed nearly the same functions as the zecke-no-host-includes patch, but with slightly different directories. The directories scanned were added from the zecke-no-host-includes patch to the new gcc-poison-dir-extend.patch. The other difference with the zecke patch is that poisoned headers is no longer an immediate fatal error. There may be instances where someone wants to do this. Adding -Werror=poison-system-directories to the CFLAGS would restore the behavior. Also fix a small problem where --help=warnings on gcc wouldn't return the poison-system-directories as a valid option, even though it was. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-dir-extend.patch24
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-system-directories.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/zecke-no-host-includes.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.5.0.bb2
5 files changed, 78 insertions, 34 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0.inc b/meta/recipes-devtools/gcc/gcc-4.5.0.inc
index 2b5c82975a..9a0a5e5671 100644
--- a/meta/recipes-devtools/gcc/gcc-4.5.0.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0.inc
@@ -44,6 +44,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
44 file://arm-softfloat.patch \ 44 file://arm-softfloat.patch \
45 file://zecke-xgcc-cpp.patch \ 45 file://zecke-xgcc-cpp.patch \
46 file://gcc-poison-system-directories.patch \ 46 file://gcc-poison-system-directories.patch \
47 file://gcc-poison-dir-extend.patch \
47 file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \ 48 file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
48 file://64bithack.patch \ 49 file://64bithack.patch \
49 file://optional_libstdc.patch \ 50 file://optional_libstdc.patch \
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-dir-extend.patch
new file mode 100644
index 0000000000..d1712071a9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0/gcc-poison-dir-extend.patch
@@ -0,0 +1,24 @@
1Add /sw/include and /opt/include based on the original
2zecke-no-host-includes.patch patch. The original patch checked for
3/usr/include, /sw/include and /opt/include and then triggered a failure and
4aborted.
5
6Instead, we add the two missing items to the current scan. If the user
7wants this to be a failure, they can add "-Werror=poison-system-directories".
8
9Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
10
11diff -ur gcc-4.5.0.orig/gcc/incpath.c gcc-4.5.0/gcc/incpath.c
12--- gcc-4.5.0.orig/gcc/incpath.c 2010-09-29 14:58:31.358975524 -0500
13+++ gcc-4.5.0/gcc/incpath.c 2010-09-29 15:08:02.065975516 -0500
14@@ -363,7 +363,9 @@
15 {
16 if ((!strncmp (p->name, "/usr/include", 12))
17 || (!strncmp (p->name, "/usr/local/include", 18))
18- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
19+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
20+ || (!strncmp (p->name, "/sw/include", 11))
21+ || (!strncmp (p->name, "/opt/include", 12)))
22 warning (OPT_Wpoison_system_directories,
23 "include location \"%s\" is unsafe for "
24 "cross-compilation",
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
index e68a2de2a2..04043ff0b7 100644
--- 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
@@ -34,7 +34,7 @@ Index: gcc-4.5.0/gcc/common.opt
34 Warn when padding is required to align structure members 34 Warn when padding is required to align structure members
35 35
36+Wpoison-system-directories 36+Wpoison-system-directories
37+Common Var(flag_poison_system_directories) Init(1) 37+Common Var(flag_poison_system_directories) Init(1) Warning
38+Warn for -I and -L options using system directories if cross compiling 38+Warn for -I and -L options using system directories if cross compiling
39+ 39+
40 Wshadow 40 Wshadow
@@ -147,3 +147,55 @@ Index: gcc-4.5.0/gcc/incpath.c
147 } 147 }
148 148
149 /* Use given -I paths for #include "..." but not #include <...>, and 149 /* Use given -I paths for #include "..." but not #include <...>, and
150diff -ur gcc-4.5.0.orig/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in
151--- gcc-4.5.0.orig/gcc/Makefile.in 2010-09-29 17:13:49.164088845 -0500
152+++ gcc-4.5.0/gcc/Makefile.in 2010-09-29 18:48:19.300178501 -0500
153@@ -1965,7 +1965,7 @@
154
155 incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
156 intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
157- $(MACHMODE_H)
158+ $(MACHMODE_H) $(FLAGS_H) toplev.h
159
160 c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
161 $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
162diff -ur gcc-4.5.0.orig/gcc/configure gcc-4.5.0/gcc/configure
163--- gcc-4.5.0.orig/gcc/configure 2010-09-29 14:58:31.702054881 -0500
164+++ gcc-4.5.0/gcc/configure 2010-09-29 18:46:31.486068500 -0500
165@@ -913,6 +913,7 @@
166 enable_maintainer_mode
167 enable_version_specific_runtime_libs
168 with_slibdir
169+enable_poison_system_directories
170 enable_plugin
171 enable_target_optspace
172 '
173@@ -1621,6 +1622,8 @@
174 --enable-version-specific-runtime-libs
175 specify that runtime libraries should be
176 installed in a compiler-specific directory
177+ --enable-poison-system-directories
178+ warn for use of native system header directories
179 --enable-plugin enable plugin support
180
181 Optional Packages:
182@@ -25339,6 +25377,19 @@
183
184
185
186+# Check whether --enable-poison-system-directories was given.
187+if test "${enable_poison_system_directories+set}" = set; then :
188+ enableval=$enable_poison_system_directories;
189+else
190+ enable_poison_system_directories=no
191+fi
192+
193+if test "x${enable_poison_system_directories}" = "xyes"; then
194+
195+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
196+
197+fi
198+
199 # Substitute configuration variables
200
201
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/zecke-no-host-includes.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/zecke-no-host-includes.patch
deleted file mode 100644
index 4ccf35f627..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.0/zecke-no-host-includes.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1Index: gcc-4.4+svnr145550/gcc/incpath.c
2===================================================================
3--- gcc-4.4+svnr145550.orig/gcc/incpath.c 2009-04-04 13:48:31.000000000 -0700
4+++ gcc-4.4+svnr145550/gcc/incpath.c 2009-04-04 14:49:29.000000000 -0700
5@@ -417,6 +417,26 @@
6 p->construct = 0;
7 p->user_supplied_p = user_supplied_p;
8
9+#ifdef CROSS_COMPILE
10+ /* A common error when cross compiling is including
11+ host headers. This code below will try to fail fast
12+ for cross compiling. Currently we consider /usr/include,
13+ /opt/include and /sw/include as harmful. */
14+ {
15+ /* printf("Adding Path: %s\n", p->name ); */
16+ if( strstr(p->name, "/usr/include" ) == p->name ) {
17+ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name);
18+ abort();
19+ } else if( strstr(p->name, "/sw/include") == p->name ) {
20+ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name);
21+ abort();
22+ } else if( strstr(p->name, "/opt/include") == p->name ) {
23+ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name);
24+ abort();
25+ }
26+ }
27+#endif
28+
29 add_cpp_dir_path (p, chain);
30 }
31
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.5.0.bb b/meta/recipes-devtools/gcc/gcc-cross_4.5.0.bb
index 545beebd1a..7f67acf28d 100644
--- a/meta/recipes-devtools/gcc/gcc-cross_4.5.0.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.5.0.bb
@@ -3,8 +3,6 @@ PR = "r11"
3require gcc-${PV}.inc 3require gcc-${PV}.inc
4require gcc-cross4.inc 4require gcc-cross4.inc
5 5
6SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
7
8EXTRA_OECONF += "--disable-libunwind-exceptions \ 6EXTRA_OECONF += "--disable-libunwind-exceptions \
9 --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \ 7 --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
10 --with-system-zlib " 8 --with-system-zlib "