rust-lang / libm

A port of MUSL's libm to Rust.
Apache License 2.0
521 stars 95 forks source link

Make all symbols weak? #257

Open jonathanpallant opened 2 years ago

jonathanpallant commented 2 years ago

Some target devices have extra features that this library doesn't support. For example, the Raspberry Silicon RP2040 has hand-optimised floating-point routines in ROM, as well as a non-standard interpolator and integer divider IP block.

We'd like to supply optimised versions of some of the libm functions that make use of these features, but we can't because libm exports only strong symbols.

Could we change all the functions to have weak symbols, so we can push out and replace functions on a case-by-case basis without forking libm?

Amanieu commented 2 years ago

Sure! We already do this for the mem* functions in compiler-builtins, so it should be fine to do the same here. I would be happy to accept a PR for this.