From f1be4b4ff79a1cf7c6c47547fa13e3125ef49986 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Mon, 2 Nov 2026 05:17:15 +0900 Subject: [PATCH] compat.mimalloc: no link names for an ok image; no -latomic Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ pkgs/c/compat.mimalloc.lua | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe304da..f673fe04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ ## [Unreleased] +### Fixed + +- **compat.mimalloc:ok 映像不再链接 `-lpthread`、`-lrt`,Linux 不再链接 `-latomic`。** ok 映像(`-openkal`)原先读 `linux` + 块,链接时找不到这两个归档;新增 `openkal` 块,不列链接参数。`-latomic` 上游只在找到时才链接,mimalloc 的原子操作在本索引 + 构建的各架构上都是无锁的,LLVM 工具链在图中 C 库之上没有这个归档。 + ### Added - **compat.mimalloc 3.6.1。** 与 3.4.5 并存;同一份源文件列表同时写出两个版本的目录布局(3.6.1 分为 `alloc/`、`arena/`、 diff --git a/pkgs/c/compat.mimalloc.lua b/pkgs/c/compat.mimalloc.lua index 8c515171..63ff7311 100644 --- a/pkgs/c/compat.mimalloc.lua +++ b/pkgs/c/compat.mimalloc.lua @@ -154,11 +154,22 @@ package = { targets = { ["mimalloc"] = { kind = "lib" } }, deps = {}, linux = { - -- CMakeLists.txt:618-626 -- pthread for thread state, rt for - -- clock_gettime/shm, atomic for the 64-bit atomics on targets - -- where libatomic is not folded into libgcc. - ldflags = { "-lpthread", "-lrt", "-latomic" }, + -- CMakeLists.txt (3.6.1: 886-898) -- pthread for thread state, rt + -- for clock_gettime/shm. + -- + -- NOT `-latomic`, which upstream links only where it finds the + -- library ("detected automatically"): mimalloc's atomics are + -- lock-free on every architecture this index builds for, and a + -- toolchain without the archive (the LLVM one, above a C library + -- of the graph) failed the link on its name alone. + ldflags = { "-lpthread", "-lrt" }, }, + -- AN OK IMAGE (openkal SPEC 12) NAMES NOTHING AT ITS LINK. Its C library + -- supplies threads and clocks, and an image imports `kal_*` alone; an + -- ok target otherwise reads the `linux` block, whose `-lpthread` and + -- `-lrt` name archives an image's link does not have. The key is + -- written out: a block with no key is read as no block. + openkal = { ldflags = {} }, macosx = { ldflags = { "-lpthread" }, },