[PATCH 1/2] alpha: enable building with clang
Matt Turner <[email protected]> Mon, 03 Aug 2026 13:08:41 -0400
| Newsgroups | org.kernel.vger.linux-alpha,dev.linux.lists.llvm,org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Register the clang target triple for alpha, and pass -Wa,-mev6 only when building with gcc. That flag exists to stop gas emulating instructions the assembler thinks the target lacks; it is a gas-only option, and clang's integrated assembler does not emulate instructions in the first place, so nothing is needed there. With this, LLVM=1 (and LLVM_IAS=1) builds work. Note that the alpha backend is not in upstream LLVM yet; it lives in https://github.com/alphalinux-org/llvm-project and is a work in progress. Signed-off-by: Matt Turner <[email protected]> --- arch/alpha/Makefile | 8 +++++++- scripts/Makefile.clang | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile index 35445ff2e489..54283705911f 100644 --- a/arch/alpha/Makefile +++ b/arch/alpha/Makefile @@ -27,10 +27,16 @@ cpuflags-$(CONFIG_ALPHA_GENERIC) := -mcpu=ev56 -mtune=ev6 cflags-y += $(cpuflags-y) +KBUILD_CFLAGS += $(cflags-y) + # For TSUNAMI, we must have the assembler not emulate our instructions. # The same is true for IRONGATE, POLARIS, PYXIS. # BWX is most important, but we don't really want any emulation ever. -KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6 +# Only gas emulates instructions the target does not implement, and only gas +# understands -mev6; clang's integrated assembler never emulates. +ifdef CONFIG_CC_IS_GCC +KBUILD_CFLAGS += -Wa,-mev6 +endif libs-y += arch/alpha/lib/ diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index b67636b28c35..2434cf90ad7e 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -1,6 +1,7 @@ # Individual arch/{arch}/Makefiles should use -EL/-EB to set intended # endianness and -m32/-m64 to set word size based on Kconfigs instead of # relying on the target triple. +CLANG_TARGET_FLAGS_alpha := alpha-linux-gnu CLANG_TARGET_FLAGS_arm := arm-linux-gnueabi CLANG_TARGET_FLAGS_arm64 := aarch64-linux-gnu CLANG_TARGET_FLAGS_hexagon := hexagon-linux-musl -- 2.54.0