All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
@ 2010-07-08  5:39 Graham Gower
  2010-07-08  5:41 ` Graham Gower
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Graham Gower @ 2010-07-08  5:39 UTC (permalink / raw)
  To: openembedded-devel

This patch introduces a new command line parameter to gcc (at
Zecke's suggestion), -ibad, which may be used to specify
blacklisted include prefixes. E.g.

grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include

This makes it much easier to add new blacklisted include paths,
with a trivial edit to bitbake.conf. No additional paths have
been added yet, but my motivation for this was to add
/usr/X11R6/include and /usr/X11/include.

Please note that the bitbake.conf change will break builds with
versions of gcc that do not accept this -ibad parameter. I have
tested that the ibad patch applies to each of the gcc versions
in this patch, but only done functional tests for gcc-4.3.3 and
gcc-.4.1.

The following gcc versions may need attention:
3.3.3
3.3.4
svn
csl-arm-2007q3
csl-arm-2008q1
csl-arm-2008q3

3.3.x will require a completely reworked ibad patch. The others
should be compatible with one of the three ibad patches
included below.

-Graham

---
 conf/bitbake.conf                  |    8 ++-
 recipes/gcc/files/ibad-4.2.1.patch |  117 ++++++++++++++++++++++++++++++++++
 recipes/gcc/files/ibad-4.3.3.patch |  117 ++++++++++++++++++++++++++++++++++
 recipes/gcc/files/ibad-4.4.1.patch |  122 ++++++++++++++++++++++++++++++++++++
 recipes/gcc/gcc-3.4.4.inc          |    4 +-
 recipes/gcc/gcc-3.4.6.inc          |    1 -
 recipes/gcc/gcc-4.0.0.inc          |    1 -
 recipes/gcc/gcc-4.0.2.inc          |    2 -
 recipes/gcc/gcc-4.1.0.inc          |    4 +-
 recipes/gcc/gcc-cross_3.4.4.bb     |    4 +-
 recipes/gcc/gcc-cross_4.0.0.bb     |    4 +-
 recipes/gcc/gcc-cross_4.0.2.bb     |    4 +-
 recipes/gcc/gcc-cross_4.1.0.bb     |    4 +-
 recipes/gcc/gcc-cross_4.1.1.bb     |    4 +-
 recipes/gcc/gcc-cross_4.1.2.bb     |    4 +-
 recipes/gcc/gcc-cross_4.2.1.bb     |    4 +-
 recipes/gcc/gcc-cross_4.2.2.bb     |    4 +-
 recipes/gcc/gcc-cross_4.2.3.bb     |    4 +-
 recipes/gcc/gcc-cross_4.2.4.bb     |    4 +-
 recipes/gcc/gcc-cross_4.3.1.bb     |    4 +-
 recipes/gcc/gcc-cross_4.3.2.bb     |    4 +-
 recipes/gcc/gcc-cross_4.3.3.bb     |    4 +-
 recipes/gcc/gcc-cross_4.3.4.bb     |    4 +-
 recipes/gcc/gcc-cross_4.4.1.bb     |    4 +-
 recipes/gcc/gcc-cross_4.4.2.bb     |    4 +-
 recipes/gcc/gcc-cross_4.4.4.bb     |    4 +-
 recipes/gcc/gcc-cross_4.5.bb       |    4 +-
 27 files changed, 405 insertions(+), 43 deletions(-)
 create mode 100644 recipes/gcc/files/ibad-4.2.1.patch
 create mode 100644 recipes/gcc/files/ibad-4.3.3.patch
 create mode 100644 recipes/gcc/files/ibad-4.4.1.patch

diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index 0119294..93f8574 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -463,9 +463,15 @@ PATCHRESOLVE = 'noop'
 # Build flags and options.
 ##################################################################
 
+# We don't want cross builds to include these paths.
+BAD_HOST_INCDIRS = " \
+		-ibad /usr/include \
+		-ibad /sw/include \
+		-ibad /opt/include"
+
 export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
 export CPPFLAGS = "${TARGET_CPPFLAGS}"
-export TARGET_CPPFLAGS = "-isystem${STAGING_DIR_TARGET}${includedir}"
+export TARGET_CPPFLAGS = "-isystem${STAGING_DIR_TARGET}${includedir} ${BAD_HOST_INCDIRS}"
 export SDK_CPPFLAGS = "-isystem${STAGING_DIR_SDK}${includedir} -isystem${STAGING_DIR_HOST}${includedir}"
 
 export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
diff --git a/recipes/gcc/files/ibad-4.2.1.patch b/recipes/gcc/files/ibad-4.2.1.patch
new file mode 100644
index 0000000..a3a7ec3
--- /dev/null
+++ b/recipes/gcc/files/ibad-4.2.1.patch
@@ -0,0 +1,117 @@
+diff -ur gcc-4.2.1-orig/gcc/c-incpath.c gcc-4.2.1/gcc/c-incpath.c
+--- gcc-4.2.1-orig/gcc/c-incpath.c	2006-05-19 07:46:23.000000000 +0930
++++ gcc-4.2.1/gcc/c-incpath.c	2010-07-08 13:49:01.000000000 +0930
+@@ -57,8 +57,8 @@
+ 					   struct cpp_dir *, int);
+ 
+ /* Include chains heads and tails.  */
+-static struct cpp_dir *heads[4];
+-static struct cpp_dir *tails[4];
++static struct cpp_dir *heads[5];
++static struct cpp_dir *tails[5];
+ static bool quote_ignores_source_dir;
+ enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS };
+ 
+@@ -256,6 +256,32 @@
+   return head;
+ }
+ 
++/* Exit if paths in BAD are found in HEAD. */
++static void
++check_bad_includes (struct cpp_dir *head, struct cpp_dir *bad)
++{
++  struct cpp_dir *h, *b;
++  size_t len;
++
++  if (head == NULL)
++    return;
++
++  for (b = bad; b; b = b->next)
++    {
++      len = strlen(b->name);
++      for (h = head; h; h = h->next)
++        {
++          if (!strncmp(h->name, b->name, len))
++            {
++                fprintf(stderr,
++                          _("CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"),
++                          b->name, h->name);
++                exit(EXIT_FAILURE);
++            }
++        }
++    }
++}
++
+ /* Merge the four include chains together in the order quote, bracket,
+    system, after.  Remove duplicate dirs (as determined by
+    INO_T_EQ()).
+@@ -269,6 +295,13 @@
+ static void
+ merge_include_chains (cpp_reader *pfile, int verbose)
+ {
++  /* Exit if paths specified with -ibad are found in the include chain.
++     This must be done before inode duplicates are removed. */
++  check_bad_includes(heads[QUOTE], heads[BAD]);
++  check_bad_includes(heads[BRACKET], heads[BAD]);
++  check_bad_includes(heads[SYSTEM], heads[BAD]);
++  check_bad_includes(heads[AFTER], heads[BAD]);
++
+   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
+      resulting SYSTEM chain.  */
+   if (heads[SYSTEM])
+diff -ur gcc-4.2.1-orig/gcc/c-incpath.h gcc-4.2.1/gcc/c-incpath.h
+--- gcc-4.2.1-orig/gcc/c-incpath.h	2006-01-21 07:30:03.000000000 +1030
++++ gcc-4.2.1/gcc/c-incpath.h	2010-07-08 13:46:57.000000000 +0930
+@@ -30,4 +30,4 @@
+ 
+ extern struct target_c_incpath_s target_c_incpath;
+ 
+-enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
++enum { QUOTE = 0, BRACKET, SYSTEM, AFTER, BAD };
+diff -ur gcc-4.2.1-orig/gcc/c-opts.c gcc-4.2.1/gcc/c-opts.c
+--- gcc-4.2.1-orig/gcc/c-opts.c	2007-03-13 05:20:38.000000000 +1030
++++ gcc-4.2.1/gcc/c-opts.c	2010-07-08 13:46:57.000000000 +0930
+@@ -162,6 +162,7 @@
+ 
+     case OPT_F:
+     case OPT_I:
++    case OPT_ibad:
+     case OPT_idirafter:
+     case OPT_isysroot:
+     case OPT_isystem:
+@@ -815,6 +816,10 @@
+       flag_gen_declaration = 1;
+       break;
+ 
++    case OPT_ibad:
++      add_path (xstrdup (arg), BAD, 0, true);
++      break;
++
+     case OPT_idirafter:
+       add_path (xstrdup (arg), AFTER, 0, true);
+       break;
+diff -ur gcc-4.2.1-orig/gcc/c.opt gcc-4.2.1/gcc/c.opt
+--- gcc-4.2.1-orig/gcc/c.opt	2007-03-22 05:16:44.000000000 +1030
++++ gcc-4.2.1/gcc/c.opt	2010-07-08 13:46:57.000000000 +0930
+@@ -756,6 +756,10 @@
+ ObjC ObjC++
+ Dump declarations to a .decl file
+ 
++ibad
++C ObjC C++ ObjC++ Joined Separate
++-ibad <dir>	Abort if <dir> is specified in the include paths
++
+ idirafter
+ C ObjC C++ ObjC++ Joined Separate
+ -idirafter <dir>	Add <dir> to the end of the system include path
+diff -ur gcc-4.2.1-orig/gcc/gcc.h gcc-4.2.1/gcc/gcc.h
+--- gcc-4.2.1-orig/gcc/gcc.h	2006-01-17 05:30:56.000000000 +1030
++++ gcc-4.2.1/gcc/gcc.h	2010-07-08 13:46:57.000000000 +0930
+@@ -46,6 +46,7 @@
+  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
+   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
+   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
++  || !strcmp (STR, "ibad") \
+   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
+   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
+   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
diff --git a/recipes/gcc/files/ibad-4.3.3.patch b/recipes/gcc/files/ibad-4.3.3.patch
new file mode 100644
index 0000000..dfc1d10
--- /dev/null
+++ b/recipes/gcc/files/ibad-4.3.3.patch
@@ -0,0 +1,117 @@
+diff -ur gcc-4.3.3-orig/gcc/c-incpath.c gcc-4.3.3/gcc/c-incpath.c
+--- gcc-4.3.3-orig/gcc/c-incpath.c	2007-07-26 18:07:01.000000000 +0930
++++ gcc-4.3.3/gcc/c-incpath.c	2010-07-08 12:21:08.000000000 +0930
+@@ -58,8 +58,8 @@
+ 					   struct cpp_dir *, int);
+ 
+ /* Include chains heads and tails.  */
+-static struct cpp_dir *heads[4];
+-static struct cpp_dir *tails[4];
++static struct cpp_dir *heads[5];
++static struct cpp_dir *tails[5];
+ static bool quote_ignores_source_dir;
+ enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS };
+ 
+@@ -283,6 +283,32 @@
+   return head;
+ }
+ 
++/* Exit if paths in BAD are found in HEAD. */
++static void
++check_bad_includes (struct cpp_dir *head, struct cpp_dir *bad)
++{
++  struct cpp_dir *h, *b;
++  size_t len;
++
++  if (head == NULL)
++    return;
++
++  for (b = bad; b; b = b->next)
++    {
++      len = strlen(b->name);
++      for (h = head; h; h = h->next)
++        {
++          if (!strncmp(h->name, b->name, len))
++            {
++                fprintf(stderr,
++                          _("CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"),
++                          b->name, h->name);
++                exit(EXIT_FAILURE);
++            }
++        }
++    }
++}
++
+ /* Add SYSROOT to any user-supplied paths in CHAIN starting with
+    "=".  */
+ 
+@@ -318,6 +344,13 @@
+       add_sysroot_to_chain (sysroot, AFTER);
+     }
+ 
++  /* Exit if paths specified with -ibad are found in the include chain.
++     This must be done before inode duplicates are removed. */
++  check_bad_includes(heads[QUOTE], heads[BAD]);
++  check_bad_includes(heads[BRACKET], heads[BAD]);
++  check_bad_includes(heads[SYSTEM], heads[BAD]);
++  check_bad_includes(heads[AFTER], heads[BAD]);
++
+   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
+      resulting SYSTEM chain.  */
+   if (heads[SYSTEM])
+diff -ur gcc-4.3.3-orig/gcc/c-incpath.h gcc-4.3.3/gcc/c-incpath.h
+--- gcc-4.3.3-orig/gcc/c-incpath.h	2007-07-26 18:07:01.000000000 +0930
++++ gcc-4.3.3/gcc/c-incpath.h	2010-07-07 14:58:53.000000000 +0930
+@@ -30,4 +30,4 @@
+ 
+ extern struct target_c_incpath_s target_c_incpath;
+ 
+-enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
++enum { QUOTE = 0, BRACKET, SYSTEM, AFTER, BAD };
+diff -ur gcc-4.3.3-orig/gcc/c-opts.c gcc-4.3.3/gcc/c-opts.c
+--- gcc-4.3.3-orig/gcc/c-opts.c	2008-01-23 00:41:44.000000000 +1030
++++ gcc-4.3.3/gcc/c-opts.c	2010-07-08 09:31:23.000000000 +0930
+@@ -164,6 +164,7 @@
+ 
+     case OPT_F:
+     case OPT_I:
++    case OPT_ibad:
+     case OPT_idirafter:
+     case OPT_isysroot:
+     case OPT_isystem:
+@@ -848,6 +849,10 @@
+       set_struct_debug_option (arg);
+       break;
+ 
++    case OPT_ibad:
++      add_path (xstrdup (arg), BAD, 0, true);
++      break;
++
+     case OPT_idirafter:
+       add_path (xstrdup (arg), AFTER, 0, true);
+       break;
+diff -ur gcc-4.3.3-orig/gcc/c.opt gcc-4.3.3/gcc/c.opt
+--- gcc-4.3.3-orig/gcc/c.opt	2008-01-13 10:52:38.000000000 +1030
++++ gcc-4.3.3/gcc/c.opt	2010-07-07 14:57:21.000000000 +0930
+@@ -822,6 +822,10 @@
+ C ObjC C++ ObjC++ Joined
+ -femit-struct-debug-detailed=<spec-list>	Detailed reduced debug info for structs
+ 
++ibad
++C ObjC C++ ObjC++ Joined Separate
++-ibad <dir>	Abort if <dir> is specified in the include paths
++
+ idirafter
+ C ObjC C++ ObjC++ Joined Separate
+ -idirafter <dir>	Add <dir> to the end of the system include path
+diff -ur gcc-4.3.3-orig/gcc/gcc.h gcc-4.3.3/gcc/gcc.h
+--- gcc-4.3.3-orig/gcc/gcc.h	2007-07-26 18:07:01.000000000 +0930
++++ gcc-4.3.3/gcc/gcc.h	2010-07-08 09:26:17.000000000 +0930
+@@ -45,6 +45,7 @@
+  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
+   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
+   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
++  || !strcmp (STR, "ibad") \
+   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
+   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
+   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
diff --git a/recipes/gcc/files/ibad-4.4.1.patch b/recipes/gcc/files/ibad-4.4.1.patch
new file mode 100644
index 0000000..b52934b
--- /dev/null
+++ b/recipes/gcc/files/ibad-4.4.1.patch
@@ -0,0 +1,122 @@
+diff -ur gcc-4.4.1-orig/gcc/c-opts.c gcc-4.4.1/gcc/c-opts.c
+--- gcc-4.4.1-orig/gcc/c-opts.c	2009-02-18 12:46:03.000000000 +1030
++++ gcc-4.4.1/gcc/c-opts.c	2010-07-08 13:12:54.000000000 +0930
+@@ -161,6 +161,7 @@
+ 
+     case OPT_F:
+     case OPT_I:
++    case OPT_ibad:
+     case OPT_idirafter:
+     case OPT_isysroot:
+     case OPT_isystem:
+@@ -830,6 +831,10 @@
+       set_struct_debug_option (arg);
+       break;
+ 
++    case OPT_ibad:
++      add_path (xstrdup (arg), BAD, 0, true);
++      break;
++
+     case OPT_idirafter:
+       add_path (xstrdup (arg), AFTER, 0, true);
+       break;
+Only in gcc-4.4.1/gcc: c-opts.c~
+diff -ur gcc-4.4.1-orig/gcc/c.opt gcc-4.4.1/gcc/c.opt
+--- gcc-4.4.1-orig/gcc/c.opt	2009-03-19 07:44:53.000000000 +1030
++++ gcc-4.4.1/gcc/c.opt	2010-07-08 13:12:54.000000000 +0930
+@@ -841,6 +841,10 @@
+ C ObjC C++ ObjC++ Joined
+ -femit-struct-debug-detailed=<spec-list>	Detailed reduced debug info for structs
+ 
++ibad
++C ObjC C++ ObjC++ Joined Separate
++-ibad <dir>	Abort if <dir> is specified in the include paths
++
+ idirafter
+ C ObjC C++ ObjC++ Joined Separate
+ -idirafter <dir>	Add <dir> to the end of the system include path
+Only in gcc-4.4.1/gcc: c.opt~
+diff -ur gcc-4.4.1-orig/gcc/gcc.h gcc-4.4.1/gcc/gcc.h
+--- gcc-4.4.1-orig/gcc/gcc.h	2009-02-21 01:50:38.000000000 +1030
++++ gcc-4.4.1/gcc/gcc.h	2010-07-08 13:12:54.000000000 +0930
+@@ -46,6 +46,7 @@
+  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
+   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
+   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
++  || !strcmp (STR, "ibad") \
+   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
+   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
+   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
+Only in gcc-4.4.1/gcc: gcc.h~
+diff -ur gcc-4.4.1-orig/gcc/incpath.c gcc-4.4.1/gcc/incpath.c
+--- gcc-4.4.1-orig/gcc/incpath.c	2009-02-21 01:50:38.000000000 +1030
++++ gcc-4.4.1/gcc/incpath.c	2010-07-08 13:12:48.000000000 +0930
+@@ -60,8 +60,8 @@
+ 					   struct cpp_dir *, int);
+ 
+ /* Include chains heads and tails.  */
+-static struct cpp_dir *heads[4];
+-static struct cpp_dir *tails[4];
++static struct cpp_dir *heads[5];
++static struct cpp_dir *tails[5];
+ static bool quote_ignores_source_dir;
+ enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS };
+ 
+@@ -284,6 +284,32 @@
+   return head;
+ }
+ 
++/* Exit if paths in BAD are found in HEAD. */
++static void
++check_bad_includes (struct cpp_dir *head, struct cpp_dir *bad)
++{
++  struct cpp_dir *h, *b;
++  size_t len;
++
++  if (head == NULL)
++    return;
++
++  for (b = bad; b; b = b->next)
++    {
++      len = strlen(b->name);
++      for (h = head; h; h = h->next)
++        {
++          if (!strncmp(h->name, b->name, len))
++            {
++                fprintf(stderr,
++                          _("CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"),
++                          b->name, h->name);
++                exit(EXIT_FAILURE);
++            }
++        }
++    }
++}
++
+ /* Add SYSROOT to any user-supplied paths in CHAIN starting with
+    "=".  */
+ 
+@@ -319,6 +345,13 @@
+       add_sysroot_to_chain (sysroot, AFTER);
+     }
+ 
++  /* Exit if paths specified with -ibad are found in the include chain.
++     This must be done before inode duplicates are removed. */
++  check_bad_includes(heads[QUOTE], heads[BAD]);
++  check_bad_includes(heads[BRACKET], heads[BAD]);
++  check_bad_includes(heads[SYSTEM], heads[BAD]);
++  check_bad_includes(heads[AFTER], heads[BAD]);
++
+   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
+      resulting SYSTEM chain.  */
+   if (heads[SYSTEM])
+Only in gcc-4.4.1/gcc: incpath.c~
+diff -ur gcc-4.4.1-orig/gcc/incpath.h gcc-4.4.1/gcc/incpath.h
+--- gcc-4.4.1-orig/gcc/incpath.h	2009-02-21 01:50:38.000000000 +1030
++++ gcc-4.4.1/gcc/incpath.h	2010-07-08 13:12:54.000000000 +0930
+@@ -31,4 +31,4 @@
+ 
+ extern struct target_c_incpath_s target_c_incpath;
+ 
+-enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
++enum { QUOTE = 0, BRACKET, SYSTEM, AFTER, BAD };
+Only in gcc-4.4.1/gcc: incpath.h~
diff --git a/recipes/gcc/gcc-3.4.4.inc b/recipes/gcc/gcc-3.4.4.inc
index b63f59e..f749160 100644
--- a/recipes/gcc/gcc-3.4.4.inc
+++ b/recipes/gcc/gcc-3.4.4.inc
@@ -1,6 +1,6 @@
 require gcc-common.inc
 
-INC_PR = "r15"
+INC_PR = "r16"
 
 SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2;name=archive \
 	   file://gcc34-reverse-compare.patch \
@@ -26,7 +26,5 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2;name=archive \
 	   file://gcc-cross-fixincl.patch \
 	   file://gcc-posix-open-fix.patch \
 	   "
-SRC_URI_append = " file://zecke-no-host-includes.patch "
-
 SRC_URI[archive.md5sum] = "b594ff4ea4fbef4ba9220887de713dfe"
 SRC_URI[archive.sha256sum] = "3444179840638cb8664e8e53604900c4521d29d57785a5091202ee4937d8d0fd"
diff --git a/recipes/gcc/gcc-3.4.6.inc b/recipes/gcc/gcc-3.4.6.inc
index b6b01e3..171b54f 100644
--- a/recipes/gcc/gcc-3.4.6.inc
+++ b/recipes/gcc/gcc-3.4.6.inc
@@ -21,7 +21,6 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2;name=archive \
 
 SRC_URI += "file://gcc34-configure.in.patch"
 SRC_URI += "file://gcc34-thumb-support.patch"
-SRC_URI_append = " file://zecke-no-host-includes.patch "
 
 SRC_URI[archive.md5sum] = "4a21ac777d4b5617283ce488b808da7b"
 SRC_URI[archive.sha256sum] = "7791a601878b765669022b8b3409fba33cc72f9e39340fec8af6d0e6f72dec39"
diff --git a/recipes/gcc/gcc-4.0.0.inc b/recipes/gcc/gcc-4.0.0.inc
index dd48595..e16b388 100644
--- a/recipes/gcc/gcc-4.0.0.inc
+++ b/recipes/gcc/gcc-4.0.0.inc
@@ -6,7 +6,6 @@ NATIVEDEPS = "mpfr-native gmp-native"
 SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2;name=archive \
 	file://gcc-posix-open-fix.patch \
 	file://zecke-xgcc-cpp.patch"
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
 
 # Language Overrides
 FORTRAN = ",f95"
diff --git a/recipes/gcc/gcc-4.0.2.inc b/recipes/gcc/gcc-4.0.2.inc
index 16584ec..9eb25d7 100644
--- a/recipes/gcc/gcc-4.0.2.inc
+++ b/recipes/gcc/gcc-4.0.2.inc
@@ -21,8 +21,6 @@ SRC_URI_append = " file://100-uclibc-conf.patch   \
 		   file://gcc-4.0.2-atmel.0.99.2.patch \
 		   "
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
-
 # Language Overrides
 FORTRAN = ""
 
diff --git a/recipes/gcc/gcc-4.1.0.inc b/recipes/gcc/gcc-4.1.0.inc
index bfaf699..1e296fc 100644
--- a/recipes/gcc/gcc-4.1.0.inc
+++ b/recipes/gcc/gcc-4.1.0.inc
@@ -1,6 +1,6 @@
 require gcc-common.inc
 
-INC_PR = "r10"
+INC_PR = "r11"
 
 DEFAULT_PREFERENCE = "-1"
 
@@ -13,8 +13,6 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2;name=archive \
 	file://zecke-xgcc-cpp.patch \
     file://pr34130.patch"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
-
 EXTRA_OECONF_BASE = "--disable-libssp --disable-libmudflap"
 EXTRA_OECONF_INITIAL = "--disable-libmudflap --disable-libssp"
 EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap --disable-libssp"
diff --git a/recipes/gcc/gcc-cross_3.4.4.bb b/recipes/gcc/gcc-cross_3.4.4.bb
index 40ea603..d8199e4 100644
--- a/recipes/gcc/gcc-cross_3.4.4.bb
+++ b/recipes/gcc/gcc-cross_3.4.4.bb
@@ -1,4 +1,6 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross.inc
+
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
diff --git a/recipes/gcc/gcc-cross_4.0.0.bb b/recipes/gcc/gcc-cross_4.0.0.bb
index 2ab9ef4..7b57648 100644
--- a/recipes/gcc/gcc-cross_4.0.0.bb
+++ b/recipes/gcc/gcc-cross_4.0.0.bb
@@ -1,4 +1,6 @@
-PR = "r9"
+PR = "r10"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
+
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
diff --git a/recipes/gcc/gcc-cross_4.0.2.bb b/recipes/gcc/gcc-cross_4.0.2.bb
index 1294af5..4c2997c 100644
--- a/recipes/gcc/gcc-cross_4.0.2.bb
+++ b/recipes/gcc/gcc-cross_4.0.2.bb
@@ -1,4 +1,6 @@
-PR = "r15"
+PR = "r16"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
+
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
diff --git a/recipes/gcc/gcc-cross_4.1.0.bb b/recipes/gcc/gcc-cross_4.1.0.bb
index 39ad5fe..5e9df67 100644
--- a/recipes/gcc/gcc-cross_4.1.0.bb
+++ b/recipes/gcc/gcc-cross_4.1.0.bb
@@ -1,7 +1,9 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
+
 EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.1.1.bb b/recipes/gcc/gcc-cross_4.1.1.bb
index 1864078..606a4cb 100644
--- a/recipes/gcc/gcc-cross_4.1.1.bb
+++ b/recipes/gcc/gcc-cross_4.1.1.bb
@@ -1,8 +1,8 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
 
 EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
diff --git a/recipes/gcc/gcc-cross_4.1.2.bb b/recipes/gcc/gcc-cross_4.1.2.bb
index d2038c7..7431368 100644
--- a/recipes/gcc/gcc-cross_4.1.2.bb
+++ b/recipes/gcc/gcc-cross_4.1.2.bb
@@ -1,9 +1,9 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
 
 EXTRA_OECONF_append_avr32= "  --disable-libmudflap "
 
diff --git a/recipes/gcc/gcc-cross_4.2.1.bb b/recipes/gcc/gcc-cross_4.2.1.bb
index ae7f2b7..e6a14aa 100644
--- a/recipes/gcc/gcc-cross_4.2.1.bb
+++ b/recipes/gcc/gcc-cross_4.2.1.bb
@@ -1,9 +1,9 @@
-PR = "r21"
+PR = "r22"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
 
 EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.2.2.bb b/recipes/gcc/gcc-cross_4.2.2.bb
index 30c1d78..272610a 100644
--- a/recipes/gcc/gcc-cross_4.2.2.bb
+++ b/recipes/gcc/gcc-cross_4.2.2.bb
@@ -1,9 +1,9 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
 
 EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.2.3.bb b/recipes/gcc/gcc-cross_4.2.3.bb
index 13dec27..4f2cea1 100644
--- a/recipes/gcc/gcc-cross_4.2.3.bb
+++ b/recipes/gcc/gcc-cross_4.2.3.bb
@@ -1,9 +1,9 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
 
 EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.2.4.bb b/recipes/gcc/gcc-cross_4.2.4.bb
index 13dec27..4f2cea1 100644
--- a/recipes/gcc/gcc-cross_4.2.4.bb
+++ b/recipes/gcc/gcc-cross_4.2.4.bb
@@ -1,9 +1,9 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.2.1.patch "
 
 EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.3.1.bb b/recipes/gcc/gcc-cross_4.3.1.bb
index 1c191fa..672a892 100644
--- a/recipes/gcc/gcc-cross_4.3.1.bb
+++ b/recipes/gcc/gcc-cross_4.3.1.bb
@@ -1,9 +1,9 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch "
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.3.2.bb b/recipes/gcc/gcc-cross_4.3.2.bb
index 322a203..19407b0 100644
--- a/recipes/gcc/gcc-cross_4.3.2.bb
+++ b/recipes/gcc/gcc-cross_4.3.2.bb
@@ -1,8 +1,8 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch "
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.3.3.bb b/recipes/gcc/gcc-cross_4.3.3.bb
index c8e2f9b..20440cc 100644
--- a/recipes/gcc/gcc-cross_4.3.3.bb
+++ b/recipes/gcc/gcc-cross_4.3.3.bb
@@ -1,8 +1,8 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch "
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.3.4.bb b/recipes/gcc/gcc-cross_4.3.4.bb
index 7edb21b..69fa142 100644
--- a/recipes/gcc/gcc-cross_4.3.4.bb
+++ b/recipes/gcc/gcc-cross_4.3.4.bb
@@ -1,8 +1,8 @@
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch "
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.4.1.bb b/recipes/gcc/gcc-cross_4.4.1.bb
index fce459b..5a8ebb8 100644
--- a/recipes/gcc/gcc-cross_4.4.1.bb
+++ b/recipes/gcc/gcc-cross_4.4.1.bb
@@ -1,8 +1,8 @@
 require gcc-${PV}.inc
 require gcc-cross4.inc
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch "
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.4.2.bb b/recipes/gcc/gcc-cross_4.4.2.bb
index fce459b..5a8ebb8 100644
--- a/recipes/gcc/gcc-cross_4.4.2.bb
+++ b/recipes/gcc/gcc-cross_4.4.2.bb
@@ -1,8 +1,8 @@
 require gcc-${PV}.inc
 require gcc-cross4.inc
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch "
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.4.4.bb b/recipes/gcc/gcc-cross_4.4.4.bb
index 4309fd4..d069bd6 100644
--- a/recipes/gcc/gcc-cross_4.4.4.bb
+++ b/recipes/gcc/gcc-cross_4.4.4.bb
@@ -1,8 +1,8 @@
 require gcc-${PV}.inc
 require gcc-cross4.inc
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch "
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
diff --git a/recipes/gcc/gcc-cross_4.5.bb b/recipes/gcc/gcc-cross_4.5.bb
index a2da4a8..82ff1ae 100644
--- a/recipes/gcc/gcc-cross_4.5.bb
+++ b/recipes/gcc/gcc-cross_4.5.bb
@@ -1,9 +1,9 @@
-PR = "r1"
+PR = "r2"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
 NATIVEDEPS += "libmpc-native libelf-native"
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch "
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} --with-system-zlib"
 
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
@ 2010-07-08  5:41 ` Graham Gower
  2010-07-08 10:01 ` Koen Kooi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Graham Gower @ 2010-07-08  5:41 UTC (permalink / raw)
  To: openembedded-devel

> Please note that the bitbake.conf change will break builds with
> versions of gcc that do not accept this -ibad parameter. I have
> tested that the ibad patch applies to each of the gcc versions
> in this patch, but only done functional tests for gcc-4.3.3 and
> gcc-.4.1.

That should be gcc-4.3.3 and gcc-4.4.1.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
  2010-07-08  5:41 ` Graham Gower
