On 13/02/2023 10:23, Amit Daniel Kachhap wrote:
This commit allows morello kselftest to be compiled by Gcc toolchain. While at it, remove clang compiler flags -integrated-as, --target, -g, -Wall as they are already set in kselftest and arm64 root makefile.
Note: This commit requires CC or LLVM to be set for Clang toolchain which was not the case earlier.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
tools/testing/selftests/arm64/morello/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/arm64/morello/Makefile b/tools/testing/selftests/arm64/morello/Makefile index 72f34426c7c0..47b3bce18601 100644 --- a/tools/testing/selftests/arm64/morello/Makefile +++ b/tools/testing/selftests/arm64/morello/Makefile @@ -1,16 +1,21 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2021 Arm Limited -# lib.mk sets CC. This switch triggers it to clang +# Set various Clang flags if LLVM is defined or CC is defined as clang +ifneq ($(LLVM),) +CLANG_LDFLAGS = -fuse-ld=lld +endif
What I meant was to have this block _after_ the one conditional on CC. This way we only need to set CLANG_LDFLAGS once (just in this block).
Kevin
+ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) +CLANG_LDFLAGS = -fuse-ld=lld +# Explicitly define LLVM to select CLANG_FLAGS appropriately in lib.mk LLVM := 1 +endif -CLANG_FLAGS = --target=aarch64-linux-gnu CFLAGS_PURECAP = -march=morello+c64 -mabi=purecap -CFLAGS_COMMON = -g -ffreestanding -Wall -Wextra -MMD +CFLAGS_COMMON = -ffreestanding -Wextra -MMD CFLAGS_COMMON += -nostdinc -isystem $(shell $(CC) -print-file-name=include 2>/dev/null) -CFLAGS_CLANG = $(CLANG_FLAGS) -integrated-as -CFLAGS += $(CFLAGS_CLANG) $(CFLAGS_PURECAP) $(CFLAGS_COMMON) -LDFLAGS := -fuse-ld=lld $(CLANG_FLAGS) -nostdlib -static +CFLAGS += $(CLANG_FLAGS) $(CFLAGS_PURECAP) $(CFLAGS_COMMON) +LDFLAGS += $(CLANG_LDFLAGS) $(CLANG_FLAGS) -nostdlib -static SRCS := $(wildcard *.c) $(wildcard *.S) PROGS := bootstrap clone exit mmap read_write sched signal