summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-18 15:53:18 -0600
committerTom Rini <[email protected]>2025-11-18 15:53:18 -0600
commita70b4f5cae7ebe0e7d9926645635f90994f6257f (patch)
treec17039335f0745b9d0bd86853bf44b161f03c985
parent91861e5a30d217d8e70130c9124c1646f4afef29 (diff)
parent2ed758fa7ef9e434c586ff5e12eeca7dfae7efb2 (diff)
Merge patch series "Fixes for Clang builds for AArch64, improve CROSS_COMPILE handling"
Dmitrii Sharshakov <[email protected]> says: Initially fix the inconsistency reported in reply to the previous series and also make sure AArch64 images can be built with latest Clang versions by guarding AArch32-specific options behind extra config checks. Tested qemu_arm_defconfig and qemu_arm64_defconfig with Clang 21, mainline (to be 22) ce7f9f9c and also Clang 18 (for AArch64 only, as I have not managed to build an AArch32 image with clang-18). Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--Makefile2
-rw-r--r--arch/arm/config.mk11
2 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 476bbfd8c03..9e79f7edab6 100644
--- a/Makefile
+++ b/Makefile
@@ -600,7 +600,7 @@ ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
ifneq ($(CROSS_COMPILE),)
CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
-CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
+CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE:%-=%))-
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
endif
ifneq ($(GCC_TOOLCHAIN),)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index ba7dd99672a..73fddd50bd7 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -30,18 +30,19 @@ PLATFORM_RELFLAGS += $(call cc-option,-mgeneral-regs-only)
endif
# LLVM support
-LLVM_RELFLAGS := $(call cc-option,-mllvm,) \
- $(call cc-option,-mno-movt,)
-PLATFORM_RELFLAGS += $(LLVM_RELFLAGS)
-
+LLVM_RELFLAGS := $(call cc-option,-mllvm,)
PLATFORM_CPPFLAGS += -D__ARM__
ifdef CONFIG_ARM64
PLATFORM_ELFFLAGS += -B aarch64 -O elf64-littleaarch64
else
PLATFORM_ELFFLAGS += -B arm -O elf32-littlearm
+# no-movt is only available when targeting AArch32
+LLVM_RELFLAGS += $(call cc-option,-mno-movt,)
endif
+PLATFORM_RELFLAGS += $(LLVM_RELFLAGS)
+
# Choose between ARM/Thumb instruction sets
ifeq ($(CONFIG_$(PHASE_)SYS_THUMB_BUILD),y)
AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always)
@@ -50,7 +51,7 @@ PF_CPPFLAGS_ARM := $(AFLAGS_IMPLICIT_IT) \
$(call cc-option,-marm,)\
$(call cc-option,-mno-thumb-interwork,)\
)
-else
+else ifneq ($(CONFIG_ARM64),y)
PF_CPPFLAGS_ARM := $(call cc-option,-marm,) \
$(call cc-option,-mno-thumb-interwork,)
endif