Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
@ 2026-12-02 16:37 Jan Polensky
  2026-12-02 16:47 ` sashiko-bot
  2026-12-02 16:48 ` Miguel Ojeda
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Polensky @ 2026-12-02 16:37 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Sven Schnelle, Miguel Ojeda, linux-s390,
	rust-for-linux

Newer rustc releases reject -Ctarget-feature=+backchain on s390x with

  error: target feature `backchain` cannot be enabled with
  `-Ctarget-feature`: use `-Cforce-frame-pointers` compiler flag instead

On s390x, -Cforce-frame-pointers now enables the "backchain" LLVM function
attribute instead of the generic "frame-pointer" attribute.

Switch the Rust flags to -Cforce-frame-pointers=y. The target stays
s390x-unknown-none-softfloat, which is required to combine backchain with
-Zpacked-stack.

Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
 arch/s390/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 8b712cd85fcd..3ec7e6d7a783 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -35,7 +35,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-array-bounds)
 
-KBUILD_RUSTFLAGS += --target=s390x-unknown-none-softfloat -Zpacked-stack -Ctarget-feature=+backchain
+KBUILD_RUSTFLAGS += --target=s390x-unknown-none-softfloat -Zpacked-stack -Cforce-frame-pointers=y
 
 UTS_MACHINE	:= s390x
 STACK_SIZE	:= $(if $(CONFIG_KASAN),65536,$(if $(CONFIG_KMSAN),65536,16384))
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
  2026-12-02 16:37 [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain Jan Polensky
@ 2026-12-02 16:47 ` sashiko-bot
  2026-12-02 16:48 ` Miguel Ojeda
  1 sibling, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-02 16:47 UTC (permalink / raw)
  To: Jan Polensky
  Cc: linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, ojeda, gary

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] s390/rust: missing Fixes trailer for commit 3f70ebe63858 in
  commit message
--

commit 9bb7f05b63052cacfd3fd0c009198517ed028f0a
Author: Jan Polensky <japo@linux.ibm.com>

> s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
>
> Newer rustc releases reject -Ctarget-feature=+backchain on s390x with
>
>   error: target feature `backchain` cannot be enabled with
>   `-Ctarget-feature`: use `-Cforce-frame-pointers` compiler flag instead
>
> On s390x, -Cforce-frame-pointers now enables the "backchain" LLVM function
> attribute instead of the generic "frame-pointer" attribute.
>
> Switch the Rust flags to -Cforce-frame-pointers=y. The target stays
> s390x-unknown-none-softfloat, which is required to combine backchain with
> -Zpacked-stack.
>
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>

