From 69e26b417c5c5bcc4aed4100b163060db3783f05 Mon Sep 17 00:00:00 2001 From: Malte Ubl Date: Thu, 8 Oct 2026 11:42:38 -0700 Subject: [PATCH] Define the small-object allocator state as an ordinary global `ScrSaState scr_sa;` was a tentative definition, which the runtime build emits as a COMMON symbol. Library localization (abi.localize_runtime) deliberately keeps COMMON symbols global (the ASan image-registration guard relies on that), so every runtime-localized library archive exported scr_sa next to its declared API, failing tests/harness/library-multi.test.ts M1 ("external definitions equal the declared set exactly"). Initialize it explicitly so it is a regular zero-initialized definition that localization demotes like every other runtime global. No other global added by the stack is a tentative definition. The library-multi suite passes (it fails M1 without this change). --- packages/runtime/src/scr_alloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/runtime/src/scr_alloc.c b/packages/runtime/src/scr_alloc.c index ab6db74fa..fd7d79b3c 100644 --- a/packages/runtime/src/scr_alloc.c +++ b/packages/runtime/src/scr_alloc.c @@ -14,7 +14,11 @@ #if SCR_SMALL_ALLOC #include -ScrSaState scr_sa; +/* Explicitly initialized so it is an ordinary (localizable) definition: a + * tentative definition becomes a COMMON symbol, which library localization + * deliberately keeps global (abi.localize_runtime), leaking it from every + * localized library archive. */ +ScrSaState scr_sa = {0}; static bool scr_sa_refused; /* Reserve address space for every class slice at once; smaller slices are