@ 2010-07-08 10:01 ` Koen Kooi
  2010-07-08 10:56   ` Graham Gower
  2010-07-08 15:36 ` Holger Freyther
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Koen Kooi @ 2010-07-08 10:01 UTC (permalink / raw)
  To: openembedded-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08-07-10 07:39, Graham Gower wrote:
> This patch introduces a new command line parameter to gcc (at
> Zecke's suggestion), -ibad

It gets bonus point for being an obscure Dune reference :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFMNaHwMkyGM64RGpERAjBdAJ9p7NscxVpFywRGncv7096IuWAnNgCeMCwR
8k4tXeQKH5hRccEF+KN8e0U=
=vHwm
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for  zecke-no-host-includes.patch.
  2010-07-08 10:01 ` Koen Kooi
@ 2010-07-08 10:56   ` Graham Gower
  2010-07-08 12:12     ` Koen Kooi
  0 siblings, 1 reply; 13+ messages in thread
From: Graham Gower @ 2010-07-08 10:56 UTC (permalink / raw)
  To: openembedded-devel

On 8 July 2010 19:31, Koen Kooi <k.kooi@student.utwente.nl> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 08-07-10 07:39, Graham Gower wrote:
>> This patch introduces a new command line parameter to gcc (at
>> Zecke's suggestion), -ibad
>
> It gets bonus point for being an obscure Dune reference :)

