diff --git a/lib/std/math/math_nolibc/exp.c3 b/lib/std/math/math_nolibc/exp.c3 index ce19a4d4e..27460bf61 100644 --- a/lib/std/math/math_nolibc/exp.c3 +++ b/lib/std/math/math_nolibc/exp.c3 @@ -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; diff --git a/lib/std/math/math_nolibc/log.c3 b/lib/std/math/math_nolibc/log.c3 index 77301348f..e47013636 100644 --- a/lib/std/math/math_nolibc/log.c3 +++ b/lib/std/math/math_nolibc/log.c3 @@ -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; diff --git a/lib/std/os/nolibc.c3 b/lib/std/os/nolibc.c3 new file mode 100644 index 000000000..c0d20b0f7 --- /dev/null +++ b/lib/std/os/nolibc.c3 @@ -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(); +} \ No newline at end of file diff --git a/releasenotes.md b/releasenotes.md index ce687913c..024612c6b 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -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`.