build(clang): introduce clang toolchain support
Only the compiler is switched to clang. The assembler and the
linker are provided by the GCC toolchain.
clang is used to build TFTF when the base name of the path assigned
to "CC" variable contains the string 'clang'.
'CROSS_COMPILE' flag is still required and must point to the
appropriate GCC toolchain.
*Note:
Compiling TF-A tests with clang toolchain has following
issues which are not listed/overlooked in GCC. Henceforth, few
sections of the code have been refactored accordingly:
1. error: instruction requires: wfxt
fix : build with ARM_ARCH_MINOR=7.
2. error: initializer element is not a compile-time constant
test_ffa_setup_and_discovery.c:33:11[.uuid = sp_uuids[0]]
sp_test_ffa.c:38:11:.uuid = sp_uuids[0]
fix: gcc overlooks this error but clang doesn't. Hence
initializer elements are explicitly specified.
This is an introductory patch to cover the following targets.
1. tftf
2. ivy
3. realm
4. cactus
5. cactus_mm
6. ns_bl1u
Other tf-a tests targets need to be ported and will be
implemented explicitly in separate patches.
In summary, with this patch, we will be able to compile
TFTF code covering the targets with the following command:
**********************************************************
* Build TFTF Aarch64 ( Default Build ) with Clang support
* tested with clang version: 14.0.0
**********************************************************
make CC=${CLANG_PATH}/clang \
PLAT=fvp \
CROSS_COMPILE=aarch64-none-elf- \
ARM_ARCH_MINOR=7 \
V=0 tftf ivy realm cactus cactus_mm ns_bl1u -j12
********************************************************
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: I409d11b596dfd50a3d25598679808dd9fcfc51e5
3 files changed