build system: move more clang handling to xcompile
clang requires some additional options to disable warnings which can be handled by xcompile. Also drop the hard coded clang compilers in Makefile Change-Id: I0f12f755420f315127e6d9adc00b1246c6e7131b Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/7612 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
45dd591ff6
commit
34de29aeb3
22
Makefile
22
Makefile
|
@ -122,32 +122,10 @@ include $(HAVE_DOTCONFIG)
|
||||||
|
|
||||||
include .xcompile
|
include .xcompile
|
||||||
|
|
||||||
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
|
||||||
# FIXME: armv7/aarch64 won't build right now
|
|
||||||
# NOTE: clang puts compiler-rt under lib/linux/libclang_rt.builtins-i386.a
|
|
||||||
# this means the triple is i386-linux-elf instead of i386-none-elf
|
|
||||||
CFLAGS_x86_32 = -no-integrated-as -Qunused-arguments -target i386-linux-elf -m32
|
|
||||||
# Tone down some clang warnings
|
|
||||||
CFLAGS_x86_32 += -Wno-unused-variable -Wno-unused-function -Wno-tautological-compare -Wno-shift-overflow
|
|
||||||
CC_x86_32:=clang
|
|
||||||
HOSTCC := clang
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_MMX),y)
|
ifneq ($(CONFIG_MMX),y)
|
||||||
CFLAGS_x86_32 += -mno-mmx
|
CFLAGS_x86_32 += -mno-mmx
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# FIXME: we end up with conflicting flags with this, not clear on this part.
|
|
||||||
#ifneq ($(CONFIG_SSE),y)
|
|
||||||
#CFLAGS_x86_32 += -mno-sse
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CFLAGS_arm = -no-integrated-as -Qunused-arguments -target arm-eabi -ccc-gcc-name $(CC_arm)
|
|
||||||
CC_arm:=clang
|
|
||||||
|
|
||||||
CFLAGS_aarch64 = -no-integrated-as -Qunused-arguments -target aarch64-eabi -ccc-gcc-name $(CC_aarch64)
|
|
||||||
CC_aarch64:=clang
|
|
||||||
endif
|
|
||||||
|
|
||||||
include toolchain.inc
|
include toolchain.inc
|
||||||
|
|
||||||
strip_quotes = $(subst ",,$(subst \",,$(1)))
|
strip_quotes = $(subst ",,$(subst \",,$(1)))
|
||||||
|
|
|
@ -98,13 +98,13 @@ testas() {
|
||||||
# Architecture matched.
|
# Architecture matched.
|
||||||
GCCPREFIX="$gccprefix"
|
GCCPREFIX="$gccprefix"
|
||||||
|
|
||||||
if [ -z "$use_dash_twidth" ]; then
|
unset ASFLAGS LDFLAGS
|
||||||
ASFLAGS=""
|
unset CFLAGS_GCC CFLAGS_CLANG
|
||||||
CFLAGS_GCC=""
|
|
||||||
LDFLAGS=""
|
if [ -n "$use_dash_twidth" ]; then
|
||||||
else
|
|
||||||
ASFLAGS="--$twidth"
|
ASFLAGS="--$twidth"
|
||||||
CFLAGS_GCC="-m$twidth"
|
CFLAGS_GCC="-m$twidth"
|
||||||
|
CFLAGS_CLANG="-m$twidth"
|
||||||
LDFLAGS="-b $full_arch"
|
LDFLAGS="-b $full_arch"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -114,6 +114,7 @@ testas() {
|
||||||
"elf32-i386" )
|
"elf32-i386" )
|
||||||
LDFLAGS="$LDFLAGS -melf_i386"
|
LDFLAGS="$LDFLAGS -melf_i386"
|
||||||
CFLAGS_GCC="$CFLAGS_GCC -Wl,-b,elf32-i386 -Wl,-melf_i386"
|
CFLAGS_GCC="$CFLAGS_GCC -Wl,-b,elf32-i386 -Wl,-melf_i386"
|
||||||
|
CFLAGS_CLANG="$CFLAGS_GCC -Wl,-b,elf32-i386 -Wl,-melf_i386"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -140,6 +141,8 @@ detect_special_flags() {
|
||||||
x86)
|
x86)
|
||||||
testcc "$GCC" "$CFLAGS_GCC -Wa,--divide" &&
|
testcc "$GCC" "$CFLAGS_GCC -Wa,--divide" &&
|
||||||
CFLAGS_GCC="$CFLAGS_GCC -Wa,--divide"
|
CFLAGS_GCC="$CFLAGS_GCC -Wa,--divide"
|
||||||
|
testcc "$CLANG" "$CFLAGS_CLANG -Wa,--divide" &&
|
||||||
|
CFLAGS_CLANG="$CFLAGS_CLANG -Wa,--divide"
|
||||||
# Always build for i686 -- no sse/mmx instructions since SMM
|
# Always build for i686 -- no sse/mmx instructions since SMM
|
||||||
# modules are compiled using these flags. Note that this
|
# modules are compiled using these flags. Note that this
|
||||||
# doesn't prevent a project using xcompile to explicitly
|
# doesn't prevent a project using xcompile to explicitly
|
||||||
|
@ -174,6 +177,10 @@ COMPILER_RT_${TARCH}:=${CC_RT_GCC}
|
||||||
COMPILER_RT_FLAGS_${TARCH}:=${CC_RT_EXTRA_GCC}
|
COMPILER_RT_FLAGS_${TARCH}:=${CC_RT_EXTRA_GCC}
|
||||||
else
|
else
|
||||||
CC_${TARCH}:=${CLANG}
|
CC_${TARCH}:=${CLANG}
|
||||||
|
CFLAGS_${TARCH}:=${CFLAGS_CLANG}
|
||||||
|
CFLAGS_${TARCH}+=-no-integrated-as -Qunused-arguments -m${TWIDTH}
|
||||||
|
# tone down compiler warnings
|
||||||
|
CFLAGS_${TARCH}+=-Wno-unused-variable -Wno-unused-function -Wno-tautological-compare -Wno-shift-overflow
|
||||||
COMPILER_RT_${TARCH}:=${CC_RT_CLANG}
|
COMPILER_RT_${TARCH}:=${CC_RT_CLANG}
|
||||||
COMPILER_RT_FLAGS_${TARCH}:=${CC_RT_EXTRA_CLANG}
|
COMPILER_RT_FLAGS_${TARCH}:=${CC_RT_EXTRA_CLANG}
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue