[oe-commits] Mark Hatle : gcc: Workaround for compiler flag mismatch

git at git.openembedded.org git at git.openembedded.org
Tue Jun 4 14:50:08 UTC 2013


Module: openembedded-core.git
Branch: master-next
Commit: 1f40202ce3c1282674b6cea39ef709972275f201
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=1f40202ce3c1282674b6cea39ef709972275f201

Author: Mark Hatle <mark.hatle at windriver.com>
Date:   Fri May 31 15:23:10 2013 +0000

gcc: Workaround for compiler flag mismatch

When cross compiling the target compiler, both the cross-compiler
and the host compiler are used.  However, the -W options used were
discovered from the cross-compiler and may be incompatible with the
host compiler.

Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/recipes-devtools/gcc/gcc-4.8.inc              |    1 +
 .../gcc/gcc-4.8/gcc-4.8-build-args.patch           |   51 ++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/meta/recipes-devtools/gcc/gcc-4.8.inc b/meta/recipes-devtools/gcc/gcc-4.8.inc
index a9786da..80bd02c 100644
--- a/meta/recipes-devtools/gcc/gcc-4.8.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.8.inc
@@ -66,6 +66,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
 	   file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
 	   file://0035-wcast-qual-PR-55383.patch \
 	   file://gcc-4.8-PR56797.patch \
+	   file://gcc-4.8-build-args.patch \
 	  "
 SRC_URI[md5sum] = "e6040024eb9e761c3bea348d1fa5abb0"
 SRC_URI[sha256sum] = "b037fe5132b71ecad2ea7141ec92292b5d32427bf90fd90cde432b1d5abacc2c"
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/gcc-4.8-build-args.patch b/meta/recipes-devtools/gcc/gcc-4.8/gcc-4.8-build-args.patch
new file mode 100644
index 0000000..95f39bb
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.8/gcc-4.8-build-args.patch
@@ -0,0 +1,51 @@
+When cross compiling a target gcc, target flags may be used on the host
+
+Configure identifies a number of warning flags (WARN_CFLAGS and 
+WARN_CXXFLAGS) from the $CC value.  The cross compiler may be different
+from the host compiler and may not support the same set of flags.  This
+leads to problems such as:
+
+cc1plus: error: unrecognized command line option "-Wno-narrowing"
+cc1plus: error: unrecognized command line option "-Wno-overlength-strings"
+
+Work around this problem by removing the warning flags from the
+BUILD_*FLAGS values.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
+
+diff -ur gcc-4.8.0.orig/gcc/configure.ac gcc-4.8.0/gcc/configure.ac
+--- gcc-4.8.0.orig/gcc/configure.ac	2013-05-29 14:44:24.960853593 -0500
++++ gcc-4.8.0/gcc/configure.ac	2013-05-31 01:34:09.518775962 -0500
+@@ -1892,8 +1892,8 @@
+ # These are the normal (build=host) settings:
+ CC_FOR_BUILD='$(CC)'		AC_SUBST(CC_FOR_BUILD)
+ CXX_FOR_BUILD='$(CXX)'		AC_SUBST(CXX_FOR_BUILD)
+-BUILD_CFLAGS='$(ALL_CFLAGS)'	AC_SUBST(BUILD_CFLAGS)
+-BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
++BUILD_CFLAGS='$(ALL_BUILD_CFLAGS)'	AC_SUBST(BUILD_CFLAGS)
++BUILD_CXXFLAGS='$(ALL_BUILD_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
+ BUILD_LDFLAGS='$(LDFLAGS)'	AC_SUBST(BUILD_LDFLAGS)
+ STMP_FIXINC=stmp-fixinc		AC_SUBST(STMP_FIXINC)
+ 
+diff -ur gcc-4.8.0.orig/gcc/Makefile.in gcc-4.8.0/gcc/Makefile.in
+--- gcc-4.8.0.orig/gcc/Makefile.in	2013-05-29 14:44:24.369853593 -0500
++++ gcc-4.8.0/gcc/Makefile.in	2013-05-31 01:34:30.360776427 -0500
+@@ -989,10 +989,16 @@
+ ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
+   $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+ 
++ALL_BUILD_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
++  $(CFLAGS) $(INTERNAL_CFLAGS) @DEFS@
++
+ # The C++ version.
+ ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
+   $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
+ 
++ALL_BUILD_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
++  $(NOEXCEPTION_FLAGS) @DEFS@
++
+ # Likewise.  Put INCLUDES at the beginning: this way, if some autoconf macro
+ # puts -I options in CPPFLAGS, our include files in the srcdir will always
+ # win against random include files in /usr/include.



More information about the Openembedded-commits mailing list