From dcebf48e092eadd43a3475a53987a5eab0e852e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Fri, 28 Aug 2026 12:18:11 +0200 Subject: [PATCH] fix(link): pass -lm on the Linux application-dylib link LLVM lowers Math.floor/Math.log10 in application code to libm calls, and Perry's shared-library link on Linux does not add -lm the way its executable link does; macOS never notices because libSystem carries libm. The Next fixture's link on Linux died with `undefined reference to 'floor'` after every other symbol resolved (found once perryts/perry#8942 removed the duplicate string-constant definitions). The tiny CI fixture calls no libm function, which is why the Linux proof never saw it. Claude-Session: https://claude.ai/code/session_01UZJbhb2FTuakurTHPAKQgd --- scripts/compiler-wrappers/cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/compiler-wrappers/cc b/scripts/compiler-wrappers/cc index 66fa71d..f1c447a 100755 --- a/scripts/compiler-wrappers/cc +++ b/scripts/compiler-wrappers/cc @@ -123,7 +123,16 @@ if [ "$is_shared" -eq 1 ] && [ -n "$exports_file" ]; then # providers as explicit DT_NEEDED entries even when a tiny app # happens not to reference a stdlib symbol directly: the app ABI # contract always consists of runtime + stdlib + app-only image. + # + # libm: LLVM lowers `Math.floor`/`Math.log10`/... in application + # code to libm calls (`floor`, `log10`), and Perry's shared-library + # link on Linux does not add `-lm` the way its executable link does + # (perryts/perry#8942 follow-up). macOS never notices because + # libSystem carries libm. Without it the Next fixture's link dies + # with `undefined reference to 'floor'` after every other symbol + # resolved; the tiny CI fixture calls no libm function. exec "$real_cc" "$@" \ + "-lm" \ "-Wl,--no-as-needed" \ "$runtime_library" "$stdlib_library" \ "-Wl,--as-needed" \