Add support for environments with the FPU disabled#25
Add support for environments with the FPU disabled#25nbdd0121 merged 3 commits intonbdd0121:trunkfrom lylythechosenone:trunk
Conversation
src/lib.rs
Outdated
| #![feature(c_unwind)] | ||
| #![feature(naked_functions)] | ||
| #![feature(non_exhaustive_omitted_patterns_lint)] | ||
| #![feature(cfg_target_abi)] |
There was a problem hiding this comment.
Is there a way to achieve this without additional nightly features? I'd like to avoid adding extra ones.
There was a problem hiding this comment.
I think it might be doable with target_feature, but I'm not sure. Will do some testing and find out.
There was a problem hiding this comment.
Never mind, the counterparts in target_feature are still unstable. The other option would be a cargo feature, but that feels weird. Your choice I guess.
There was a problem hiding this comment.
cfg_target_abi has been stabilized in the recent nightly (rust-lang/rust#119590), so we can now remove this #![feature]
src/unwinder/arch/aarch64.rs
Outdated
| #[naked] | ||
| #[cfg(target_abi = "softfloat")] | ||
| pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), ptr: *mut ()) { | ||
| // No need to save caller-saved registers here. |
There was a problem hiding this comment.
Could you extract the asm using macro to avoid duplication? See riscv for example
There was a problem hiding this comment.
Yeah sure, will do.
There was a problem hiding this comment.
Please take another look of riscv code to avoid code duplication
|
As I said in my comments, I fixed these as much as I could. I need your input on the first one. |
|
Not sure how I closed this. Anyways, it's finally done. Sorry for the long wait. Hopefully this is what you envisioned. |
src/unwinder/arch/aarch64.rs
Outdated
| #[naked] | ||
| pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), ptr: *mut ()) { | ||
| unsafe { | ||
| #[cfg(target_feature = "fp-armv8")] |
There was a problem hiding this comment.
AFAIK there is no such a target feature in aarch64 (at least on the Rust side):
$ rustc +nightly --print cfg --target aarch64-unknown-linux-gnu | grep target_feature
target_feature="neon"
$ rustc +nightly --print cfg --target aarch64-unknown-none | grep target_feature
target_feature="neon"
$ rustc +nightly --print cfg --target aarch64-unknown-none-softfloat | grep target_featurearm has it though: https://github.com/rust-lang/rust/blob/b5b13568fb5da4ac988bde370008d6134d3dfe6c/compiler/rustc_target/src/target_features.rs#L62
There was a problem hiding this comment.
Oh, weird—the error when I tried to use unwinding mentioned fp-armv8 explicitly. I'll fix that.
There was a problem hiding this comment.
To be more clear: when I tried to use the current unwinding master branch on aarch64-unknown-none-softfloat, I got a compile error saying that the registers d[n] require target feature fp-armv8. This is likely a diagnostic issue, and I'll see if I can reproduce it to send that over to rustc.
`fp-armv8` is an arm feature, not an aarch64 feature.
Currently, the crate causes an exception on systems where the FPU is off/nonexistent, because of this code segment that saves floating-point registers. This PR removes that floating-point saving on
-softfloattargets.