From: Willy Tarreau Date: Fri, 26 Nov 2021 14:55:55 +0000 (+0100) Subject: BUILD: pools: only detect link-time jemalloc on ELF platforms X-Git-Tag: v2.6-dev1~362 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=781f07a62064dbaefc362c1077d6a5382a186893;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/pool.c b/src/pool.c index 1d4f2dfbcc..4d1d7d2ec6 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");