-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a bunch of rustc_nounwind
for c_unwind
#578
Conversation
Is mir inlining enough here or does it depend on LLVM's inliner? |
I think any one of them should work. |
Or are you referring to using |
This comment was marked as abuse.
This comment was marked as abuse.
239b876
to
39c2086
Compare
My question is if the inlining done by the MIR inliner is enough to fix this issue or if it depends on the codegen backend inlining too. AFAIK it is possible for the MIR inliner bail out on |
I might understand now. We want it to work on Cranelift and GCC as well. Let me see if there is a way to experiment with it. |
1cc6c05
to
39c2086
Compare
In case we do not actually want to inline some of these functions, marking them |
Godbolt: https://rust.godbolt.org/z/foe7s6ao1. Currently, I'm not sure besides modifying LLVM code what other validation methods exist. |
Thanks. That's what I'm looking for. I thought it was written as |
39c2086
to
8917e1d
Compare
inline(always)
for c_unwind
rustc_nounwind
for c_unwind
2ada25f
to
a97943c
Compare
a97943c
to
f60720c
Compare
If I understand correctly, this attribute needs to be applied to all |
@@ -93,15 +96,18 @@ if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then | |||
RUSTFLAGS="-C debug-assertions=no" \ | |||
CARGO_INCREMENTAL=0 \ | |||
CARGO_PROFILE_DEV_LTO=true \ | |||
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics | |||
$cargo rustc --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics --release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not have --release
: this test specifically checks that debug builds (-Copt-level=0
) do not reference any symbols in core. This is needed for people using -Z build-std
without --release
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I understand that we might expect that only compiler-builtins
is optimized.
I was thinking of a crate-level version of |
Good point. I'll have a try with this approach. |
Sounds good! Make sure to only apply it to definitions though, not declarations.
|
I've tried this and it doesn't seem to work. |
I have found that if I add to trait it causes problems. |
Mark all functions defined in compiler-builtins as nounwind Treat functions in compiler-builtins as nounwind. Suggested in rust-lang/compiler-builtins#578 (comment). A prerequisite for rust-lang#116088 r? `@Amanieu` cc `@RalfJung`
Yes, it's not implemented in the compiler (yet). I was proposing to implement it. (Sorry if that was not clear). But @nbdd0121 is on the case already: rust-lang/rust#121605. |
We can consider implementing it when we encounter it again. |
Prefer rust-lang/rust#121605. |
This PR fixes encountered dependency core issue in rust-lang/rust#116088.
After enabling
c_unwind
, consider the following code.Due to the lack of inlining or
rustc_nounwind
forbar
, thecore::panicking::panic_cannot_unwind
function is called.Godbolt: https://rust.godbolt.org/z/Ea4rhfWcr.
In this PR, I'm checking if there are any undefined symbols belonging to
core
in the release build. I believe checking the debug build is meaningless. First, we won't distribute the debug build ofcompiler-builtins
, and second, it has a lot of dependencies oncore
.Since we're already checking for undefined symbols in
core
, I think checking theintrinsics
example might not be meaningful anymore.r? @Amanieu