From 781f07a62064dbaefc362c1077d6a5382a186893 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 26 Nov 2021 15:55:55 +0100 Subject: [PATCH] BUILD: pools: only detect link-time jemalloc on ELF platforms The build broke on Windows and MacOS after commit ed232148a ("MEDIUM: pool: refactor malloc_trim/glibc and jemalloc api addition detections."), because the extern+attribute(weak) combination doesn't result in a really weak symbol and it causes an undefined symbol at link time. Let's reserve this detection to ELF platforms. The runtime detection using dladdr() remains used if defined. No backport needed, this is purely 2.6. --- src/pool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pool.c b/src/pool.c index 1d4f2dfbc..4d1d7d2ec 100644 --- a/src/pool.c +++ b/src/pool.c @@ -77,9 +77,11 @@ static void trim_all_pools(void) */ static void detect_allocator(void) { +#if defined(__ELF__) extern int mallctl(const char *, void *, size_t *, void *, size_t) __attribute__((weak)); my_mallctl = mallctl; +#endif if (!my_mallctl) { my_mallctl = get_sym_curr_addr("mallctl");