mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-30 07:14:39 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user