[Severity: Low]
Since this fixes a build error with the flag introduced in 3f70ebe63858
("s390: Enable Rust support"), should the commit message include:

  Fixes: 3f70ebe63858 ("s390: Enable Rust support")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202163721.2587240-1-japo@linux.ibm.com?part=1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
  2026-12-02 16:37 [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain Jan Polensky
  2026-12-02 16:47 ` sashiko-bot
@ 2026-12-02 16:48 ` Miguel Ojeda
  2026-12-02 17:05   ` Gary Guo
  1 sibling, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2026-12-02 16:48 UTC (permalink / raw)
  To: Jan Polensky
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Miguel Ojeda, linux-s390,
	rust-for-linux

On Wed, Dec 2, 2026 at 5:37 PM Jan Polensky <japo@linux.ibm.com> wrote:
>
> Newer rustc releases reject -Ctarget-feature=+backchain on s390x with
>
>   error: target feature `backchain` cannot be enabled with
>   `-Ctarget-feature`: use `-Cforce-frame-pointers` compiler flag instead
>
> On s390x, -Cforce-frame-pointers now enables the "backchain" LLVM function
> attribute instead of the generic "frame-pointer" attribute.

But it didn't before, no? So what about older versions?

i.e. should we switch based on the version like we do often with these flags?

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
  2026-12-02 16:48 ` Miguel Ojeda
@ 2026-12-02 17:05   ` Gary Guo
  2026-12-03 20:18     ` Jan Polensky
  0 siblings, 1 reply; 6+ messages in thread
From: Gary Guo @ 2026-12-02 17:05 UTC (permalink / raw)
  To: Miguel Ojeda, Jan Polensky
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Miguel Ojeda, linux-s390,
	rust-for-linux

On Wed Dec 2, 2026 at 4:48 PM GMT, Miguel Ojeda wrote:
> On Wed, Dec 2, 2026 at 5:37 PM Jan Polensky <japo@linux.ibm.com> wrote:
>>
>> Newer rustc releases reject -Ctarget-feature=+backchain on s390x with
>>
>>   error: target feature `backchain` cannot be enabled with
>>   `-Ctarget-feature`: use `-Cforce-frame-pointers` compiler flag instead
>>
>> On s390x, -Cforce-frame-pointers now enables the "backchain" LLVM function
>> attribute instead of the generic "frame-pointer" attribute.
>
> But it didn't before, no? So what about older versions?
>
> i.e. should we switch based on the version like we do often with these flags?

Or switch on probe so that as long as `-Ctarget-feature=+backchain` is accepted
then still pass it.

We can unconditionally enable -Cforce-frame-pointers.

Best,
Gary


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
  2026-12-02 17:05   ` Gary Guo
@ 2026-12-03 20:18     ` Jan Polensky
  2026-12-03 22:09       ` Gary Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Polensky @ 2026-12-03 20:18 UTC (permalink / raw)
  To: Gary Guo, Miguel Ojeda
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Miguel Ojeda, linux-s390,
	rust-for-linux

Hi Miguel, Gary,

thanks for the feedback.

On Wed, Dec 02, 2026 at 05:05:23PM +0000, Gary Guo wrote:
> Or switch on probe so that as long as `-Ctarget-feature=+backchain` is
> accepted then still pass it.
>
> We can unconditionally enable -Cforce-frame-pointers.

Right, older rustc releases (1.96 to 1.101 for s390) do not enable
backchain through -Cforce-frame-pointers; that only came with
rust-lang/rust#163315 (milestone 1.102.0). Passing only
-Cforce-frame-pointers=y there would silently drop the backchain, so
a plain switch is not an option.

One way to handle both is to probe, so no version number is needed
(and it also covers 1.102 nightlies from before the change landed):

    KBUILD_RUSTFLAGS += --target=s390x-unknown-none-softfloat -Zpacked-stack
    KBUILD_RUSTFLAGS += $(call rustc-option,-Ctarget-feature=+backchain,-Cforce-frame-pointers=y)

I tested this with a 1.102.0-nightly: the probe is rejected and the
stable flag is used; with a rustc that accepts +backchain, only that
flag is used.

The downside is that rustc < 1.102 keeps printing

    warning: unstable feature specified for `-Ctarget-feature`: `backchain`

as it already did with the current code (see the discussion on the
s390 enablement series). The alternative to avoid that for good is to
raise the minimum rustc version for s390 to 1.102.0 in
scripts/min-tool-version.sh and pass only -Cforce-frame-pointers=y.
Since s390 Rust support is new, few users are affected, but it
means no released rustc is usable until 1.102 is out.

Do you have a preference between the probe (as above), a version-based
switch with rustc-min-version, or just raising the minimum version?

I will add a Fixes: 3f70ebe63858 ("s390: Enable Rust support") in v2,
as suggested by Sashiko, since it points to where the flag came from.

Thanks,
Jan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain
  2026-12-03 20:18     ` Jan Polensky
@ 2026-12-03 22:09       ` Gary Guo
  0 siblings, 0 replies; 6+ messages in thread
From: Gary Guo @ 2026-12-03 22:09 UTC (permalink / raw)
  To: Jan Polensky, Gary Guo, Miguel Ojeda
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Miguel Ojeda, linux-s390,
	rust-for-linux

On Thu Dec 3, 2026 at 8:18 PM GMT, Jan Polensky wrote:
> Hi Miguel, Gary,
>
> thanks for the feedback.
>
> On Wed, Dec 02, 2026 at 05:05:23PM +0000, Gary Guo wrote:
>> Or switch on probe so that as long as `-Ctarget-feature=+backchain` is
>> accepted then still pass it.
>>
>> We can unconditionally enable -Cforce-frame-pointers.
>
> Right, older rustc releases (1.96 to 1.101 for s390) do not enable
> backchain through -Cforce-frame-pointers; that only came with
> rust-lang/rust#163315 (milestone 1.102.0). Passing only
> -Cforce-frame-pointers=y there would silently drop the backchain, so
> a plain switch is not an option.
>
> One way to handle both is to probe, so no version number is needed
> (and it also covers 1.102 nightlies from before the change landed):
>
>     KBUILD_RUSTFLAGS += --target=s390x-unknown-none-softfloat -Zpacked-stack
>     KBUILD_RUSTFLAGS += $(call rustc-option,-Ctarget-feature=+backchain,-Cforce-frame-pointers=y)
>
> I tested this with a 1.102.0-nightly: the probe is rejected and the
> stable flag is used; with a rustc that accepts +backchain, only that
> flag is used.
>
> The downside is that rustc < 1.102 keeps printing
>
>     warning: unstable feature specified for `-Ctarget-feature`: `backchain`
>
> as it already did with the current code (see the discussion on the
> s390 enablement series). The alternative to avoid that for good is to
> raise the minimum rustc version for s390 to 1.102.0 in
> scripts/min-tool-version.sh and pass only -Cforce-frame-pointers=y.
> Since s390 Rust support is new, few users are affected, but it
> means no released rustc is usable until 1.102 is out.
>
> Do you have a preference between the probe (as above), a version-based
> switch with rustc-min-version, or just raising the minimum version?

I think keeping the backchain probe isn't a big deal even with warnings, but
incrementing minimum rustc version for s390 sounds reasonable too. Ultimately
it's up to the s390 folks to decide.

> I will add a Fixes: 3f70ebe63858 ("s390: Enable Rust support") in v2,
> as suggested by Sashiko, since it points to where the flag came from.

I don't think this is a fix (the old code is not buggy, just that new stable
compiler expects something different). A cc stable tag should suffice.

Best,
Gary


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-03 22:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 16:37 [PATCH v1 1/1] s390/rust: Use -Cforce-frame-pointers instead of -Ctarget-feature=+backchain Jan Polensky
2026-12-02 16:47 ` sashiko-bot
2026-12-02 16:48 ` Miguel Ojeda
2026-12-02 17:05   ` Gary Guo
2026-12-03 20:18     ` Jan Polensky
2026-12-03 22:09       ` Gary Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox