rust-lang/compiler-builtins

Adding feature to port `libm` for any target

Amjad50 opened this issue · 3 comments

Hello.

I have been working with creating a new target for some platform, and working on std.
This target doesn't have libc, so it doesn't have the math symbols.

I was wondering if we could have a feature that will implement the math symbols from libm as it does now for targets that have os = none (and other targets).

I'm having a lot of trouble getting libm linking somehow to std, as I can't just add it as a dependency for that target.

Let me know what you think, and if there is any issues I don't know about.

Thanks

Take a look at the libm crate.

The issue is functions used in the standard library, like '%' in f32. If you used this operator, what is being called is 'fmod'. libm has this function implemented in rust but since it's not exported as a C function, the linker can't find it

I found a way to make libm compilable from 'std', I think it's a better approach.

I'll close this

Ref: rust-lang/libm#290