-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: Ensure mod unwind_unimplemented
works without nightly
feature enabled
#150
fix: Ensure mod unwind_unimplemented
works without nightly
feature enabled
#150
Conversation
@@ -37,8 +37,12 @@ pub(crate) mod naked; | |||
#[cfg(all(feature = "unwinding", not(target_arch = "arm")))] | |||
#[allow(unused_extern_crates)] | |||
extern crate unwinding; | |||
#[cfg(all(feature = "unwinding", target_arch = "arm"))] | |||
#[cfg(any(not(feature = "unwinding"), target_arch = "arm"))] |
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.
I reverted this back to what it was, as I think it's valid to enable for either condition vs only unwinding
enabled on arm
?
Errors without this change
For x86_64
this change allowed the hello-world-small
Eyra example to build successfully (if the nightly
feature of origin
was not enabled by c-scape
):
- This was with
eyra => c-gull => c-scape => origin
crates all cloned locally where I removed thenightly
feature fromc-scape
'sorigin
feature list. - I tried to reproduce with just
origin
but no luck. Presumably somethingeyra
/c-scape
was doing withorigin
and it'sunwind
modules here?
Without the change, these are the two kinds of failures:
With -C target-feature=+crt-static
:
= note: rust-lld: error: undefined symbol: _dl_find_object
>>> referenced by unwind-dw2-fde-dip.o:(_Unwind_Find_FDE) in archive /usr/lib/gcc/x86_64-redhat-linux/14/libgcc_eh.a
>>> referenced by unwind-dw2-fde-dip.o:(_Unwind_Find_FDE) in archive /usr/lib/gcc/x86_64-redhat-linux/14/libgcc_eh.a
collect2: error: ld returned 1 exit status
Without -C target-feature=+crt-static
, all the symbols that the module provides are listed as errors:
= note: rust-lld: error: undefined symbol: _Unwind_Resume
...
RUSTFLAGS='-C panic=abort'
vs panic = "abort"
(Cargo.toml
)
If building with -C panic=abort
(regardless of panic
setting in Cargo.toml
profile), with the nightly
feature you'll get:
error[E0463]: can't find crate for `unwinding`
--> /origin/src/lib.rs:39:1
|
39 | extern crate unwinding;
| ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
That could be prevented by matching the unwinding
dep cfg requirement for panic = "unwind"
, but you'd then also need the opposite for the mod unwind_unimplemented
condition.
Not possible to use cfg
with features yet: rust-lang/cargo#1197
// If we don't have "unwinding", provide stub functions for unwinding and | ||
// panicking. | ||
#[cfg(not(feature = "unwinding"))] | ||
mod stubs; |
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.
I figured given the context it was better to co-locate with the other unwinding related logic?
mod stubs
was previously toggled by the nightly
feature but has since lost that context with the switch to unwinding
feature. Thus technically unwind_unimplemented
and stubs
are similar beyond the arm
conditional.
Not sure how you want to approach this.
This comment was marked as outdated.
This comment was marked as outdated.
nightly
feature doesn't force unwinding
mod unwind_unimplemented
works without nightly
feature enabled
Thanks! |
TL;DR: The PR now only reverts a recent change, so that
origin
will havemod unwind_unimplemented
when thenightly
/unwinding
feature is not enabled. Details here.Originally this PR was intended to fix building
unwinding
withnightly
feature forpanic = "abort"
but I was mistaken as the update below notes. That build issue will be resolved with release ofunwinding
after0.2.3
via: nbdd0121/unwinding#40Original PR message (with update)
This restores the Eyra
hello-world-small
crate example to build withpanic = "abort"
.References:
error: this directive must appear between .cfi_startproc and .cfi_endproc directives
nbdd0121/unwinding#39 (comment)This PR isn't quite ready to merge, when built there is many warnings now emitted about thefeature = "unwinding"
no longer being valid as it is no longer created implicitly from thenightly
feature requirements.UPDATE: I was mistaken about
nightly = ["dep:unwinding"]
vsnightly = ["unwinding"]
. Apart from the difference in implicit feature being dropped, the difference did not actually affect thecfg
condition on theunwinding
dependency itself, or at least I cannot reproduce such.I did notice that
panic = "abort"
inCargo.toml
has no affect on the dependency condition (only-C panic=abort
does):RUSTFLAGS='-C panic=abort' cargo run --release