summaryrefslogtreecommitdiff
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)
downloadopenembedded-core-23f522e7a53821a8fb036e1aebddc7379d6f584e.tar.gz
openembedded-core-23f522e7a53821a8fb036e1aebddc7379d6f584e.tar.bz2
openembedded-core-23f522e7a53821a8fb036e1aebddc7379d6f584e.zip
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 \
file://arm-softfloat.patch \
file://zecke-xgcc-cpp.patch \
file://gcc-poison-system-directories.patch \
+ file://gcc-poison-dir-extend.patch \
file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
file://64bithack.patch \
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 @@
+Add /sw/include and /opt/include based on the original
+zecke-no-host-includes.patch patch. The original patch checked for
+/usr/include, /sw/include and /opt/include and then triggered a failure and
+aborted.
+
+Instead, we add the two missing items to the current scan. If the user
+wants this to be a failure, they can add "-Werror=poison-system-directories".
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+diff -ur gcc-4.5.0.orig/gcc/incpath.c gcc-4.5.0/gcc/incpath.c
+--- gcc-4.5.0.orig/gcc/incpath.c 2010-09-29 14:58:31.358975524 -0500
++++ gcc-4.5.0/gcc/incpath.c 2010-09-29 15:08:02.065975516 -0500
+@@ -363,7 +363,9 @@
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+- || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18))
++ || (!strncmp (p->name, "/sw/include", 11))
++ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "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
Warn when padding is required to align structure members
+Wpoison-system-directories
-+Common Var(flag_poison_system_directories) Init(1)
++Common Var(flag_poison_system_directories) Init(1) Warning
+Warn for -I and -L options using system directories if cross compiling
+
Wshadow
@@ -147,3 +147,55 @@ Index: gcc-4.5.0/gcc/incpath.c
}
/* Use given -I paths for #include "..." but not #include <...>, and
+diff -ur gcc-4.5.0.orig/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in
+--- gcc-4.5.0.orig/gcc/Makefile.in 2010-09-29 17:13:49.164088845 -0500
++++ gcc-4.5.0/gcc/Makefile.in 2010-09-29 18:48:19.300178501 -0500
+@@ -1965,7 +1965,7 @@
+
+ incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
+ intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
+- $(MACHMODE_H)
++ $(MACHMODE_H) $(FLAGS_H) toplev.h
+
+ c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
+diff -ur gcc-4.5.0.orig/gcc/configure gcc-4.5.0/gcc/configure
+--- gcc-4.5.0.orig/gcc/configure 2010-09-29 14:58:31.702054881 -0500
++++ gcc-4.5.0/gcc/configure 2010-09-29 18:46:31.486068500 -0500
+@@ -913,6 +913,7 @@
+ enable_maintainer_mode
+ enable_version_specific_runtime_libs
+ with_slibdir
++enable_poison_system_directories
+ enable_plugin
+ enable_target_optspace
+ '
+@@ -1621,6 +1622,8 @@
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be
+ installed in a compiler-specific directory
++ --enable-poison-system-directories
++ warn for use of native system header directories
+ --enable-plugin enable plugin support
+
+ Optional Packages:
+@@ -25339,6 +25377,19 @@
+
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
++
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
++
+ # Substitute configuration variables
+
+
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 @@
-Index: gcc-4.4+svnr145550/gcc/incpath.c
-===================================================================
---- gcc-4.4+svnr145550.orig/gcc/incpath.c 2009-04-04 13:48:31.000000000 -0700
-+++ gcc-4.4+svnr145550/gcc/incpath.c 2009-04-04 14:49:29.000000000 -0700
-@@ -417,6 +417,26 @@
- p->construct = 0;
- p->user_supplied_p = user_supplied_p;
-
-+#ifdef CROSS_COMPILE
-+ /* A common error when cross compiling is including
-+ host headers. This code below will try to fail fast
-+ for cross compiling. Currently we consider /usr/include,
-+ /opt/include and /sw/include as harmful. */
-+ {
-+ /* printf("Adding Path: %s\n", p->name ); */
-+ if( strstr(p->name, "/usr/include" ) == p->name ) {
-+ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name);
-+ abort();
-+ } else if( strstr(p->name, "/sw/include") == p->name ) {
-+ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name);
-+ abort();
-+ } else if( strstr(p->name, "/opt/include") == p->name ) {
-+ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name);
-+ abort();
-+ }
-+ }
-+#endif
-+
- add_cpp_dir_path (p, chain);
- }
-
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"
require gcc-${PV}.inc
require gcc-cross4.inc
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
-
EXTRA_OECONF += "--disable-libunwind-exceptions \
--with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
--with-system-zlib "