I think I lose the bonus points, as I don't understand the reference :(



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08 10:56   ` Graham Gower
@ 2010-07-08 12:12     ` Koen Kooi
  0 siblings, 0 replies; 13+ messages in thread
From: Koen Kooi @ 2010-07-08 12:12 UTC (permalink / raw)
  To: openembedded-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08-07-10 12:56, Graham Gower wrote:
> On 8 July 2010 19:31, Koen Kooi <k.kooi@student.utwente.nl> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 08-07-10 07:39, Graham Gower wrote:
>>> This patch introduces a new command line parameter to gcc (at
>>> Zecke's suggestion), -ibad
>>
>> It gets bonus point for being an obscure Dune reference :)
> 
> I think I lose the bonus points, as I don't understand the reference :(

http://dunepedia.wetpaint.com/page/Eyes+of+the+Ibad
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFMNcCQMkyGM64RGpERAq+wAJ9epmSlI1cQcj+wWIvTwMlF7324FQCfRoTd
z30/JoyHoH6KpeKLAt/G3Ek=
=vyka
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
  2010-07-08  5:41 ` Graham Gower
  2010-07-08 10:01 ` Koen Kooi
@ 2010-07-08 15:36 ` Holger Freyther
  2010-07-09  9:41   ` Phil Blundell
  2010-07-09 10:44   ` Richard Purdie
  2010-07-08 17:21 ` Denys Dmytriyenko
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 13+ messages in thread
From: Holger Freyther @ 2010-07-08 15:36 UTC (permalink / raw)
  To: openembedded-devel

