Re: [PATCH 1/2] alpha: enable building with clang
Magnus Lindholm <[email protected]> Mon, 3 Aug 2026 22:56:54 +0200
| Newsgroups | org.kernel.vger.linux-kbuild,dev.linux.lists.llvm,org.kernel.vger.linux-alpha,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CA+=Fv5SBitGj+c08Ymy3_JdeErKrRS_s5_RYgABjMraQUFg=Ww@mail.gmail.com> |
On Mon, Aug 3, 2026 at 7:08=E2=80=AFPM Matt Turner <[email protected]> wro= te: > > 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=3D1 (and LLVM_IAS=3D1) 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) :=3D -mcpu=3Dev56= -mtune=3Dev6 > cflags-y +=3D $(cpuflags-y) > > > +KBUILD_CFLAGS +=3D $(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 +=3D $(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 +=3D -Wa,-mev6 > +endif > > libs-y +=3D 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 conditio= n should also test the assembler rather than the compiler? ifdef CONFIG_AS_IS_GNU KBUILD_CFLAGS +=3D -Wa,-mev6 endif That preserves the option for both GCC and clang builds using GNU as, including clang with LLVM_IAS=3D0, 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