Skip to content

Commit e75e07d

Browse files
authored
register openkal-llvm-runtime 0.15.0 (#456)
`thread_local` destructors run, on every target this package builds for. The defect had three layers and the first two fail differently, which is why fixing only the first would have been worse than leaving it: 1. EXPORT. Upstream libc++abi exports `__cxa_thread_atexit` on Linux and Fuchsia only, because elsewhere another runtime already does --- an ordinary MinGW target gets it from `libmingw32.a`. openkal replaces the C library and its runtime together, so both sides assumed the other would. `doctest` and `spdlog` in this repository's own compatibility suite stop at `ld.lld: error: undefined symbol: __cxa_thread_atexit`. 2. STORAGE. With the guard open the link succeeded AND NOTHING WAS DESTROYED. The fallback keeps its pending-destructor list in a `__thread` variable; this runtime is built with `-femulated-tls` for PE, and emutls keeps its per-thread blocks behind a pthread key of its own whose destructor had already released this thread's block. Measured under wine, one thread: registered dtor, dtors=0x7ffffe994680, &dtors=0x7ffffe9946a8 run_dtors called, dtors=0, &dtors=0x7ffffe9946c8 The list now lives in the TLS key's own value, which no other key's teardown can reach. 3. APPLE. Surfaced by the criterion written for layer two: clang lowers a `thread_local` with a destructor to `_tlv_atexit` on Mach-O, and then the weak-symbol probe for `__cxa_thread_atexit_impl` --- an ELF idiom ld64 does not honour in a static link --- became the error itself. Criterion, two conditions and neither sufficient, in `examples/cxx` on x86_64-linux-gnu and x86_64-windows-gnu (wine), `failures: 0`: ok: a thread_local is constructed in a spawned thread ok: and its destructor runs when that thread ends Cross-verified against mcpp 2026.9.21.2 before that engine merged: five jobs green, including both host-dimension rows. Registration only; nothing is re-pinned onto it by this change.
1 parent 6db50b8 commit e75e07d

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎pkgs/o/openkal-llvm-runtime.lua‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@
2727
-- favour of definitions the package's own manifest now gives per target
2828
-- (design §3.4). Neither the release nor its sha256 exist yet -- this
2929
-- comment marks the entry as prepared and blocked, not as data to invent.
30+
-- 0.15.0 makes `thread_local` destructors run. Upstream libc++abi exports
31+
-- `__cxa_thread_atexit` on Linux and Fuchsia only, because elsewhere another
32+
-- runtime already does --- `libmingw32.a` on an ordinary MinGW target. openkal
33+
-- replaces the C library and its runtime together, so both sides assumed the
34+
-- other would: `doctest` and `spdlog` stopped at `undefined symbol` on
35+
-- x86_64-windows-gnu.
36+
--
37+
-- EXPORTING IT WAS NOT ENOUGH. The fallback kept its pending-destructor list
38+
-- in a `__thread` variable, and this runtime is built with `-femulated-tls`
39+
-- for PE; emutls releases the thread's block behind a key of its own, before
40+
-- the key that walks the list. Measured: `&dtors` differs between
41+
-- registration and the destructor, in one thread. The list now lives in the
42+
-- TLS key's own value. A third layer surfaced on Apple, where clang lowers to
43+
-- `_tlv_atexit` and the weak-symbol probe is an ELF idiom ld64 does not
44+
-- honour.
45+
--
3046
-- 0.14.0 reads `__MCPP_TARGET_WINDOWS__` in `__libunwind_config.h`, the
3147
-- INSTALLED header that sizes `unw_context_t` by the target's register save
3248
-- area, keeping `|| defined(__CYGWIN__)` beside it. Two operands cover every
@@ -51,6 +67,13 @@ package = {
5167

5268
xpm = {
5369
linux = {
70+
["0.15.0"] = {
71+
url = {
72+
GLOBAL = "https://github.com/mcpplibs/openkal-llvm-runtime/archive/refs/tags/0.15.0.tar.gz",
73+
CN = "https://gitcode.com/mcpp-res/openkal-llvm-runtime/releases/download/0.15.0/openkal-llvm-runtime-0.15.0.tar.gz",
74+
},
75+
sha256 = "acd3a54fe6dca5504a6751c3fc1543a1d3f4c26bf6e142e15ac8fd90d8bee496",
76+
},
5477
["0.14.0"] = {
5578
url = {
5679
GLOBAL = "https://github.com/mcpplibs/openkal-llvm-runtime/archive/refs/tags/0.14.0.tar.gz",
@@ -228,6 +251,13 @@ package = {
228251
},
229252
},
230253
macosx = {
254+
["0.15.0"] = {
255+
url = {
256+
GLOBAL = "https://github.com/mcpplibs/openkal-llvm-runtime/archive/refs/tags/0.15.0.tar.gz",
257+
CN = "https://gitcode.com/mcpp-res/openkal-llvm-runtime/releases/download/0.15.0/openkal-llvm-runtime-0.15.0.tar.gz",
258+
},
259+
sha256 = "acd3a54fe6dca5504a6751c3fc1543a1d3f4c26bf6e142e15ac8fd90d8bee496",
260+
},
231261
["0.14.0"] = {
232262
url = {
233263
GLOBAL = "https://github.com/mcpplibs/openkal-llvm-runtime/archive/refs/tags/0.14.0.tar.gz",
@@ -405,6 +435,13 @@ package = {
405435
},
406436
},
407437
windows = {
438+
["0.15.0"] = {
439+
url = {
440+
GLOBAL = "https://github.com/mcpplibs/openkal-llvm-runtime/archive/refs/tags/0.15.0.tar.gz",
441+
CN = "https://gitcode.com/mcpp-res/openkal-llvm-runtime/releases/download/0.15.0/openkal-llvm-runtime-0.15.0.tar.gz",
442+
},
443+
sha256 = "acd3a54fe6dca5504a6751c3fc1543a1d3f4c26bf6e142e15ac8fd90d8bee496",
444+
},
408445
["0.14.0"] = {
409446
url = {
410447
GLOBAL = "https://github.com/mcpplibs/openkal-llvm-runtime/archive/refs/tags/0.14.0.tar.gz",

0 commit comments

Comments
 (0)