]> xenbits.xensource.com Git - xtf.git/commitdiff
Fix issue with clang --target when cross compiling using LLVM
authorMichal Orzel <michal.orzel@arm.com>
Wed, 5 May 2021 06:34:16 +0000 (08:34 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 6 May 2021 14:21:05 +0000 (15:21 +0100)
When using LLVM and cross compiling, the CC expands to:
clang --target=<target_triple>
Example of target triple: aarch64-linux-gnu.

However the current code assigning --target based on the
cross compiler does not work if we pass the full path to
CROSS_COMPILE. In this case the build fails.

Fix the issue so that when cross compiling using LLVM
only the basename of cross compiler path is used.

Closes #2

Signed-off-by: Michal Orzel <michal.orzel@arm.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Makefile

index 0b3dc3dee0c001bb5280399a7f1844be14ff8fb1..a7af201ebae93aaeb70d6cbaa02c180d466639dd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ else # LLVM toolchain
 
 # Optional -$NUM version when multiple toolchains are installed
 ver := $(filter -%,$(LLVM))
-CC              := clang$(ver) $(if $(CROSS_COMPILE),--target=$(CROSS_COMPILE:%-=%))
+CC              := clang$(ver) $(if $(CROSS_COMPILE),--target=$(notdir $(CROSS_COMPILE:%-=%)))
 LD              := ld.lld$(ver)
 OBJCOPY         := llvm-objcopy$(ver)
 undefine ver