Re: [PATCH 1/2] alpha: enable building with clang
Magnus Lindholm <[email protected]> Mon, 3 Aug 2026 22:56:54 +0200
| Newsgroups | gmane.linux.kbuild.devel,gmane.linux.ports.alpha,gmane.linux.kernel |
|---|---|
| Message-ID | <CA+=Fv5SBitGj+c08Ymy3_JdeErKrRS_s5_RYgABjMraQUFg=Ww@mail.gmail.com> |
On Mon, Aug 3, 2026 at 7:08 PM Matt Turner <[email protected]> wrote: > > 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/ > Hi Matt, I agree with Nathan's suggestion to leave the CLANG_TARGET_FLAGS_alpha entry out for now and add it separately when the Alpha backend is being upstreamed to LLVM. Could you send a v2 containing just the arch/alpha/Makefile change? Since -Wa,-mev6 is an assembler-specific option, I think maybe the condition should also test the assembler rather than the compiler? ifdef CONFIG_AS_IS_GNU KBUILD_CFLAGS += -Wa,-mev6 endif That preserves the option for both GCC and clang builds using GNU as, including clang with LLVM_IAS=0, while omitting it for LLVM's integrated assembler. The revised Alpha Makefile patch can then go through the Alpha tree, while the scripts/Makefile.clang change can wait until the backend is available upstream. Thanks, Magnus