Clang needs to have access to a GCC toolchain which we advertise using
the command line option --gcc-toolchain=. Clang previously picked the
wrong toolchain which resulted in the following error message:
/..//bin/as: unrecognized option '-EL'
Bug:
123422077
Signed-off-by: Daniel Mentz <danielmentz@google.com>
Change-Id: I3e339dd446b71e2c75eb9e2c186eba715b3771cd
else ifeq ($(cc-name),clang)
export CLANG_TRIPLE_ARM32 ?= $(CROSS_COMPILE_ARM32)
export CLANG_TARGET_ARM32 := --target=$(notdir $(CLANG_TRIPLE_ARM32:%-=%))
+ export GCC_TOOLCHAIN32_DIR := $(dir $(shell which $(CROSS_COMPILE_ARM32)ld))
+ export GCC_TOOLCHAIN32 := $(realpath $(GCC_TOOLCHAIN32_DIR)/..)
+ export CLANG_PREFIX32 := --prefix=$(GCC_TOOLCHAIN32_DIR)
+ export CLANG_GCC32_TC := --gcc-toolchain=$(GCC_TOOLCHAIN32)
export CONFIG_VDSO32 := y
vdso32 := -DCONFIG_VDSO32=1
else ifeq ($(shell which $(CROSS_COMPILE_ARM32)$(cc-name) 2> /dev/null),)
# A mix between the arm64 and arm vDSO Makefiles.
ifeq ($(cc-name),clang)
- CC_ARM32 := $(CC) $(CLANG_TARGET_ARM32) -no-integrated-as
+ CC_ARM32 := $(CC) $(CLANG_TARGET_ARM32) -no-integrated-as $(CLANG_GCC32_TC) $(CLANG_PREFIX32)
else
CC_ARM32 := $(CROSS_COMPILE_ARM32)$(cc-name)
endif