Skip to content

Commit 4487e21

Browse files
compat.mimalloc: no link names for an ok image; no -latomic (#659)
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent d1e061f commit 4487e21

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- **compat.mimalloc:ok 映像不再链接 `-lpthread`、`-lrt`,Linux 不再链接 `-latomic`。** ok 映像(`<arch>-openkal`)原先读 `linux`
13+
块,链接时找不到这两个归档;新增 `openkal` 块,不列链接参数。`-latomic` 上游只在找到时才链接,mimalloc 的原子操作在本索引
14+
构建的各架构上都是无锁的,LLVM 工具链在图中 C 库之上没有这个归档。
15+
1016
### Added
1117

1218
- **compat.mimalloc 3.6.1。** 与 3.4.5 并存;同一份源文件列表同时写出两个版本的目录布局(3.6.1 分为 `alloc/`、`arena/`、

‎pkgs/c/compat.mimalloc.lua‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,22 @@ package = {
154154
targets = { ["mimalloc"] = { kind = "lib" } },
155155
deps = {},
156156
linux = {
157-
-- CMakeLists.txt:618-626 -- pthread for thread state, rt for
158-
-- clock_gettime/shm, atomic for the 64-bit atomics on targets
159-
-- where libatomic is not folded into libgcc.
160-
ldflags = { "-lpthread", "-lrt", "-latomic" },
157+
-- CMakeLists.txt (3.6.1: 886-898) -- pthread for thread state, rt
158+
-- for clock_gettime/shm.
159+
--
160+
-- NOT `-latomic`, which upstream links only where it finds the
161+
-- library ("detected automatically"): mimalloc's atomics are
162+
-- lock-free on every architecture this index builds for, and a
163+
-- toolchain without the archive (the LLVM one, above a C library
164+
-- of the graph) failed the link on its name alone.
165+
ldflags = { "-lpthread", "-lrt" },
161166
},
167+
-- AN OK IMAGE (openkal SPEC 12) NAMES NOTHING AT ITS LINK. Its C library
168+
-- supplies threads and clocks, and an image imports `kal_*` alone; an
169+
-- ok target otherwise reads the `linux` block, whose `-lpthread` and
170+
-- `-lrt` name archives an image's link does not have. The key is
171+
-- written out: a block with no key is read as no block.
172+
openkal = { ldflags = {} },
162173
macosx = {
163174
ldflags = { "-lpthread" },
164175
},

0 commit comments

Comments
 (0)