Re: [PATCH v3 4/4] s390: Enable Rust support

From: Heiko Carstens

Date: Wed May 27 2026 - 02:55:05 EST


On Wed, May 27, 2026 at 05:59:43AM +0000, Alice Ryhl wrote:
> On Thu, May 21, 2026 at 06:56:22PM +0200, Jan Polensky wrote:
> > Enable building Rust code on s390 by wiring the architecture into the
> > kernel Rust infrastructure.
> >
> > Add s390 to the Rust arch support documentation, provide the s390 Rust
> > target and required compiler flags, and set the bindgen target for
> > arch/s390. Adjust the Rust target generation and minimum rustc version
> > gating so the s390 setup is handled explicitly.
> >
> > The Rust toolchain uses the "s390x" triple naming for the 64 bit target.
> >
> > Rust support is currently incompatible with CONFIG_EXPOLINE, which
> > relies on compiler support for the -mindirect-branch= and
> > -mfunction_return= options. Therefore, select HAVE_RUST only when
> > EXPOLINE is disabled.
> >
> > Signed-off-by: Jan Polensky <japo@xxxxxxxxxxxxx>
>
> > diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh
> > index b96ec2d379b6..296acf8f71aa 100755
> > --- a/scripts/min-tool-version.sh
> > +++ b/scripts/min-tool-version.sh
> > @@ -31,7 +31,11 @@ llvm)
> > fi
> > ;;
> > rustc)
> > - echo 1.85.0
> > + if [ "$SRCARCH" = "s390" ]; then
> > + echo 1.96.0
> > + else
> > + echo 1.85.0
> > + fi
>
> For other version constraints we have listed them in the Kconfig file to
> guard the select HAVE_RUST or similar annotations instead of here. Is
> this the best place to add this constraint?

This is supposed to be the default location for such constraints.

See also the current limitiations for gcc and llvm in the same file, or the
previous limitations of llvm for x86 and s390, which have been removed with
commit 20c098928356 ("kbuild: Bump minimum version of LLVM for building the
kernel to 15.0.0").