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).
This commit is contained in:
Malte Ubl
2026-10-08 15:01:26 -05:00
committed by GitHub
parent 994a6b9940
commit 69e26b417c
+5 -1
View File
@@ -14,7 +14,11 @@
#if SCR_SMALL_ALLOC
#include <sys/mman.h>
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