Patchwork [2/2] *native.bbclass: use HOST_CC_ARCH in CPP

login
register
mail settings
Submitter Enrico Scholz
Date April 26, 2011, 10:16 a.m.
Message ID <1303812993-6107-2-git-send-email-enrico.scholz@sigma-chemnitz.de>
Download mbox | patch
Permalink /patch/2873/
State New, archived
Headers show

Comments

Enrico Scholz - April 26, 2011, 10:16 a.m.
Using plain 'gcc -E' for CPP is wrong because some macros are defined
only for certain ${HOST_CC_ARCH} flags.  Checks using ${CPP} might
return wrong results hence.

Omitting ${HOST_CC_ARCH} from 'gcc -E' can also break builds for
compilers configured e.g. for '-mcpu=cortex-m3'.  Such gccs require
'-mthumb'; even when invoked with '-E':

| $ arm-linux-uclibceabi-gcc -E - < /dev/null
| # 1 "<stdin>"
| <stdin>:1:0: error: target CPU does not support ARM mode
| $

| $ arm-linux-uclibceabi-gcc -mthumb -E - < /dev/null
| # 1 "<stdin>"
| # 1 "<built-in>"
| # 1 "<command-line>"
| # 1 "<stdin>"
| $

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 classes/canadian-native.bbclass |    2 +-
 classes/native.bbclass          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/classes/canadian-native.bbclass b/classes/canadian-native.bbclass
index 3cd003c..50ecc11 100644
--- a/classes/canadian-native.bbclass
+++ b/classes/canadian-native.bbclass
@@ -37,7 +37,7 @@  LDFLAGS = "${SDK_LDFLAGS}"
 export CC = "${CCACHE}${SDK_PREFIX}gcc ${HOST_CC_ARCH}"
 export CXX = "${CCACHE}${SDK_PREFIX}g++ ${HOST_CC_ARCH}"
 export F77 = "${CCACHE}${SDK_PREFIX}g77 ${HOST_CC_ARCH}"
-export CPP = "${SDK_PREFIX}gcc -E"
+export CPP = "${SDK_PREFIX}gcc -E ${HOST_CC_ARCH}"
 export LD = "${SDK_PREFIX}ld"
 #export CCLD = "${CC}"
 export AR = "${SDK_PREFIX}ar"
diff --git a/classes/native.bbclass b/classes/native.bbclass
index 1e7a6ec..0f65792 100644
--- a/classes/native.bbclass
+++ b/classes/native.bbclass
@@ -54,7 +54,7 @@  export CONFIG_SITE = ""
 export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
 export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}"
 export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}"
-export CPP = "${HOST_PREFIX}gcc -E"
+export CPP = "${HOST_PREFIX}gcc -E ${HOST_CC_ARCH}"
 export LD = "${HOST_PREFIX}ld"
 export CCLD = "${CC}"
 export AR = "${HOST_PREFIX}ar"