You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pass rustc the equivalent of -Wframe-larger-than=1000 #121
changed the title [-]Pass rustc the equivalent of -Wframe-larger-than=1000[/-][+]Pass `rustc` the equivalent of `-Wframe-larger-than=1000`[/+]on Mar 18, 2021
No, there isn't a direct option, but there are things that can help. There is rust-lang/rust#83519 for moves of large values. This includes assignments. For stack frame sizes, only LLVM knows about it. With -Z emit-stack-sizes it is possible to tell LLVM to add a section containing info about stack frame sizes. This option was added to rustc for https://github.com/japaric/cargo-call-stack.
OK. I used -Z emit-stack-sizes to debug issue #155, which worked well enough to find the large functions. I guess that's not useful for an upstream stack size warning option though, because it would require nightly rustc (AIUI).
@mpe would you mind sharing how you obtained a list of function stack sizes using -Z emit-stack-sizes? I'd like to do the same for arm 32-bit. It's quite possible that stack overflows are happening there too.
I guess that's not useful for an upstream stack size warning option though, because it would require nightly rustc (AIUI).
Yeah -- we should use it nevertheless. That way the rustc folks know it is useful and being used (see the #2 list), and that we will want it stabilized at some point. If really needed, we can always gate it or take it out later.
I don't know what stability guarantee LLVM has for this feature. If LLVM doesn't guarantee that it will remain the same forever, I think it is unlikely that it will be stabilized in rustc.
My thinking was that given Clang supports -Wframe-larger-than=, LLVM will need to support the feature one way or another, which means it should be fairly easy for rustc to keep providing it too.
Clang doesn't use the stack size section. Instead it instructs LLVM to emit a diagnostic whenever the stack size is above a certain threshold. Rustc doesn't have any support for handling LLVM diagnostics except for inline asm.
Activity
[-]Pass rustc the equivalent of -Wframe-larger-than=1000[/-][+]Pass `rustc` the equivalent of `-Wframe-larger-than=1000`[/+]mpe commentedon Apr 10, 2021
Is there such a thing? I had a look and couldn't find it, but I'm not a rustc expert.
ojeda commentedon Apr 10, 2021
Not sure -- we may need to implement it ourselves! :)
bjorn3 commentedon Apr 15, 2021
No, there isn't a direct option, but there are things that can help. There is rust-lang/rust#83519 for moves of large values. This includes assignments. For stack frame sizes, only LLVM knows about it. With
-Z emit-stack-sizesit is possible to tell LLVM to add a section containing info about stack frame sizes. This option was added to rustc for https://github.com/japaric/cargo-call-stack.mpe commentedon Apr 16, 2021
OK. I used
-Z emit-stack-sizesto debug issue #155, which worked well enough to find the large functions. I guess that's not useful for an upstream stack size warning option though, because it would require nightly rustc (AIUI).TheSven73 commentedon Apr 16, 2021
@mpe would you mind sharing how you obtained a list of function stack sizes using
-Z emit-stack-sizes? I'd like to do the same for arm 32-bit. It's quite possible that stack overflows are happening there too.mpe commentedon Apr 16, 2021
Something like this:
ojeda commentedon Apr 16, 2021
Yeah -- we should use it nevertheless. That way the
rustcfolks know it is useful and being used (see the #2 list), and that we will want it stabilized at some point. If really needed, we can always gate it or take it out later.bjorn3 commentedon Apr 16, 2021
I don't know what stability guarantee LLVM has for this feature. If LLVM doesn't guarantee that it will remain the same forever, I think it is unlikely that it will be stabilized in rustc.
ojeda commentedon Apr 16, 2021
My thinking was that given Clang supports
-Wframe-larger-than=, LLVM will need to support the feature one way or another, which means it should be fairly easy forrustcto keep providing it too.bjorn3 commentedon Apr 16, 2021
Clang doesn't use the stack size section. Instead it instructs LLVM to emit a diagnostic whenever the stack size is above a certain threshold. Rustc doesn't have any support for handling LLVM diagnostics except for inline asm.
https://github.com/llvm/llvm-project/blob/a9968c0a339ab47f5d6da1c513b2754f1e98a596/llvm/lib/CodeGen/PrologEpilogInserter.cpp#L278-L284
llvm/llvm-project@728c554
LoongArch: BPF: Support 64-bit pointers to kfuncs
MIPS: DEC: Prevent initial console buffer from landing in XKPHYS
nickdesaulniers commentedon Jul 22, 2026
cc @arndb