From 39a7593521cac14143dc501b15946bd83adf6a4f Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Sun, 13 Sep 2026 03:45:04 +0300 Subject: [PATCH] fix(cli): link http.ll only for a program that calls hs_send http_link_flags grepped the IR for "@hs_", which every program's header declares, so `ludic build` linked the HTTP transport and Foundation into everything - invisible on macOS, a failed link on Linux, where it broke four CI cases (ludic run, the installed layout, ludic new, the seed build through `ludic build`). It now looks for a call to hs_send: examples/library/http.ludic has one, snake.ludic (which still declares ten @hs_ names) has none. Co-Authored-By: Claude Opus 5 --- changes/http-link-call.md | 8 ++++++++ tools/ludic-cli/build.ludic | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 changes/http-link-call.md diff --git a/changes/http-link-call.md b/changes/http-link-call.md new file mode 100644 index 00000000..0884052f --- /dev/null +++ b/changes/http-link-call.md @@ -0,0 +1,8 @@ +bump: patch +type: fix +**`ludic build` links `http.ll` only into a program that uses `Http.*`.** + +The check that added it grepped the IR for `@hs_`, which every program's header declares, +so the HTTP transport and Foundation were linked into everything. That cost nothing visible +on macOS and failed the link on Linux, where `ludic build`, `ludic run` and a new project all +broke in CI. It now looks for a call to `hs_send`. diff --git a/tools/ludic-cli/build.ludic b/tools/ludic-cli/build.ludic index be3f4c3d..da363ce5 100644 --- a/tools/ludic-cli/build.ludic +++ b/tools/ludic-cli/build.ludic @@ -75,7 +75,10 @@ function gl_link_flags(ll: pointer) -> pointer { # then, in both modes, as `ludicc -o` does (selfhost/main.ludic). Without it a Http.* # program built through `ludic build` failed to link on every hs_* symbol. function http_link_flags(ll: pointer) -> pointer { - if not shq(`grep -q "@hs_" {ll}`) { return "" } + # a CALL, not the name: every program's header declares the hs_* transport, so grepping + # for "@hs_" linked http.ll and Foundation into everything - harmless on macOS, a failed + # link on Linux. Only the Http runtime a program actually uses calls hs_send. + if not shq(`grep -q "call void @hs_send" {ll}`) { return "" } return ` {ludic_home()}runtime/native/http.ll -Wl,-needed_framework,Foundation` }