On 07/08/2010 01:39 PM, Graham Gower wrote:
> This patch introduces a new command line parameter to gcc (at
> Zecke's suggestion), -ibad, which may be used to specify
> blacklisted include prefixes. E.g.
> 
> grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
> CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include

nice! The only thing that is worrying is the question how we make sure
these bad path's are enforced.

E.g. a recipe not honoring our CPPFLAGS might silently pass this check
(while before it was hardcoded into the compiler). My proposal would be
to extend the sanity check and grep the compile log for gcc and -ibad
and fail if gcc exists but -ibad does not occur?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
                   ` (2 preceding siblings ...)
  2010-07-08 15:36 ` Holger Freyther
@ 2010-07-08 17:21 ` Denys Dmytriyenko
  2010-07-10  6:57   ` Graham Gower
  2010-07-08 21:00 ` Khem Raj
  2010-07-13  2:27 ` [PATCH] gcc: badness " Graham Gower
  5 siblings, 1 reply; 13+ messages in thread
From: Denys Dmytriyenko @ 2010-07-08 17:21 UTC (permalink / raw)
  To: openembedded-devel

On Thu, Jul 08, 2010 at 03:09:01PM +0930, Graham Gower wrote:
> This patch introduces a new command line parameter to gcc (at
> Zecke's suggestion), -ibad, which may be used to specify
> blacklisted include prefixes. E.g.
> 
> grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
> CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include
> 
> This makes it much easier to add new blacklisted include paths,
> with a trivial edit to bitbake.conf. No additional paths have
> been added yet, but my motivation for this was to add
> /usr/X11R6/include and /usr/X11/include.
> 
> Please note that the bitbake.conf change will break builds with
> versions of gcc that do not accept this -ibad parameter. I have

Does it mean any external toolchain will be broken or require changes to the 
bitbake.conf?

-- 
Denys

> tested that the ibad patch applies to each of the gcc versions
> in this patch, but only done functional tests for gcc-4.3.3 and
> gcc-.4.1.
> 
> The following gcc versions may need attention:
> 3.3.3
> 3.3.4
> svn
> csl-arm-2007q3
> csl-arm-2008q1
> csl-arm-2008q3
> 
> 3.3.x will require a completely reworked ibad patch. The others
> should be compatible with one of the three ibad patches
> included below.
> 
> -Graham



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for  zecke-no-host-includes.patch.
  2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
                   ` (3 preceding siblings ...)
  2010-07-08 17:21 ` Denys Dmytriyenko
@ 2010-07-08 21:00 ` Khem Raj
  2010-07-13  2:27 ` [PATCH] gcc: badness " Graham Gower
  5 siblings, 0 replies; 13+ messages in thread
From: Khem Raj @ 2010-07-08 21:00 UTC (permalink / raw)
  To: openembedded-devel

On Wed, Jul 7, 2010 at 10:39 PM, Graham Gower <graham.gower@gmail.com> wrote:
> This patch introduces a new command line parameter to gcc (at
> Zecke's suggestion), -ibad, which may be used to specify
> blacklisted include prefixes. E.g.
>
> grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
> CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include
>
> This makes it much easier to add new blacklisted include paths,
> with a trivial edit to bitbake.conf. No additional paths have
> been added yet, but my motivation for this was to add
> /usr/X11R6/include and /usr/X11/include.
>
> Please note that the bitbake.conf change will break builds with
> versions of gcc that do not accept this -ibad parameter. I have
> tested that the ibad patch applies to each of the gcc versions
> in this patch, but only done functional tests for gcc-4.3.3 and
> gcc-.4.1.
>
> The following gcc versions may need attention:
> 3.3.3
> 3.3.4
> svn
> csl-arm-2007q3
> csl-arm-2008q1
> csl-arm-2008q3
>

csl already has a similar feature and its turned on by default but IIRC
its only a warning which can be turned off by -Wno-poison-system-directories
I am interested in patching svn others not so much in above lis

> 3.3.x will require a completely reworked ibad patch. The others
> should be compatible with one of the three ibad patches
> included below.
>
> -Graham
>



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08 15:36 ` Holger Freyther
@ 2010-07-09  9:41   ` Phil Blundell
  2010-07-09 10:44   ` Richard Purdie
  1 sibling, 0 replies; 13+ messages in thread
From: Phil Blundell @ 2010-07-09  9:41 UTC (permalink / raw)
  To: openembedded-devel

On Thu, 2010-07-08 at 23:36 +0800, Holger Freyther wrote:
> E.g. a recipe not honoring our CPPFLAGS might silently pass this check
> (while before it was hardcoded into the compiler). My proposal would be
> to extend the sanity check and grep the compile log for gcc and -ibad
> and fail if gcc exists but -ibad does not occur?

That sounds a bit fragile too.  How about just adding the -ibad flags to
${CC} rather than putting them in CPPFLAGS?  Only the most determined
package is likely to be able to build without using our value for CC.

Failing that, I guess the original approach of patching the compiler is
actually the better one, inelegant though it might seem.

p.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch.
  2010-07-08 15:36 ` Holger Freyther
  2010-07-09  9:41   ` Phil Blundell
@ 2010-07-09 10:44   ` Richard Purdie
  2010-07-10  7:04     ` Graham Gower
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Purdie @ 2010-07-09 10:44 UTC (permalink / raw)
  To: openembedded-devel

On Thu, 2010-07-08 at 23:36 +0800, Holger Freyther wrote:
> On 07/08/2010 01:39 PM, Graham Gower wrote:
> > This patch introduces a new command line parameter to gcc (at
> > Zecke's suggestion), -ibad, which may be used to specify
> > blacklisted include prefixes. E.g.
> > 
> > grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
> > CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include
> 
> nice! The only thing that is worrying is the question how we make sure
> these bad path's are enforced.
> 
> E.g. a recipe not honoring our CPPFLAGS might silently pass this check
> (while before it was hardcoded into the compiler). My proposal would be
> to extend the sanity check and grep the compile log for gcc and -ibad
> and fail if gcc exists but -ibad does not occur?

How about making this option an environmental variable rather than a
flag? I've seen that technique used to great effect for this exact
reason before...

Cheers,

Richard




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for  zecke-no-host-includes.patch.
  2010-07-08 17:21 ` Denys Dmytriyenko
@ 2010-07-10  6:57   ` Graham Gower
  0 siblings, 0 replies; 13+ messages in thread
From: Graham Gower @ 2010-07-10  6:57 UTC (permalink / raw)
  To: openembedded-devel

On 9 July 2010 02:51, Denys Dmytriyenko <denis@denix.org> wrote:
> On Thu, Jul 08, 2010 at 03:09:01PM +0930, Graham Gower wrote:
>> This patch introduces a new command line parameter to gcc (at
>> Zecke's suggestion), -ibad, which may be used to specify
>> blacklisted include prefixes. E.g.
>>
>> grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
>> CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include
>>
>> This makes it much easier to add new blacklisted include paths,
>> with a trivial edit to bitbake.conf. No additional paths have
>> been added yet, but my motivation for this was to add
>> /usr/X11R6/include and /usr/X11/include.
>>
>> Please note that the bitbake.conf change will break builds with
>> versions of gcc that do not accept this -ibad parameter. I have
>
> Does it mean any external toolchain will be broken or require changes to the
> bitbake.conf?

Yes.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Badness with -ibad, a replacement for  zecke-no-host-includes.patch.
  2010-07-09 10:44   ` Richard Purdie
@ 2010-07-10  7:04     ` Graham Gower
  0 siblings, 0 replies; 13+ messages in thread
From: Graham Gower @ 2010-07-10  7:04 UTC (permalink / raw)
  To: openembedded-devel

On 9 July 2010 20:14, Richard Purdie <rpurdie@rpsys.net> wrote:
> On Thu, 2010-07-08 at 23:36 +0800, Holger Freyther wrote:
>> On 07/08/2010 01:39 PM, Graham Gower wrote:
>> > This patch introduces a new command line parameter to gcc (at
>> > Zecke's suggestion), -ibad, which may be used to specify
>> > blacklisted include prefixes. E.g.
>> >
>> > grg@eye7:/tmp$ ~/oe2/tmp/cross/mipsel/bin/mipsel-angstrom-linux-gcc -c test.c -ibad /usr/include -I /usr/include
>> > CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include
>>
>> nice! The only thing that is worrying is the question how we make sure
>> these bad path's are enforced.
>>
>> E.g. a recipe not honoring our CPPFLAGS might silently pass this check
>> (while before it was hardcoded into the compiler). My proposal would be
>> to extend the sanity check and grep the compile log for gcc and -ibad
>> and fail if gcc exists but -ibad does not occur?

I haven't tried this, but I suspect it wouldn't be too difficult to
put them into gcc's default spec file.
That would fix the problem of breaking things for an external toolchain too.

>
> How about making this option an environmental variable rather than a
> flag? I've seen that technique used to great effect for this exact
> reason before...

That would work too.

-Graham



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] gcc: badness with -ibad, a replacement for zecke-no-host-includes.patch
  2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
                   ` (4 preceding siblings ...)
  2010-07-08 21:00 ` Khem Raj
@ 2010-07-13  2:27 ` Graham Gower
  5 siblings, 0 replies; 13+ messages in thread
From: Graham Gower @ 2010-07-13  2:27 UTC (permalink / raw)
  To: openembedded-devel

Subject: [PATCH] gcc: badness with -ibad, a replacement for zecke-no-host-includes.patch

This change makes it significantly easier to add new blacklisted include
paths by introducing a new command line parameter to gcc, -ibad, which
may be used to specify blacklisted include prefixes. A list of bad
include paths are provided in gcc's default specs file and may be modified
by editing ibad-specs.sed.

Signed-off-by: Graham Gower <graham.gower@gmail.com>
---

This version addresses previous concerns regarding bitbake.conf changes
breaking toolchains without -ibad support and the enforcement of the
-ibad flags for recipes which may break CPPFLAGS.

If it is desired that an environment variable be used for additional
flags, this could be supported in the spec file with %:getenv(), see
http://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html

I've only provided patches against recent gcc versions, but older versions
should work fine too, with the ibad-4.2.1.patch previously posted. I
confirmed that ibad-4.6.patch applies correctly to gcc from svn, but was
unable to test due to an unrelated patch failing (gcc-flags-for-build.patch).

---
 recipes/gcc/files/ibad-4.3.3.patch |  117 ++++++++++++++++++++++++++++++++++
 recipes/gcc/files/ibad-4.4.1.patch |  117 ++++++++++++++++++++++++++++++++++
 recipes/gcc/files/ibad-4.6.patch   |  122 ++++++++++++++++++++++++++++++++++++
 recipes/gcc/files/ibad-specs.sed   |    9 +++
 recipes/gcc/gcc-cross_4.3.1.bb     |   11 +++-
 recipes/gcc/gcc-cross_4.3.2.bb     |   12 +++-
 recipes/gcc/gcc-cross_4.3.3.bb     |   11 +++-
 recipes/gcc/gcc-cross_4.3.4.bb     |   11 +++-
 recipes/gcc/gcc-cross_4.4.1.bb     |   11 +++-
 recipes/gcc/gcc-cross_4.4.2.bb     |   11 +++-
 recipes/gcc/gcc-cross_4.4.4.bb     |   12 +++-
 recipes/gcc/gcc-cross_4.5.bb       |   12 +++-
 recipes/gcc/gcc-cross_svn.bb       |   12 +++-
 13 files changed, 450 insertions(+), 18 deletions(-)
 create mode 100644 recipes/gcc/files/ibad-4.3.3.patch
 create mode 100644 recipes/gcc/files/ibad-4.4.1.patch
 create mode 100644 recipes/gcc/files/ibad-4.6.patch
 create mode 100644 recipes/gcc/files/ibad-specs.sed

diff --git a/recipes/gcc/files/ibad-4.3.3.patch b/recipes/gcc/files/ibad-4.3.3.patch
new file mode 100644
index 0000000..dfc1d10
--- /dev/null
+++ b/recipes/gcc/files/ibad-4.3.3.patch
@@ -0,0 +1,117 @@
+diff -ur gcc-4.3.3-orig/gcc/c-incpath.c gcc-4.3.3/gcc/c-incpath.c
+--- gcc-4.3.3-orig/gcc/c-incpath.c	2007-07-26 18:07:01.000000000 +0930
++++ gcc-4.3.3/gcc/c-incpath.c	2010-07-08 12:21:08.000000000 +0930
+@@ -58,8 +58,8 @@
+ 					   struct cpp_dir *, int);
+ 
+ /* Include chains heads and tails.  */
+-static struct cpp_dir *heads[4];
+-static struct cpp_dir *tails[4];
++static struct cpp_dir *heads[5];
++static struct cpp_dir *tails[5];
+ static bool quote_ignores_source_dir;
+ enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS };
+ 
+@@ -283,6 +283,32 @@
+   return head;
+ }
+ 
++/* Exit if paths in BAD are found in HEAD. */
++static void
++check_bad_includes (struct cpp_dir *head, struct cpp_dir *bad)
++{
++  struct cpp_dir *h, *b;
++  size_t len;
++
++  if (head == NULL)
++    return;
++
++  for (b = bad; b; b = b->next)
++    {
++      len = strlen(b->name);
++      for (h = head; h; h = h->next)
++        {
++          if (!strncmp(h->name, b->name, len))
++            {
++                fprintf(stderr,
++                          _("CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"),
++                          b->name, h->name);
++                exit(EXIT_FAILURE);
++            }
++        }
++    }
++}
++
+ /* Add SYSROOT to any user-supplied paths in CHAIN starting with
+    "=".  */
+ 
+@@ -318,6 +344,13 @@
+       add_sysroot_to_chain (sysroot, AFTER);
+     }
+ 
++  /* Exit if paths specified with -ibad are found in the include chain.
++     This must be done before inode duplicates are removed. */
++  check_bad_includes(heads[QUOTE], heads[BAD]);
++  check_bad_includes(heads[BRACKET], heads[BAD]);
++  check_bad_includes(heads[SYSTEM], heads[BAD]);
++  check_bad_includes(heads[AFTER], heads[BAD]);
++
+   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
+      resulting SYSTEM chain.  */
+   if (heads[SYSTEM])
+diff -ur gcc-4.3.3-orig/gcc/c-incpath.h gcc-4.3.3/gcc/c-incpath.h
+--- gcc-4.3.3-orig/gcc/c-incpath.h	2007-07-26 18:07:01.000000000 +0930
++++ gcc-4.3.3/gcc/c-incpath.h	2010-07-07 14:58:53.000000000 +0930
+@@ -30,4 +30,4 @@
+ 
+ extern struct target_c_incpath_s target_c_incpath;
+ 
+-enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
++enum { QUOTE = 0, BRACKET, SYSTEM, AFTER, BAD };
+diff -ur gcc-4.3.3-orig/gcc/c-opts.c gcc-4.3.3/gcc/c-opts.c
+--- gcc-4.3.3-orig/gcc/c-opts.c	2008-01-23 00:41:44.000000000 +1030
++++ gcc-4.3.3/gcc/c-opts.c	2010-07-08 09:31:23.000000000 +0930
+@@ -164,6 +164,7 @@
+ 
+     case OPT_F:
+     case OPT_I:
++    case OPT_ibad:
+     case OPT_idirafter:
+     case OPT_isysroot:
+     case OPT_isystem:
+@@ -848,6 +849,10 @@
+       set_struct_debug_option (arg);
+       break;
+ 
++    case OPT_ibad:
++      add_path (xstrdup (arg), BAD, 0, true);
++      break;
++
+     case OPT_idirafter:
+       add_path (xstrdup (arg), AFTER, 0, true);
+       break;
+diff -ur gcc-4.3.3-orig/gcc/c.opt gcc-4.3.3/gcc/c.opt
+--- gcc-4.3.3-orig/gcc/c.opt	2008-01-13 10:52:38.000000000 +1030
++++ gcc-4.3.3/gcc/c.opt	2010-07-07 14:57:21.000000000 +0930
+@@ -822,6 +822,10 @@
+ C ObjC C++ ObjC++ Joined
+ -femit-struct-debug-detailed=<spec-list>	Detailed reduced debug info for structs
+ 
++ibad
++C ObjC C++ ObjC++ Joined Separate
++-ibad <dir>	Abort if <dir> is specified in the include paths
++
+ idirafter
+ C ObjC C++ ObjC++ Joined Separate
+ -idirafter <dir>	Add <dir> to the end of the system include path
+diff -ur gcc-4.3.3-orig/gcc/gcc.h gcc-4.3.3/gcc/gcc.h
+--- gcc-4.3.3-orig/gcc/gcc.h	2007-07-26 18:07:01.000000000 +0930
++++ gcc-4.3.3/gcc/gcc.h	2010-07-08 09:26:17.000000000 +0930
+@@ -45,6 +45,7 @@
+  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
+   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
+   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
++  || !strcmp (STR, "ibad") \
+   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
+   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
+   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
diff --git a/recipes/gcc/files/ibad-4.4.1.patch b/recipes/gcc/files/ibad-4.4.1.patch
new file mode 100644
index 0000000..b268989
--- /dev/null
+++ b/recipes/gcc/files/ibad-4.4.1.patch
@@ -0,0 +1,117 @@
+diff -ur gcc-4.4.1-orig/gcc/c-opts.c gcc-4.4.1/gcc/c-opts.c
+--- gcc-4.4.1-orig/gcc/c-opts.c	2009-02-18 12:46:03.000000000 +1030
++++ gcc-4.4.1/gcc/c-opts.c	2010-07-08 13:12:54.000000000 +0930
+@@ -161,6 +161,7 @@
+ 
+     case OPT_F:
+     case OPT_I:
++    case OPT_ibad:
+     case OPT_idirafter:
+     case OPT_isysroot:
+     case OPT_isystem:
+@@ -830,6 +831,10 @@
+       set_struct_debug_option (arg);
+       break;
+ 
++    case OPT_ibad:
++      add_path (xstrdup (arg), BAD, 0, true);
++      break;
++
+     case OPT_idirafter:
+       add_path (xstrdup (arg), AFTER, 0, true);
+       break;
+diff -ur gcc-4.4.1-orig/gcc/c.opt gcc-4.4.1/gcc/c.opt
+--- gcc-4.4.1-orig/gcc/c.opt	2009-03-19 07:44:53.000000000 +1030
++++ gcc-4.4.1/gcc/c.opt	2010-07-08 13:12:54.000000000 +0930
+@@ -841,6 +841,10 @@
+ C ObjC C++ ObjC++ Joined
+ -femit-struct-debug-detailed=<spec-list>	Detailed reduced debug info for structs
+ 
++ibad
++C ObjC C++ ObjC++ Joined Separate
++-ibad <dir>	Abort if <dir> is specified in the include paths
++
+ idirafter
+ C ObjC C++ ObjC++ Joined Separate
+ -idirafter <dir>	Add <dir> to the end of the system include path
+diff -ur gcc-4.4.1-orig/gcc/gcc.h gcc-4.4.1/gcc/gcc.h
+--- gcc-4.4.1-orig/gcc/gcc.h	2009-02-21 01:50:38.000000000 +1030
++++ gcc-4.4.1/gcc/gcc.h	2010-07-08 13:12:54.000000000 +0930
+@@ -46,6 +46,7 @@
+  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
+   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
+   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
++  || !strcmp (STR, "ibad") \
+   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
+   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
+   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
+diff -ur gcc-4.4.1-orig/gcc/incpath.c gcc-4.4.1/gcc/incpath.c
+--- gcc-4.4.1-orig/gcc/incpath.c	2009-02-21 01:50:38.000000000 +1030
++++ gcc-4.4.1/gcc/incpath.c	2010-07-08 13:12:48.000000000 +0930
+@@ -60,8 +60,8 @@
+ 					   struct cpp_dir *, int);
+ 
+ /* Include chains heads and tails.  */
+-static struct cpp_dir *heads[4];
+-static struct cpp_dir *tails[4];
++static struct cpp_dir *heads[5];
++static struct cpp_dir *tails[5];
+ static bool quote_ignores_source_dir;
+ enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS };
+ 
+@@ -284,6 +284,32 @@
+   return head;
+ }
+ 
++/* Exit if paths in BAD are found in HEAD. */
++static void
++check_bad_includes (struct cpp_dir *head, struct cpp_dir *bad)
++{
++  struct cpp_dir *h, *b;
++  size_t len;
++
++  if (head == NULL)
++    return;
++
++  for (b = bad; b; b = b->next)
++    {
++      len = strlen(b->name);
++      for (h = head; h; h = h->next)
++        {
++          if (!strncmp(h->name, b->name, len))
++            {
++                fprintf(stderr,
++                          _("CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"),
++                          b->name, h->name);
++                exit(EXIT_FAILURE);
++            }
++        }
++    }
++}
++
+ /* Add SYSROOT to any user-supplied paths in CHAIN starting with
+    "=".  */
+ 
+@@ -319,6 +345,13 @@
+       add_sysroot_to_chain (sysroot, AFTER);
+     }
+ 
++  /* Exit if paths specified with -ibad are found in the include chain.
++     This must be done before inode duplicates are removed. */
++  check_bad_includes(heads[QUOTE], heads[BAD]);
++  check_bad_includes(heads[BRACKET], heads[BAD]);
++  check_bad_includes(heads[SYSTEM], heads[BAD]);
++  check_bad_includes(heads[AFTER], heads[BAD]);
++
+   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
+      resulting SYSTEM chain.  */
+   if (heads[SYSTEM])
+diff -ur gcc-4.4.1-orig/gcc/incpath.h gcc-4.4.1/gcc/incpath.h
+--- gcc-4.4.1-orig/gcc/incpath.h	2009-02-21 01:50:38.000000000 +1030
++++ gcc-4.4.1/gcc/incpath.h	2010-07-08 13:12:54.000000000 +0930
+@@ -31,4 +31,4 @@
+ 
+ extern struct target_c_incpath_s target_c_incpath;
+ 
+-enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
++enum { QUOTE = 0, BRACKET, SYSTEM, AFTER, BAD };
diff --git a/recipes/gcc/files/ibad-4.6.patch b/recipes/gcc/files/ibad-4.6.patch
new file mode 100644
index 0000000..6c40303
--- /dev/null
+++ b/recipes/gcc/files/ibad-4.6.patch
@@ -0,0 +1,122 @@
+Index: gcc/c-family/c.opt
+===================================================================
+--- gcc/c-family/c.opt	(revision 162065)
++++ gcc/c-family/c.opt	(working copy)
+@@ -885,6 +885,10 @@
+ C ObjC C++ ObjC++ Joined
+ -femit-struct-debug-detailed=<spec-list>	Detailed reduced debug info for structs
+ 
++ibad
++C ObjC C++ ObjC++ Joined Separate
++-ibad <dir>	Abort if <dir> is specified in the include paths
++
+ idirafter
+ C ObjC C++ ObjC++ Joined Separate
+ -idirafter <dir>	Add <dir> to the end of the system include path
+Index: gcc/c-family/c-opts.c
+===================================================================
+--- gcc/c-family/c-opts.c	(revision 162065)
++++ gcc/c-family/c-opts.c	(working copy)
+@@ -163,6 +163,7 @@
+ 
+     case OPT_F:
+     case OPT_I:
++    case OPT_ibad:
+     case OPT_idirafter:
+     case OPT_isysroot:
+     case OPT_isystem:
+@@ -800,6 +801,10 @@
+       set_struct_debug_option (arg);
+       break;
+ 
++    case OPT_ibad:
++      add_path (xstrdup (arg), BAD, 0, true);
++      break;
++
+     case OPT_idirafter:
+       add_path (xstrdup (arg), AFTER, 0, true);
+       break;
+Index: gcc/incpath.c
+===================================================================
+--- gcc/incpath.c	(revision 162065)
++++ gcc/incpath.c	(working copy)
+@@ -60,8 +60,8 @@
+ 					   struct cpp_dir *, int);
+ 
+ /* Include chains heads and tails.  */
+-static struct cpp_dir *heads[4];
+-static struct cpp_dir *tails[4];
++static struct cpp_dir *heads[5];
++static struct cpp_dir *tails[5];
+ static bool quote_ignores_source_dir;
+ enum { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS };
+ 
+@@ -284,6 +284,32 @@
+   return head;
+ }
+ 
++/* Exit if paths in BAD are found in HEAD. */
++static void
++check_bad_includes (struct cpp_dir *head, struct cpp_dir *bad)
++{
++  struct cpp_dir *h, *b;
++  size_t len;
++
++  if (head == NULL)
++    return;
++
++  for (b = bad; b; b = b->next)
++    {
++      len = strlen(b->name);
++      for (h = head; h; h = h->next)
++        {
++          if (!strncmp(h->name, b->name, len))
++            {
++                fprintf(stderr,
++                          _("CROSS COMPILE Badness: %s in INCLUDEPATH: %s\n"),
++                          b->name, h->name);
++                exit(EXIT_FAILURE);
++            }
++        }
++    }
++}
++
+ /* Add SYSROOT to any user-supplied paths in CHAIN starting with
+    "=".  */
+ 
+@@ -319,6 +345,13 @@
+       add_sysroot_to_chain (sysroot, AFTER);
+     }
+ 
++  /* Exit if paths specified with -ibad are found in the include chain.
++     This must be done before inode duplicates are removed. */
++  check_bad_includes(heads[QUOTE], heads[BAD]);
++  check_bad_includes(heads[BRACKET], heads[BAD]);
++  check_bad_includes(heads[SYSTEM], heads[BAD]);
++  check_bad_includes(heads[AFTER], heads[BAD]);
++
+   /* Join the SYSTEM and AFTER chains.  Remove duplicates in the
+      resulting SYSTEM chain.  */
+   if (heads[SYSTEM])
+Index: gcc/incpath.h
+===================================================================
+--- gcc/incpath.h	(revision 162065)
++++ gcc/incpath.h	(working copy)
+@@ -31,4 +31,4 @@
+ 
+ extern struct target_c_incpath_s target_c_incpath;
+ 
+-enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
++enum { QUOTE = 0, BRACKET, SYSTEM, AFTER, BAD };
+Index: gcc/gcc.h
+===================================================================
+--- gcc/gcc.h	(revision 162065)
++++ gcc/gcc.h	(working copy)
+@@ -47,6 +47,7 @@
+  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
+   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
+   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
++  || !strcmp (STR, "ibad") \
+   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
+   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
+   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
diff --git a/recipes/gcc/files/ibad-specs.sed b/recipes/gcc/files/ibad-specs.sed
new file mode 100644
index 0000000..59ad077
--- /dev/null
+++ b/recipes/gcc/files/ibad-specs.sed
@@ -0,0 +1,9 @@
+# Add bad_includes to the cpp spec string.
+/^*cpp:$/ {n; s|^|%(bad_includes) |}
+
+# Add bad_includes to the cc1plus spec string.
+/^*cc1plus:$/ {n; s|^|%(bad_includes) |}
+
+# Append the bad_incldues spec string to the file.
+$ a *bad_includes:\
+-ibad /usr/include -ibad /sw/include -ibad /opt/include -ibad /usr/X11R6/include -ibad /usr/X11/include -ibad /usr/local/include
diff --git a/recipes/gcc/gcc-cross_4.3.1.bb b/recipes/gcc/gcc-cross_4.3.1.bb
index 1c191fa..879c2ac 100644
--- a/recipes/gcc/gcc-cross_4.3.1.bb
+++ b/recipes/gcc/gcc-cross_4.3.1.bb
@@ -1,11 +1,18 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
 
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.3.2.bb b/recipes/gcc/gcc-cross_4.3.2.bb
index 322a203..c9433e9 100644
--- a/recipes/gcc/gcc-cross_4.3.2.bb
+++ b/recipes/gcc/gcc-cross_4.3.2.bb
@@ -1,9 +1,17 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
+
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.3.3.bb b/recipes/gcc/gcc-cross_4.3.3.bb
index c8e2f9b..c9433e9 100644
--- a/recipes/gcc/gcc-cross_4.3.3.bb
+++ b/recipes/gcc/gcc-cross_4.3.3.bb
@@ -1,10 +1,17 @@
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
 
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.3.4.bb b/recipes/gcc/gcc-cross_4.3.4.bb
index 7edb21b..c35abbb 100644
--- a/recipes/gcc/gcc-cross_4.3.4.bb
+++ b/recipes/gcc/gcc-cross_4.3.4.bb
@@ -1,10 +1,17 @@
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.3.3.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += "  --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
 
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.4.1.bb b/recipes/gcc/gcc-cross_4.4.1.bb
index fce459b..9aceaa2 100644
--- a/recipes/gcc/gcc-cross_4.4.1.bb
+++ b/recipes/gcc/gcc-cross_4.4.1.bb
@@ -1,10 +1,17 @@
 require gcc-${PV}.inc
 require gcc-cross4.inc
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
 
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.4.2.bb b/recipes/gcc/gcc-cross_4.4.2.bb
index fce459b..9aceaa2 100644
--- a/recipes/gcc/gcc-cross_4.4.2.bb
+++ b/recipes/gcc/gcc-cross_4.4.2.bb
@@ -1,10 +1,17 @@
 require gcc-${PV}.inc
 require gcc-cross4.inc
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
 
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.4.4.bb b/recipes/gcc/gcc-cross_4.4.4.bb
index 4309fd4..431ba44 100644
--- a/recipes/gcc/gcc-cross_4.4.4.bb
+++ b/recipes/gcc/gcc-cross_4.4.4.bb
@@ -1,9 +1,17 @@
 require gcc-${PV}.inc
 require gcc-cross4.inc
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native}"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
+
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_4.5.bb b/recipes/gcc/gcc-cross_4.5.bb
index a2da4a8..abf0af5 100644
--- a/recipes/gcc/gcc-cross_4.5.bb
+++ b/recipes/gcc/gcc-cross_4.5.bb
@@ -1,10 +1,18 @@
-PR = "r1"
+PR = "r2"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
 NATIVEDEPS += "libmpc-native libelf-native"
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.4.1.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} --with-system-zlib"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
+
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
diff --git a/recipes/gcc/gcc-cross_svn.bb b/recipes/gcc/gcc-cross_svn.bb
index 825a7bd..3d1e22a 100644
--- a/recipes/gcc/gcc-cross_svn.bb
+++ b/recipes/gcc/gcc-cross_svn.bb
@@ -1,11 +1,19 @@
-PR = "r0"
+PR = "r1"
 require gcc-${PV}.inc
 require gcc-cross4.inc
 
 DEPENDS += "libmpc-native"
 
-SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch "
+SRC_URI_append_fail-fast = " file://ibad-4.6.patch \
+				file://ibad-specs.sed"
 
 EXTRA_OECONF += " --disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} --with-system-zlib"
 
 ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
+
+do_install_append() {
+	# Add -ibad paths to the default cflags.
+	install -m 0755 -d ${gcclibdir}/${TARGET_SYS}/${BINV}
+	${TARGET_PREFIX}gcc -dumpspecs | sed -f ${WORKDIR}/ibad-specs.sed \
+		> ${gcclibdir}/${TARGET_SYS}/${BINV}/specs
+}
-- 
1.7.1





^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-07-13  2:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08  5:39 [RFC] Badness with -ibad, a replacement for zecke-no-host-includes.patch Graham Gower
2010-07-08  5:41 ` Graham Gower
2010-07-08 10:01 ` Koen Kooi
2010-07-08 10:56   ` Graham Gower
2010-07-08 12:12     ` Koen Kooi
2010-07-08 15:36 ` Holger Freyther
2010-07-09  9:41   ` Phil Blundell
2010-07-09 10:44   ` Richard Purdie
2010-07-10  7:04     ` Graham Gower
2010-07-08 17:21 ` Denys Dmytriyenko
2010-07-10  6:57   ` Graham Gower
2010-07-08 21:00 ` Khem Raj
2010-07-13  2:27 ` [PATCH] gcc: badness " Graham Gower

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.