[oe-commits] [openembedded-core] 09/43: gcc-7.inc: add new warning "Wnot-cross-compiler"

git at git.openembedded.org git at git.openembedded.org
Sat Jul 22 07:20:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 78bec81eac226fb86c44c54ea5c5cc3185bc7448
Author: Juro Bystricky <juro.bystricky at intel.com>
AuthorDate: Tue Jul 18 15:45:01 2017 -0700

    gcc-7.inc: add new warning "Wnot-cross-compiler"
    
    Suppose we have an autotools project that looks like it is using the cross
    compiler but is actually reaching out to the host compiler instead.
    On an x86-64 build, you may not even notice.
    To be able to prevent this, this patch implements a new gcc warning
    "Wnot-cross-compiler". The intention here is to intentionally break a build
    if we are not using a cross-compiler when one is expected to be used.
    
    Expected usage: " -Wnot-cross-compiler -Werror=not-cross-compiler "
    
    [YOCTO #11587]
    
    Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/recipes-devtools/gcc/gcc-7.1.inc              |  1 +
 .../gcc/gcc-7.1/0051-warn-not-cross-compiler.patch | 39 ++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/meta/recipes-devtools/gcc/gcc-7.1.inc b/meta/recipes-devtools/gcc/gcc-7.1.inc
index 3f1c06d..e9b1f21 100644
--- a/meta/recipes-devtools/gcc/gcc-7.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-7.1.inc
@@ -75,6 +75,7 @@ SRC_URI = "\
            file://0048-gcc-Enable-static-PIE.patch \
            file://0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch \
            file://0050-replace-struct-ucontext-with-ucontext_t.patch \
+           file://0051-warn-not-cross-compiler.patch \
            ${BACKPORTS} \
 "
 BACKPORTS = "\
diff --git a/meta/recipes-devtools/gcc/gcc-7.1/0051-warn-not-cross-compiler.patch b/meta/recipes-devtools/gcc/gcc-7.1/0051-warn-not-cross-compiler.patch
new file mode 100644
index 0000000..78671ed
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.1/0051-warn-not-cross-compiler.patch
@@ -0,0 +1,39 @@
+ 
+This patch implements an additional gcc command line option warning 
+"Wnot-cross-compiler". The option (if specified) will simply generate 
+a warning if gcc being used is not a cross-compiler. 
+
+Upstream-Status: Pending
+Signed-off-by: Juro Bystricky <juro.bystricky at intel.com>
+
+
+diff --git a/gcc/common.opt b/gcc/common.opt
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -801,6 +801,10 @@
+ Common Var(warn_vector_operation_performance) Warning
+ Warn when a vector operation is compiled outside the SIMD.
+ 
++Wnot-cross-compiler
++Common Warning
++Warn when not-cross-compiling.
++
+ Xassembler
+ Driver Separate
+ 
+diff --git a/gcc/opts.c b/gcc/opts.c
+--- a/gcc/opts.c
++++ b/gcc/opts.c
+@@ -2334,6 +2334,12 @@
+       opts->x_flag_ipa_icf_variables = value;
+       break;
+ 
++    case OPT_Wnot_cross_compiler:
++#ifndef CROSS_DIRECTORY_STRUCTURE
++      warning (OPT_Wnot_cross_compiler, "Not using cross-compiler!");
++#endif
++      break;
++
+     default:
+       /* If the flag was handled in a standard way, assume the lack of
+ 	 processing here is intentional.  */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list