From 908baaa3992e08544bacfa999bd7136c4f034c5a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 29 Sep 2024 09:46:10 +0200 Subject: [PATCH] MINOR: tools: do not attempt to use backtrace() on linux without glibc The function is provided by glibc. Nothing prevents us from using our own outside of glibc there (tested on aarch64 with musl). We still do not enable it by default as we don't yet know if all archs work well, but it's sufficient to pass USE_BACKTRACE=1 when building with musl to verify it's OK. (cherry picked from commit 7caf073faa6962de15a18dadcaf200df95ce7889) Signed-off-by: Willy Tarreau --- include/haproxy/compat.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/haproxy/compat.h b/include/haproxy/compat.h index 3829060..0e4844d 100644 --- a/include/haproxy/compat.h +++ b/include/haproxy/compat.h @@ -240,7 +240,11 @@ typedef struct { } empty_t; * than ours. */ #ifdef USE_BACKTRACE -#if defined(__aarch64__) +#if defined(__linux__) && !defined(__GNU_LIBRARY__) +/* On Linux, backtrace() is only available in glibc. Others will need the + * in-house implementation. + */ +#elif defined(__aarch64__) /* on aarch64 at least from gcc-4.7.4 to 7.4.1 we only get a single entry, which * is pointless. Ours works though it misses the faulty function itself, * probably due to an alternate stack for the signal handler which does not -- 1.7.10.4