xous-core
xous-core copied to clipboard
Can't use `f32` transcendental functions (`sin`, `cos`) because lto `fat` is broken in rust 1.66
Rust 1.66 breaks lto fat
due to a panic inside sin()/cos() routines.
This issue is to investigate this further. Two options:
- Create pure Rust versions of sin/cos that don't break in LTO
- Pull out the entire FFT analysis routine and do it on the tester host side
2 is probably the better outcome but definitely a lot more work and risk on production quality.
Note: Losing fat
and going to thin
adds 600kiB to the Xous binary size
Did some investigations.
- [x] see if
mold
can work with this - yes, but: can't handle custom kernel link.x script (not a feature of mold), requiresPIC
, which isn't enabled in currentstd
, thus would require a patch tostd
that could cause it to not be upstreamable. aborting approach. Note build time of services goes from 28s to 20s, so about 30% improvement withmold
. - [x] see if
gold
can work with this - NO, gold is bit-rotted and does not support risc-v - [x] see if
ld
can work with this xobs found that the bug still exists (see image below)
Seems like we have to wait for llvm to fix this.
Next step: try to excise out the one broken function, or maybe it can be bodged around in some way...
lto fat
restored in 79be209790518d13541e5d0e3c8ec0eedbb00ff7 because I have gone through and eliminated calls to f32::cos()
through the entire system and replaced it with a less-accurate, but more compact and more importantly not crashing quadrant table-lookup based cosine implementation.
The llvm
issue is still real. Renaming the bug and leaving it open to remind ourselves to revisit the issue someday if the llvm issue (https://github.com/rust-lang/rust/issues/105734) ever gets fixed, especially if users eventually want to use cos(), sin(), etc.