-
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
libm and math stuff #19
Comments
Cool! I've also thought about using an existing Rust libm for some functions: https://github.com/nagisa/math.rs I think that using the existing assembly implementations definitely makes sense where they exist. |
oh wow, @japaric's on the ball. Well, since After a bit of testing, it seems like we can do something like this in shell script: for f in musl/src/math/<arch>/*.s; do
as -o $(echo $f | sed 's/\.s/\.o/') $f
done
ar -crus libm-intermediate.a musl/src/math/<arch>/*.o That'll give us a
And you can verify the expected asm is part of the resulting binary like |
Can we do this in a buildscript? It'd be nice to have Seems like there's a crate for invoking nasm (https://github.com/medek/nasm-rs), but I'm not familiar enough with assemblers to know whether that can be a drop-in replacement for |
musl provides many math functions in assembly. I thought it'd be nice to leave those as-is and provide a step in the build to assemble all the .s files and produce a
libm-intermediate.a
that we can link tolibrusl
.One reason we might want to copy over the assembly is because of optimizations like the short
jmp
s inmusl/src/math/x86_64/floorl.s
. I thought it would be hard to bring optimizations like that over to#[naked]
rust functions withasm!
blocks.Thoughts?
The text was updated successfully, but these errors were encountered: