Repository navigation
add rustc option -Zpacked-stack - #152432
Conversation
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'll add tests for assembly output and for target incompatibility. |
This comment has been minimized.
This comment has been minimized.
5ddcabb to
4ebec9d
Compare
This comment has been minimized.
This comment has been minimized.
0d6d167 to
0c182af
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0c182af to
7fef6ea
Compare
This comment has been minimized.
This comment has been minimized.
|
ok, i think most should be ok now. |
This comment has been minimized.
This comment has been minimized.
7fef6ea to
31a40dc
Compare
| if sess.target.arch == Arch::S390x | ||
| && sess.opts.unstable_opts.packed_stack | ||
| && sess.unstable_target_features.contains(&Symbol::intern(&"backchain")) | ||
| && sess.target.abi != Abi::SoftFloat |
There was a problem hiding this comment.
target.abi is just in charge of cfg(target_abi), it doesn't control the actual ABI. Please check rustc_abi which controls the actual ABI.
There was a problem hiding this comment.
changed it to check on the soft-float unstable_target_feature which llvm will evaluate to switch abi for s390x.
There was a problem hiding this comment.
I think checking rustc_abi makes most sense.
| // this is the first place in the `run_compiler` flow where all this is available | ||
| if sess.target.arch == Arch::S390x | ||
| && sess.opts.unstable_opts.packed_stack | ||
| && sess.unstable_target_features.contains(&Symbol::intern(&"backchain")) |
There was a problem hiding this comment.
What happens if someone tries to enable backchain just for a particular function via #[target_feature] instead of -Ctarget-feature?
There was a problem hiding this comment.
ufff yes we have to check this for every call to llfn_attrs_from_instance at compiler runtime. is it ok to do ....contains(&Symbol::intern(... every time?
There was a problem hiding this comment.
from_target_feature_attr is probably a better, higher-level place to check this?
You can add backchain as a pre-interned symbol in compiler/rustc_span/src/symbol.rs so you don't have to re-intern it every time.
There was a problem hiding this comment.
I am back on working on this. yes in from_target_feature_attr we can check for the #[target_feature(...)] attributes. BUT unfortunately not for the -Ctarget-feature... attributes ..
There was a problem hiding this comment.
Yeah the handling for -Ctarget-feature and #[target_feature] is entirely separate. Maybe it's possible to introduce a new helper that gets called form those 2 places and that performs these kinds of consistency checks?
There was a problem hiding this comment.
Ah I see you're now doing the check in packed_stack_attr. That also seems reasonable.
This comment has been minimized.
This comment has been minimized.
d886fbf to
f39c52b
Compare
|
@rustbot ready |
|
The interaction with LLVM looks fine. A question I have is whether it is normal to emit errors during codegen attribute lowering? Do I understand correctly that if |
Yeah it's a hack to deal with a somewhat ill-behaved target. Can you think of a better way of dealing with this? |
Not having |
Options:disallow
|
s390x has a frame pointer, which is used for accessing local variables and stack slots in functions using variable-sized stack allocation - the main purpose of frame pointers everywhere. On some other platforms (in particular x86 and arm), the frame pointer can also be used for stack unwinding, but that does not work on s390x, because our frame pointer indicates the bottom of the stack frame (like the stack pointer), not the top of the stack frame. The main reason for this is that some instructions do not support negative displacements, so a pointer to the top of the stack frame would be awkward to use. Because the frame pointer is not usable for stack unwinding, there's no point in trying to use something like |
|
Not sure whether the per-function notion is a particular problem, but this aspect isn't really important - users typically enable backchain for the whole compilation unit. The fact that this is modeled in LLVM as a "target feature" is really more of an implementation detail. If this simplifies the Rust logic, I'd also be fine with only supporting a command line option like The one important use case is the Linux kernel, which is fully built with backchain, packed-stack, and soft-float. This combination must work (and be active for the kernel target). |
Yeah this is currently not a thing. Conceptually it's not that hard to add, but doing it in a way that the target feature table does not become a lot more verbose could be tricky. This is all still unstable obviously so we could also just leave a note on the backchain tracking issue that this should probably not be stabilized for per-function use, only for |
I think in practice, "I want a frame pointer" really means "I want non-DWARF unwind", which is why I consider frame pointers and backchain to be the same thing, even if they technically aren't... But I guess the ship here has sailed in terms of option naming. |
|
@bors r+ As everything involved here is unstable anyway, I think this is fine to land as-is... |
Rollup merge of #152432 - fneddy:s390x_packed_stack_attribute, r=nikic add rustc option -Zpacked-stack this enables `-Zpacked-stack` just as `-mpacked-stack` in clang and gcc. packed-stack is needed on s390x for kernel development. For reference: #151154 and #150766 look at @uweigand s post for full explanation of what this does. Here a wrap-up: #150766 (comment) > [...] > packed-stack [...] modifies how the compiler-generated function prolog/epilog code makes use of the 160 byte register save area provided by a caller to the callee [...] this variant is not actually incompatible with the ABI - packed-stack and regular functions can freely call each other without ABI issues. > [...] > combination of -mpacked-stack and -mbackchain [...] the location in the stack frame where the backchain link ought to be stored is not available. [...] is not supported at all with the default ABI > [...] > However, in the special case of also using soft-float, our (implied) soft-float ABI provides a different location for the backchain that is compatible with -mpacked-stack, so that combination should be supported > [...]
…uwer Rollup of 4 pull requests Successful merges: - rust-lang/rust#150752 (Update libc to v0.2.183) - rust-lang/rust#152432 (add rustc option -Zpacked-stack) - rust-lang/rust#154634 (Use `Hcx`/`hcx` consistently for `StableHashingContext`.) - rust-lang/rust#154635 (./x run miri: default to edition 2021)
…ywiser s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers # Summary On s390x, the `backchain` LLVM function attribute saves the "unwind" (backchain) pointer (r15) into the caller's parameter area, enabling external stack unwinders (e.g. Linux perf) to walk the call chain. Previously this was enabled via `-Ctarget-feature=+backchain`, which piggy-backed on the target-feature machinery even though backchain is not a CPU or ISA feature. This commit introduces a cleaner mechanism: - `-Cforce-frame-pointers` now enables the `"backchain"` LLVM *function attribute* on s390x, rather than the generic `"frame-pointer"` attribute used on other architectures. - `-Ctarget-feature=+backchain` emits a error pointing to the new mechanism. - Other reasons to set frame pointers (e.g. `-Zinstrument-mcount`) are unaffected and still emit `"frame-pointer"`. - All s390x-specific frame-pointer/backchain/packed-stack logic is consolidated in `s390x_fn_attrs()` in `attributes.rs`. This implements the proposed solution discussed on Zulip [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/with/628127751). # Background ## Frame pointers on s390x Setting `-Cforce-frame-pointers=yes` on s390x forces the `"frame-pointer"` LLVM attribute, but this does **not** form a traversable linked list. As [@uweigand] explained ([rust-lang#150766 comment]): > Even *if* we force frame pointer registers to be used, those are not stored on the stack in a way that forms a linked list that can be followed. The `-mbackchain` option simply generates prolog code that manages an equivalent linked list of stack frames at runtime. Therefore `-Cforce-frame-pointers` on s390x provides **no stack-walking benefit**. ## Backchain The [s390x ELF ABI](https://github.com/IBM/s390x-abi/releases/tag/v1.6.1) reserves **backchain slot** - a pointer back to the caller's frame. This can be used to walk the entire call chain without DWARF CFI. LLVM exposes this as the `"backchain"` function attribute, equivalent to GCC's `-mbackchain`. Backchain is **not** a CPU capability. It is a whole-binary code-generation convention, similar in nature to `-fno-omit-frame-pointer` on x86. This is reflected in LLVM modelling it as a *function attribute*, not a target feature [rust-lang#150766 comment 2]. Enabling backchain does **not** break ABI compatibility: backchain-enabled and -disabled functions can freely call each other. The one notable exception is `packed-stack`: combining `-Zpacked-stack` with backchain on a non-softfloat target is rejected at compile time([rust-lang#152432]). ## rustc arg discussion Initially backchain was introduced as an unstable `target-feature` mimicking the gcc and clang behavior. Within the grater effort of stabilizing arguments that are needed for Linux Kernel development(Rust-for-Linux/linux#2), attempts where made to stabilize the `target-feature=+backchain`. This lead to discussions and the overall consent is that: 1. **on s390x, enabling *normal* `frame-poitners` will *never* be done by the user.** > There is never any reason to do the latter, and always forcing it would simply cause extra unnecessary run-time overhead when you only actually want the backchain. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619573547) > The problem is that *even when we have a frame pointer*, it cannot be used for unwinding because it *points to the wrong location*. > @uweigand, [rust-lang#158612](rust-lang#158612 (comment)) 2. **if a user wants `frame-pointers` the user actually wants: stack-unwinding on x86 via `frame-pointers` but on `s390x` via `backchain`** > People being told by the internet that -Cforce-frame-pointers=yes makes their gdb bt/perf stack trace collection/etc" work get the right behaviour on s390x as well. > @nagisa, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) > upstream would prefer to reuse fp rather than adding a new option (because fp cannot work for frame-pointer unwinding anyway [...]) > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) > we'd like to understand why `-Cforce-frame-pointers` can't be treated as "not perfect" name for `-mbackchain` on s390x > @Mark-Simulacrum, [rust-lang#158612](rust-lang#158612 (comment)) 3. **`-Cforce-frame-pointers=yes` should on `s390x` enable `backchain` and **NOT** the `frame-pointer` attribute** > As one of the s390x target maintainers, I would be OK with using -Cforce-frame-pointers to enable backchain on s390x while not forcing actual framepointer (r11) usage. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619778159) > I'm happy to second this with the "re-use -Cforce-frame-pointers" approach above (implemented requiring -Zunstable-options on s390x initially) > @davidtwco, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/624886154) 4. **the old `-Ctarget-feature=+backchain` pattern should emit a nice error and point to `-Cforce-frame-pointers=yes`** > ... which also leads to a nicer error. You can set hard_error: true for that so we don't have to worry about the validation logic. > @RalfJung [rust-lang#163315](rust-lang#163315 (comment)) 5. **the kernel folks are ok with an instant change of behavior without a deprecation period** > a hard switch would be perfectly fine. The grace period actually caused some confusion on my side > @dev-japo [rust-lang#163315](rust-lang#163315 (comment)) # Alternatives Most alternatives where discussed and ruled out: - make `-Ctarget-feature=+backchain` stable: backchain is not a real target-feature as its not part of the ISA or architecture. We rather don't want `backchain` to remain a `target-feature` - create a new rustc flag `-Zbackhain`: If the purpose of `backchain` is already covered by other flags or options we shouldn't add a new flag. - create a new rustc flag to enable stack-walking (e.g.`-Cstack-walking-support`): Most people mean this by setting `-Cforce-frame-pointers`. We should rather make the compiler behave as expected. # Concerns Enabling backchain via `-Cforce-frame-pointers` is low-risk and not a dead end. Backchain is an established, documented option in LLVM, Clang and GCC. Mixing code with and without it is safe. Reusing the flag matches how users and other tools expect `frame-pointers` to behave. > there are no ABI concerns with this feature (having some parts of the code compiled with and some without can lead to poor backtraces but doesn't break anything worse than that) > @RalfJung , relaying @uweigand , [rust-lang#158612](rust-lang#158612 (comment)) > reusing the option would make things easier for existing users > @uweigand , [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) A real frame pointer can still get its own flag if anyone ever needs it. > if they do actually want the actual frame pointers in the wrong place of the stack, we can add -Cforce-frame-pointers=the-broken-s390x-option for them or something > @nagisa [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) # References - rust-lang#127506 - rust-lang#129927 - rust-lang#129940 - rust-lang#142412 - rust-lang#150259 - rust-lang#150766 - rust-lang#151154 - rust-lang#152432 - rust-lang#158014 - rust-lang#158612 - rust-lang#163315
…ywiser s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers # Summary On s390x, the `backchain` LLVM function attribute saves the "unwind" (backchain) pointer (r15) into the caller's parameter area, enabling external stack unwinders (e.g. Linux perf) to walk the call chain. Previously this was enabled via `-Ctarget-feature=+backchain`, which piggy-backed on the target-feature machinery even though backchain is not a CPU or ISA feature. This commit introduces a cleaner mechanism: - `-Cforce-frame-pointers` now enables the `"backchain"` LLVM *function attribute* on s390x, rather than the generic `"frame-pointer"` attribute used on other architectures. - `-Ctarget-feature=+backchain` emits a error pointing to the new mechanism. - Other reasons to set frame pointers (e.g. `-Zinstrument-mcount`) are unaffected and still emit `"frame-pointer"`. - All s390x-specific frame-pointer/backchain/packed-stack logic is consolidated in `s390x_fn_attrs()` in `attributes.rs`. This implements the proposed solution discussed on Zulip [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/with/628127751). # Background ## Frame pointers on s390x Setting `-Cforce-frame-pointers=yes` on s390x forces the `"frame-pointer"` LLVM attribute, but this does **not** form a traversable linked list. As [@uweigand] explained ([rust-lang#150766 comment]): > Even *if* we force frame pointer registers to be used, those are not stored on the stack in a way that forms a linked list that can be followed. The `-mbackchain` option simply generates prolog code that manages an equivalent linked list of stack frames at runtime. Therefore `-Cforce-frame-pointers` on s390x provides **no stack-walking benefit**. ## Backchain The [s390x ELF ABI](https://github.com/IBM/s390x-abi/releases/tag/v1.6.1) reserves **backchain slot** - a pointer back to the caller's frame. This can be used to walk the entire call chain without DWARF CFI. LLVM exposes this as the `"backchain"` function attribute, equivalent to GCC's `-mbackchain`. Backchain is **not** a CPU capability. It is a whole-binary code-generation convention, similar in nature to `-fno-omit-frame-pointer` on x86. This is reflected in LLVM modelling it as a *function attribute*, not a target feature [rust-lang#150766 comment 2]. Enabling backchain does **not** break ABI compatibility: backchain-enabled and -disabled functions can freely call each other. The one notable exception is `packed-stack`: combining `-Zpacked-stack` with backchain on a non-softfloat target is rejected at compile time([rust-lang#152432]). ## rustc arg discussion Initially backchain was introduced as an unstable `target-feature` mimicking the gcc and clang behavior. Within the grater effort of stabilizing arguments that are needed for Linux Kernel development(Rust-for-Linux/linux#2), attempts where made to stabilize the `target-feature=+backchain`. This lead to discussions and the overall consent is that: 1. **on s390x, enabling *normal* `frame-poitners` will *never* be done by the user.** > There is never any reason to do the latter, and always forcing it would simply cause extra unnecessary run-time overhead when you only actually want the backchain. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619573547) > The problem is that *even when we have a frame pointer*, it cannot be used for unwinding because it *points to the wrong location*. > @uweigand, [rust-lang#158612](rust-lang#158612 (comment)) 2. **if a user wants `frame-pointers` the user actually wants: stack-unwinding on x86 via `frame-pointers` but on `s390x` via `backchain`** > People being told by the internet that -Cforce-frame-pointers=yes makes their gdb bt/perf stack trace collection/etc" work get the right behaviour on s390x as well. > @nagisa, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) > upstream would prefer to reuse fp rather than adding a new option (because fp cannot work for frame-pointer unwinding anyway [...]) > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) > we'd like to understand why `-Cforce-frame-pointers` can't be treated as "not perfect" name for `-mbackchain` on s390x > @Mark-Simulacrum, [rust-lang#158612](rust-lang#158612 (comment)) 3. **`-Cforce-frame-pointers=yes` should on `s390x` enable `backchain` and **NOT** the `frame-pointer` attribute** > As one of the s390x target maintainers, I would be OK with using -Cforce-frame-pointers to enable backchain on s390x while not forcing actual framepointer (r11) usage. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619778159) > I'm happy to second this with the "re-use -Cforce-frame-pointers" approach above (implemented requiring -Zunstable-options on s390x initially) > @davidtwco, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/624886154) 4. **the old `-Ctarget-feature=+backchain` pattern should emit a nice error and point to `-Cforce-frame-pointers=yes`** > ... which also leads to a nicer error. You can set hard_error: true for that so we don't have to worry about the validation logic. > @RalfJung [rust-lang#163315](rust-lang#163315 (comment)) 5. **the kernel folks are ok with an instant change of behavior without a deprecation period** > a hard switch would be perfectly fine. The grace period actually caused some confusion on my side > @dev-japo [rust-lang#163315](rust-lang#163315 (comment)) # Alternatives Most alternatives where discussed and ruled out: - make `-Ctarget-feature=+backchain` stable: backchain is not a real target-feature as its not part of the ISA or architecture. We rather don't want `backchain` to remain a `target-feature` - create a new rustc flag `-Zbackhain`: If the purpose of `backchain` is already covered by other flags or options we shouldn't add a new flag. - create a new rustc flag to enable stack-walking (e.g.`-Cstack-walking-support`): Most people mean this by setting `-Cforce-frame-pointers`. We should rather make the compiler behave as expected. # Concerns Enabling backchain via `-Cforce-frame-pointers` is low-risk and not a dead end. Backchain is an established, documented option in LLVM, Clang and GCC. Mixing code with and without it is safe. Reusing the flag matches how users and other tools expect `frame-pointers` to behave. > there are no ABI concerns with this feature (having some parts of the code compiled with and some without can lead to poor backtraces but doesn't break anything worse than that) > @RalfJung , relaying @uweigand , [rust-lang#158612](rust-lang#158612 (comment)) > reusing the option would make things easier for existing users > @uweigand , [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) A real frame pointer can still get its own flag if anyone ever needs it. > if they do actually want the actual frame pointers in the wrong place of the stack, we can add -Cforce-frame-pointers=the-broken-s390x-option for them or something > @nagisa [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) # References - rust-lang#127506 - rust-lang#129927 - rust-lang#129940 - rust-lang#142412 - rust-lang#150259 - rust-lang#150766 - rust-lang#151154 - rust-lang#152432 - rust-lang#158014 - rust-lang#158612 - rust-lang#163315
Rollup merge of #163315 - fneddy:s390x_framepointer, r=wesleywiser s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers # Summary On s390x, the `backchain` LLVM function attribute saves the "unwind" (backchain) pointer (r15) into the caller's parameter area, enabling external stack unwinders (e.g. Linux perf) to walk the call chain. Previously this was enabled via `-Ctarget-feature=+backchain`, which piggy-backed on the target-feature machinery even though backchain is not a CPU or ISA feature. This commit introduces a cleaner mechanism: - `-Cforce-frame-pointers` now enables the `"backchain"` LLVM *function attribute* on s390x, rather than the generic `"frame-pointer"` attribute used on other architectures. - `-Ctarget-feature=+backchain` emits a error pointing to the new mechanism. - Other reasons to set frame pointers (e.g. `-Zinstrument-mcount`) are unaffected and still emit `"frame-pointer"`. - All s390x-specific frame-pointer/backchain/packed-stack logic is consolidated in `s390x_fn_attrs()` in `attributes.rs`. This implements the proposed solution discussed on Zulip [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/with/628127751). # Background ## Frame pointers on s390x Setting `-Cforce-frame-pointers=yes` on s390x forces the `"frame-pointer"` LLVM attribute, but this does **not** form a traversable linked list. As [@uweigand] explained ([#150766 comment]): > Even *if* we force frame pointer registers to be used, those are not stored on the stack in a way that forms a linked list that can be followed. The `-mbackchain` option simply generates prolog code that manages an equivalent linked list of stack frames at runtime. Therefore `-Cforce-frame-pointers` on s390x provides **no stack-walking benefit**. ## Backchain The [s390x ELF ABI](https://github.com/IBM/s390x-abi/releases/tag/v1.6.1) reserves **backchain slot** - a pointer back to the caller's frame. This can be used to walk the entire call chain without DWARF CFI. LLVM exposes this as the `"backchain"` function attribute, equivalent to GCC's `-mbackchain`. Backchain is **not** a CPU capability. It is a whole-binary code-generation convention, similar in nature to `-fno-omit-frame-pointer` on x86. This is reflected in LLVM modelling it as a *function attribute*, not a target feature [#150766 comment 2]. Enabling backchain does **not** break ABI compatibility: backchain-enabled and -disabled functions can freely call each other. The one notable exception is `packed-stack`: combining `-Zpacked-stack` with backchain on a non-softfloat target is rejected at compile time([#152432]). ## rustc arg discussion Initially backchain was introduced as an unstable `target-feature` mimicking the gcc and clang behavior. Within the grater effort of stabilizing arguments that are needed for Linux Kernel development(Rust-for-Linux/linux#2), attempts where made to stabilize the `target-feature=+backchain`. This lead to discussions and the overall consent is that: 1. **on s390x, enabling *normal* `frame-poitners` will *never* be done by the user.** > There is never any reason to do the latter, and always forcing it would simply cause extra unnecessary run-time overhead when you only actually want the backchain. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619573547) > The problem is that *even when we have a frame pointer*, it cannot be used for unwinding because it *points to the wrong location*. > @uweigand, [#158612](#158612 (comment)) 2. **if a user wants `frame-pointers` the user actually wants: stack-unwinding on x86 via `frame-pointers` but on `s390x` via `backchain`** > People being told by the internet that -Cforce-frame-pointers=yes makes their gdb bt/perf stack trace collection/etc" work get the right behaviour on s390x as well. > @nagisa, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) > upstream would prefer to reuse fp rather than adding a new option (because fp cannot work for frame-pointer unwinding anyway [...]) > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) > we'd like to understand why `-Cforce-frame-pointers` can't be treated as "not perfect" name for `-mbackchain` on s390x > @Mark-Simulacrum, [#158612](#158612 (comment)) 3. **`-Cforce-frame-pointers=yes` should on `s390x` enable `backchain` and **NOT** the `frame-pointer` attribute** > As one of the s390x target maintainers, I would be OK with using -Cforce-frame-pointers to enable backchain on s390x while not forcing actual framepointer (r11) usage. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619778159) > I'm happy to second this with the "re-use -Cforce-frame-pointers" approach above (implemented requiring -Zunstable-options on s390x initially) > @davidtwco, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/624886154) 4. **the old `-Ctarget-feature=+backchain` pattern should emit a nice error and point to `-Cforce-frame-pointers=yes`** > ... which also leads to a nicer error. You can set hard_error: true for that so we don't have to worry about the validation logic. > @RalfJung [#163315](#163315 (comment)) 5. **the kernel folks are ok with an instant change of behavior without a deprecation period** > a hard switch would be perfectly fine. The grace period actually caused some confusion on my side > @dev-japo [#163315](#163315 (comment)) # Alternatives Most alternatives where discussed and ruled out: - make `-Ctarget-feature=+backchain` stable: backchain is not a real target-feature as its not part of the ISA or architecture. We rather don't want `backchain` to remain a `target-feature` - create a new rustc flag `-Zbackhain`: If the purpose of `backchain` is already covered by other flags or options we shouldn't add a new flag. - create a new rustc flag to enable stack-walking (e.g.`-Cstack-walking-support`): Most people mean this by setting `-Cforce-frame-pointers`. We should rather make the compiler behave as expected. # Concerns Enabling backchain via `-Cforce-frame-pointers` is low-risk and not a dead end. Backchain is an established, documented option in LLVM, Clang and GCC. Mixing code with and without it is safe. Reusing the flag matches how users and other tools expect `frame-pointers` to behave. > there are no ABI concerns with this feature (having some parts of the code compiled with and some without can lead to poor backtraces but doesn't break anything worse than that) > @RalfJung , relaying @uweigand , [#158612](#158612 (comment)) > reusing the option would make things easier for existing users > @uweigand , [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) A real frame pointer can still get its own flag if anyone ever needs it. > if they do actually want the actual frame pointers in the wrong place of the stack, we can add -Cforce-frame-pointers=the-broken-s390x-option for them or something > @nagisa [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) # References - #127506 - #129927 - #129940 - #142412 - #150259 - #150766 - #151154 - #152432 - #158014 - #158612 - #163315
s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers # Summary On s390x, the `backchain` LLVM function attribute saves the "unwind" (backchain) pointer (r15) into the caller's parameter area, enabling external stack unwinders (e.g. Linux perf) to walk the call chain. Previously this was enabled via `-Ctarget-feature=+backchain`, which piggy-backed on the target-feature machinery even though backchain is not a CPU or ISA feature. This commit introduces a cleaner mechanism: - `-Cforce-frame-pointers` now enables the `"backchain"` LLVM *function attribute* on s390x, rather than the generic `"frame-pointer"` attribute used on other architectures. - `-Ctarget-feature=+backchain` emits a error pointing to the new mechanism. - Other reasons to set frame pointers (e.g. `-Zinstrument-mcount`) are unaffected and still emit `"frame-pointer"`. - All s390x-specific frame-pointer/backchain/packed-stack logic is consolidated in `s390x_fn_attrs()` in `attributes.rs`. This implements the proposed solution discussed on Zulip [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/with/628127751). # Background ## Frame pointers on s390x Setting `-Cforce-frame-pointers=yes` on s390x forces the `"frame-pointer"` LLVM attribute, but this does **not** form a traversable linked list. As [@uweigand] explained ([rust-lang/rust#150766 comment]): > Even *if* we force frame pointer registers to be used, those are not stored on the stack in a way that forms a linked list that can be followed. The `-mbackchain` option simply generates prolog code that manages an equivalent linked list of stack frames at runtime. Therefore `-Cforce-frame-pointers` on s390x provides **no stack-walking benefit**. ## Backchain The [s390x ELF ABI](https://github.com/IBM/s390x-abi/releases/tag/v1.6.1) reserves **backchain slot** - a pointer back to the caller's frame. This can be used to walk the entire call chain without DWARF CFI. LLVM exposes this as the `"backchain"` function attribute, equivalent to GCC's `-mbackchain`. Backchain is **not** a CPU capability. It is a whole-binary code-generation convention, similar in nature to `-fno-omit-frame-pointer` on x86. This is reflected in LLVM modelling it as a *function attribute*, not a target feature [rust-lang/rust#150766 comment 2]. Enabling backchain does **not** break ABI compatibility: backchain-enabled and -disabled functions can freely call each other. The one notable exception is `packed-stack`: combining `-Zpacked-stack` with backchain on a non-softfloat target is rejected at compile time([rust-lang/rust#152432]). ## rustc arg discussion Initially backchain was introduced as an unstable `target-feature` mimicking the gcc and clang behavior. Within the grater effort of stabilizing arguments that are needed for Linux Kernel development(Rust-for-Linux/linux#2), attempts where made to stabilize the `target-feature=+backchain`. This lead to discussions and the overall consent is that: 1. **on s390x, enabling *normal* `frame-poitners` will *never* be done by the user.** > There is never any reason to do the latter, and always forcing it would simply cause extra unnecessary run-time overhead when you only actually want the backchain. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619573547) > The problem is that *even when we have a frame pointer*, it cannot be used for unwinding because it *points to the wrong location*. > @uweigand, [#158612](rust-lang/rust#158612 (comment)) 2. **if a user wants `frame-pointers` the user actually wants: stack-unwinding on x86 via `frame-pointers` but on `s390x` via `backchain`** > People being told by the internet that -Cforce-frame-pointers=yes makes their gdb bt/perf stack trace collection/etc" work get the right behaviour on s390x as well. > @nagisa, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) > upstream would prefer to reuse fp rather than adding a new option (because fp cannot work for frame-pointer unwinding anyway [...]) > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) > we'd like to understand why `-Cforce-frame-pointers` can't be treated as "not perfect" name for `-mbackchain` on s390x > @Mark-Simulacrum, [#158612](rust-lang/rust#158612 (comment)) 3. **`-Cforce-frame-pointers=yes` should on `s390x` enable `backchain` and **NOT** the `frame-pointer` attribute** > As one of the s390x target maintainers, I would be OK with using -Cforce-frame-pointers to enable backchain on s390x while not forcing actual framepointer (r11) usage. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619778159) > I'm happy to second this with the "re-use -Cforce-frame-pointers" approach above (implemented requiring -Zunstable-options on s390x initially) > @davidtwco, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/624886154) 4. **the old `-Ctarget-feature=+backchain` pattern should emit a nice error and point to `-Cforce-frame-pointers=yes`** > ... which also leads to a nicer error. You can set hard_error: true for that so we don't have to worry about the validation logic. > @RalfJung [#163315](rust-lang/rust#163315 (comment)) 5. **the kernel folks are ok with an instant change of behavior without a deprecation period** > a hard switch would be perfectly fine. The grace period actually caused some confusion on my side > @dev-japo [#163315](rust-lang/rust#163315 (comment)) # Alternatives Most alternatives where discussed and ruled out: - make `-Ctarget-feature=+backchain` stable: backchain is not a real target-feature as its not part of the ISA or architecture. We rather don't want `backchain` to remain a `target-feature` - create a new rustc flag `-Zbackhain`: If the purpose of `backchain` is already covered by other flags or options we shouldn't add a new flag. - create a new rustc flag to enable stack-walking (e.g.`-Cstack-walking-support`): Most people mean this by setting `-Cforce-frame-pointers`. We should rather make the compiler behave as expected. # Concerns Enabling backchain via `-Cforce-frame-pointers` is low-risk and not a dead end. Backchain is an established, documented option in LLVM, Clang and GCC. Mixing code with and without it is safe. Reusing the flag matches how users and other tools expect `frame-pointers` to behave. > there are no ABI concerns with this feature (having some parts of the code compiled with and some without can lead to poor backtraces but doesn't break anything worse than that) > @RalfJung , relaying @uweigand , [#158612](rust-lang/rust#158612 (comment)) > reusing the option would make things easier for existing users > @uweigand , [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) A real frame pointer can still get its own flag if anyone ever needs it. > if they do actually want the actual frame pointers in the wrong place of the stack, we can add -Cforce-frame-pointers=the-broken-s390x-option for them or something > @nagisa [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) # References - rust-lang/rust#127506 - rust-lang/rust#129927 - rust-lang/rust#129940 - rust-lang/rust#142412 - rust-lang/rust#150259 - rust-lang/rust#150766 - rust-lang/rust#151154 - rust-lang/rust#152432 - rust-lang/rust#158014 - rust-lang/rust#158612 - rust-lang/rust#163315
s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers # Summary On s390x, the `backchain` LLVM function attribute saves the "unwind" (backchain) pointer (r15) into the caller's parameter area, enabling external stack unwinders (e.g. Linux perf) to walk the call chain. Previously this was enabled via `-Ctarget-feature=+backchain`, which piggy-backed on the target-feature machinery even though backchain is not a CPU or ISA feature. This commit introduces a cleaner mechanism: - `-Cforce-frame-pointers` now enables the `"backchain"` LLVM *function attribute* on s390x, rather than the generic `"frame-pointer"` attribute used on other architectures. - `-Ctarget-feature=+backchain` emits a error pointing to the new mechanism. - Other reasons to set frame pointers (e.g. `-Zinstrument-mcount`) are unaffected and still emit `"frame-pointer"`. - All s390x-specific frame-pointer/backchain/packed-stack logic is consolidated in `s390x_fn_attrs()` in `attributes.rs`. This implements the proposed solution discussed on Zulip [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/with/628127751). # Background ## Frame pointers on s390x Setting `-Cforce-frame-pointers=yes` on s390x forces the `"frame-pointer"` LLVM attribute, but this does **not** form a traversable linked list. As [@uweigand] explained ([rust-lang/rust#150766 comment]): > Even *if* we force frame pointer registers to be used, those are not stored on the stack in a way that forms a linked list that can be followed. The `-mbackchain` option simply generates prolog code that manages an equivalent linked list of stack frames at runtime. Therefore `-Cforce-frame-pointers` on s390x provides **no stack-walking benefit**. ## Backchain The [s390x ELF ABI](https://github.com/IBM/s390x-abi/releases/tag/v1.6.1) reserves **backchain slot** - a pointer back to the caller's frame. This can be used to walk the entire call chain without DWARF CFI. LLVM exposes this as the `"backchain"` function attribute, equivalent to GCC's `-mbackchain`. Backchain is **not** a CPU capability. It is a whole-binary code-generation convention, similar in nature to `-fno-omit-frame-pointer` on x86. This is reflected in LLVM modelling it as a *function attribute*, not a target feature [rust-lang/rust#150766 comment 2]. Enabling backchain does **not** break ABI compatibility: backchain-enabled and -disabled functions can freely call each other. The one notable exception is `packed-stack`: combining `-Zpacked-stack` with backchain on a non-softfloat target is rejected at compile time([rust-lang/rust#152432]). ## rustc arg discussion Initially backchain was introduced as an unstable `target-feature` mimicking the gcc and clang behavior. Within the grater effort of stabilizing arguments that are needed for Linux Kernel development(Rust-for-Linux/linux#2), attempts where made to stabilize the `target-feature=+backchain`. This lead to discussions and the overall consent is that: 1. **on s390x, enabling *normal* `frame-poitners` will *never* be done by the user.** > There is never any reason to do the latter, and always forcing it would simply cause extra unnecessary run-time overhead when you only actually want the backchain. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619573547) > The problem is that *even when we have a frame pointer*, it cannot be used for unwinding because it *points to the wrong location*. > @uweigand, [#158612](rust-lang/rust#158612 (comment)) 2. **if a user wants `frame-pointers` the user actually wants: stack-unwinding on x86 via `frame-pointers` but on `s390x` via `backchain`** > People being told by the internet that -Cforce-frame-pointers=yes makes their gdb bt/perf stack trace collection/etc" work get the right behaviour on s390x as well. > @nagisa, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) > upstream would prefer to reuse fp rather than adding a new option (because fp cannot work for frame-pointer unwinding anyway [...]) > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) > we'd like to understand why `-Cforce-frame-pointers` can't be treated as "not perfect" name for `-mbackchain` on s390x > @Mark-Simulacrum, [#158612](rust-lang/rust#158612 (comment)) 3. **`-Cforce-frame-pointers=yes` should on `s390x` enable `backchain` and **NOT** the `frame-pointer` attribute** > As one of the s390x target maintainers, I would be OK with using -Cforce-frame-pointers to enable backchain on s390x while not forcing actual framepointer (r11) usage. > @uweigand, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/619778159) > I'm happy to second this with the "re-use -Cforce-frame-pointers" approach above (implemented requiring -Zunstable-options on s390x initially) > @davidtwco, [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/624886154) 4. **the old `-Ctarget-feature=+backchain` pattern should emit a nice error and point to `-Cforce-frame-pointers=yes`** > ... which also leads to a nicer error. You can set hard_error: true for that so we don't have to worry about the validation logic. > @RalfJung [#163315](rust-lang/rust#163315 (comment)) 5. **the kernel folks are ok with an instant change of behavior without a deprecation period** > a hard switch would be perfectly fine. The grace period actually caused some confusion on my side > @dev-japo [#163315](rust-lang/rust#163315 (comment)) # Alternatives Most alternatives where discussed and ruled out: - make `-Ctarget-feature=+backchain` stable: backchain is not a real target-feature as its not part of the ISA or architecture. We rather don't want `backchain` to remain a `target-feature` - create a new rustc flag `-Zbackhain`: If the purpose of `backchain` is already covered by other flags or options we shouldn't add a new flag. - create a new rustc flag to enable stack-walking (e.g.`-Cstack-walking-support`): Most people mean this by setting `-Cforce-frame-pointers`. We should rather make the compiler behave as expected. # Concerns Enabling backchain via `-Cforce-frame-pointers` is low-risk and not a dead end. Backchain is an established, documented option in LLVM, Clang and GCC. Mixing code with and without it is safe. Reusing the flag matches how users and other tools expect `frame-pointers` to behave. > there are no ABI concerns with this feature (having some parts of the code compiled with and some without can lead to poor backtraces but doesn't break anything worse than that) > @RalfJung , relaying @uweigand , [#158612](rust-lang/rust#158612 (comment)) > reusing the option would make things easier for existing users > @uweigand , [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614979602) A real frame pointer can still get its own flag if anyone ever needs it. > if they do actually want the actual frame pointers in the wrong place of the stack, we can add -Cforce-frame-pointers=the-broken-s390x-option for them or something > @nagisa [#t-compiler/major changes > Introduce new -C flag for cross-target c… compiler-team#1027 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Introduce.20new.20-C.20flag.20for.20cross-target.20c.E2.80.A6.20compiler-team.231027/near/614754887) # References - rust-lang/rust#127506 - rust-lang/rust#129927 - rust-lang/rust#129940 - rust-lang/rust#142412 - rust-lang/rust#150259 - rust-lang/rust#150766 - rust-lang/rust#151154 - rust-lang/rust#152432 - rust-lang/rust#158014 - rust-lang/rust#158612 - rust-lang/rust#163315
View all comments
this enables
-Zpacked-stackjust as-mpacked-stackin clang and gcc. packed-stack is needed on s390x for kernel development.For reference: #151154 and #150766
look at @uweigand s post for full explanation of what this does. Here a wrap-up:
#150766 (comment)