Patchwork [1/2] bitbake.conf: 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-1-git-send-email-enrico.scholz@sigma-chemnitz.de>
Download mbox | patch
Permalink /patch/2871/
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>
---
 conf/bitbake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index 17a494d..5fb90e2 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -473,7 +473,7 @@  TOOLCHAIN_SYSPATH ?= "${TOOLCHAIN_PATH}/${TARGET_SYS}"
 export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
-export CPP = "${HOST_PREFIX}gcc -E${TOOLCHAIN_OPTIONS}"
+export CPP = "${HOST_PREFIX}gcc -E ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 export LD = "${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS}"
 export CCLD = "${CC}"
 export AR = "${HOST_PREFIX}ar"
@@ -488,7 +488,7 @@  PYTHON = "${@sys.executable}"
 export BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc ${BUILD_CC_ARCH}"
 export BUILD_CXX = "${CCACHE}${BUILD_PREFIX}g++ ${BUILD_CC_ARCH}"
 export BUILD_F77 = "${CCACHE}${BUILD_PREFIX}g77 ${BUILD_CC_ARCH}"
-export BUILD_CPP = "${BUILD_PREFIX}cpp"
+export BUILD_CPP = "${BUILD_PREFIX}cpp ${BUILD_CC_ARCH}"
 export BUILD_LD = "${BUILD_PREFIX}ld"
 export BUILD_CCLD = "${BUILD_PREFIX}gcc"
 export BUILD_AR = "${BUILD_PREFIX}ar"