Make log and exp no-strip.

This commit is contained in:
Christoffer Lerno
2025-08-27 14:41:19 +02:00
parent 28b9be64ee
commit 3c6e6f1965
4 changed files with 11 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ const float EXPF_P2 = -2.7777778450e-03f;
const float EXPF_P3 = 6.6137559770e-05f;
const float EXPF_P4 = -1.6533901999e-06f;
fn double exp(double x) @extern("exp")
fn double exp(double x) @extern("exp") @nostrip @weak
{
if (x != x) return x;
if (x == double.inf) return double.inf;
@@ -38,7 +38,7 @@ fn double exp(double x) @extern("exp")
return ldexp(exp_r, (int)k);
}
fn float expf(float x) @extern("expf")
fn float expf(float x) @extern("expf") @nostrip @weak
{
if (x != x) return x;
if (x == float.inf) return float.inf;

View File

@@ -19,7 +19,7 @@ const float LOGF_L4 = 2.4279078841e-01f;
const double SQRT2 = 1.41421356237309504880;
const float SQRT2F = 1.41421356237309504880f;
fn double log(double x) @extern("log")
fn double log(double x) @extern("log") @nostrip @weak
{
if (x != x) return x;
if (x < 0.0) return double.nan;
@@ -50,7 +50,7 @@ fn double log(double x) @extern("log")
return k * LOG_LN2_HI - ((hfsq - (s * (hfsq + r) + k * LOG_LN2_LO)) - f);
}
fn float logf(float x) @extern("logf")
fn float logf(float x) @extern("logf") @nostrip @weak
{
if (x != x) return x;
if (x < 0.0f) return float.nan;

6
lib/std/os/nolibc.c3 Normal file
View File

@@ -0,0 +1,6 @@
module std::math::nolibc @if(env::NO_LIBC);
fn void __stack_chk_fail() @extern("__stack_chk_fail") @nostrip @noreturn @weak
{
$$trap();
}

View File

@@ -75,6 +75,7 @@
- Grabbing (missing) methods on function pointers would cause crash #2434.
- Fix alignment on jump table.
- Fix correct `?` after optional function name when reporting type errors.
- Make `log` and `exp` no-strip.
### Stdlib changes
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.