summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2023-05-08 16:28:12 +0200
committerMartin L Roth <gaumless@gmail.com>2024-03-26 22:51:12 +0000
commitd308243bc16aefd3802c6955635ae58efe3f92ff (patch)
treececbe9dfa854bcf26ad18f66b43075ccb1f16509 /util
parent44adf4d22f0a088b7463da2ef8f529ad172f33f7 (diff)
util/xcompile: Add target architecture to CPPFLAGS
In order to preprocess linker scripts the target architecture needs to be specified. With clang this needs to be set via a cli argument. Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Change-Id: I4340681e30059d6f18a49a49937668cd3dd39ce1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/75031 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-xutil/xcompile/xcompile8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
index 1eecc7e380..68b3705d77 100755
--- a/util/xcompile/xcompile
+++ b/util/xcompile/xcompile
@@ -262,6 +262,9 @@ CLANG_CFLAGS_${TARCH}+=-Wno-shift-overflow -Wno-address-of-packed-member -Wno-in
CLANG_CFLAGS_${TARCH}+=-fbracket-depth=2048 -mllvm -asm-macro-max-nesting-depth=1000
CLANG_COMPILER_RT_${TARCH}:=${CC_RT_CLANG}
CLANG_COMPILER_RT_FLAGS_${TARCH}:=${CC_RT_EXTRA_CLANG}
+# Leak the target arch into the preprocessor flags with clang.
+# This is needed to preprocess linker scripts
+CLANG_CPPFLAGS_${TARCH}:=${CPPFLAGS_CLANG}
# GCC/Clang Common
ifeq (\$(CONFIG_COMPILER_GCC)\$(CONFIG_LP_COMPILER_GCC),y)
@@ -272,6 +275,7 @@ ifeq (\$(CONFIG_COMPILER_GCC)\$(CONFIG_LP_COMPILER_GCC),y)
else
CC_${TARCH}:=\$(CLANG_CC_${TARCH})
CFLAGS_${TARCH}:=\$(CLANG_CFLAGS_${TARCH})
+ CPPFLAGS_${TARCH}:=\$(CLANG_CPPFLAGS_${TARCH})
COMPILER_RT_${TARCH}:=\$(CLANG_COMPILER_RT_${TARCH})
COMPILER_RT_FLAGS_${TARCH}:=\$(CLANG_COMPILER_RT_FLAGS_${TARCH})
endif
@@ -471,7 +475,9 @@ test_architecture() {
# but that's more of a clang limitation. Let's be optimistic
# that this will change in the future.
CLANG="${clang_prefix}clang"
- CFLAGS_CLANG="-target ${clang_arch}-${TABI} $CFLAGS_CLANG"
+ CLANG_TARGET="-target ${clang_arch}-${TABI}"
+ CFLAGS_CLANG="$CLANG_TARGET $CFLAGS_CLANG"
+ CPPFLAGS_CLANG="$CLANG_TARGET $CPPFLAGS_CLANG"
fi
}