From: Nathan Chancellor <nathan@kernel.org>
To: Matt Turner <mattst88@gmail.com>
Cc: Richard Henderson <richard.henderson@linaro.org>,
Magnus Lindholm <linmag7@gmail.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Nicolas Schier <nsc@kernel.org>,
linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH 0/2] alpha: enable building with clang
Date: Mon, 3 Aug 2026 12:51:35 -0700 [thread overview]
Message-ID: <20260803195135.GA1083357@ax162> (raw)
In-Reply-To: <20260803-alpha-clang-v1-0-1c4ba5ba7a64@gmail.com>
Hi Matt,
On Mon, Aug 03, 2026 at 01:08:40PM -0400, Matt Turner wrote:
> Two small patches to let the alpha kernel build with clang.
Nice!
> The first registers the clang target triple and stops passing -Wa,-mev6
> when the compiler is not gcc. That flag exists to keep gas from emulating
> instructions it believes the target lacks; it is a gas-only option and
> clang's integrated assembler does not emulate instructions, so it is not
> needed there.
>
> The second fixes two uses of local register-asm variables that clang does
> not honor. clang treats `register unsigned long x __asm__("$N")` as the
> named register only where the variable appears as an inline-asm operand,
> so reading one to get the live $gp or $sp yields an undefined value.
> trap_init() passed that to PAL_wrkgp and load_PCB() stored it into the
> PCB for swpctx, either of which wedges an early boot.
>
> Note that the alpha backend is not in upstream LLVM. It lives in
>
> https://github.com/alphalinux-org/llvm-project
>
> and is a work in progress, so the scripts/Makefile.clang entry has no
> effect with an upstream clang today. I am sending this now because the
> second patch is a real bug in its own right -- the register-asm reads are
> only guaranteed to work by gcc's implementation, not by anything either
> compiler documents -- but I understand if the kbuild side would rather
> wait for the backend to land upstream.
Yeah, I am not sure how I feel taking the target triple part of the
first patch. On the one hand, I want it to be easy for you to test
against upstream Linux but on the other, I do not want people to read
this Makefile and assume that ARCH=alpha will work with an upstream
clang.
We could add a comment that the backend is currently out of tree but
that would go stale once it is actually upstream and it will be floating
around for forever. Maybe a better compromise is taking arch/alpha
changes now then landing the scripts/Makefile.clang change when you
actually start upstreaming the backend, as being able to use an upstream
version of clang should be relatively imminent at that point.
--
Cheers,
Nathan
prev parent reply other threads:[~2026-08-03 19:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 17:08 [PATCH 0/2] alpha: enable building with clang Matt Turner
2026-08-03 17:08 ` [PATCH 1/2] " Matt Turner
2026-08-03 20:56 ` Magnus Lindholm
2026-08-03 17:08 ` [PATCH 2/2] alpha: read $gp and $sp explicitly for clang Matt Turner
2026-08-03 21:15 ` Magnus Lindholm
2026-08-03 19:51 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260803195135.GA1083357@ax162 \
--to=nathan@kernel.org \
--cc=justinstitt@google.com \
--cc=linmag7@gmail.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mattst88@gmail.com \
--cc=morbo@google.com \
--cc=ndesaulniers@google.com \
--cc=nsc@kernel.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox