From c8a992fda867f259b04bb4147b91b9dd6482de37 Mon Sep 17 00:00:00 2001 From: origin Date: Wed, 19 Jan 2022 16:30:14 +0000 Subject: [PATCH] build(make): use clang binutils to compile Utilise LLVM binutils during compilation of TF-A instead of the default utilities provided by the host. The Makefile looks in the path provided for the current toolchain and only checks for them on the host if none exist in this path. If the utilities don't exist in either place then the build fails. Change-Id: I6af2aa09ea3c8743cf3df6600d9760d909d76647 Signed-off-by: Harrison Mutai Signed-off-by: Manish V Badarkhe --- Makefile | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 851c944fe..0b8167456 100644 --- a/Makefile +++ b/Makefile @@ -263,24 +263,24 @@ ENABLE_FEAT_RNG = $(if $(findstring rng,${arch-features}),1,0) # Determine if FEAT_SB is supported ENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0) -ifneq ($(findstring armclang,$(notdir $(CC))),) -TF_CFLAGS_aarch32 = -target arm-arm-none-eabi $(march32-directive) -TF_CFLAGS_aarch64 = -target aarch64-arm-none-eabi $(march64-directive) -LD = $(LINKER) -AS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) -CPP = $(CC) -E $(TF_CFLAGS_$(ARCH)) -PP = $(CC) -E $(TF_CFLAGS_$(ARCH)) -else ifneq ($(findstring clang,$(notdir $(CC))),) -CLANG_CCDIR = $(if $(filter-out ./,$(dir $(CC))),$(dir $(CC)),) -TF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive) -TF_CFLAGS_aarch64 = -target aarch64-elf $(march64-directive) -LD = $(CLANG_CCDIR)ld.lld -ifeq (, $(shell which $(LD))) -$(error "No $(LD) in PATH, make sure it is installed or set LD to a different linker") -endif -AS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) -CPP = $(CC) -E -PP = $(CC) -E +ifneq ($(findstring clang,$(notdir $(CC))),) + ifneq ($(findstring armclang,$(notdir $(CC))),) + TF_CFLAGS_aarch32 := -target arm-arm-none-eabi $(march32-directive) + TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi $(march64-directive) + LD := $(LINKER) + else + TF_CFLAGS_aarch32 := $(target32-directive) $(march32-directive) + TF_CFLAGS_aarch64 := -target aarch64-elf $(march64-directive) + LD := $(shell $(CC) --print-prog-name ld.lld) + + AR := $(shell $(CC) --print-prog-name llvm-ar) + OD := $(shell $(CC) --print-prog-name llvm-objdump) + OC := $(shell $(CC) --print-prog-name llvm-objcopy) + endif + + CPP := $(CC) -E $(TF_CFLAGS_$(ARCH)) + PP := $(CC) -E $(TF_CFLAGS_$(ARCH)) + AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) else ifneq ($(findstring gcc,$(notdir $(CC))),) TF_CFLAGS_aarch32 = $(march32-directive) TF_CFLAGS_aarch64 = $(march64-directive)