diff --git a/core/link_stubs.c b/core/link_stubs.c index 3a3a41e4..d5490330 100644 --- a/core/link_stubs.c +++ b/core/link_stubs.c @@ -1,5 +1,6 @@ #include #include +#include #include // Weak, no-op stubs to satisfy link in configurations where @@ -34,3 +35,18 @@ __attribute__((weak)) int pool_reg_lookup(void* ptr, pid_t* tid_out, int* class_ // Memory profile print stub (bench_comprehensive references this symbol) __attribute__((weak)) void hak_tiny_print_memory_profile(void) {} + +// TSan/ASan build stubs (avoid link errors when HAKMEM_FORCE_LIBC_ALLOC_BUILD=1) +// These symbols are referenced in refill/bump allocation paths but not needed for sanitizer builds +__attribute__((weak)) int g_bump_chunk = 1; +__attribute__((weak)) __thread uint8_t* g_tls_bcur[8] = {0}; +__attribute__((weak)) __thread uint8_t* g_tls_bend[8] = {0}; + +__attribute__((weak)) void smallmid_backend_free(void* ptr, int unused) { + (void)ptr; (void)unused; +} + +__attribute__((weak)) int expand_superslab_head(void* head) { + (void)head; + return -1; // Failure (not needed in sanitizer build) +}