From a16fc9333f1762d9b5a9da7239fe6a5cc9a6d190 Mon Sep 17 00:00:00 2001 From: Dongsheng Song Date: Tue, 14 Feb 2023 12:51:29 +0100 Subject: [PATCH] Fix musl build on Linux The commit "ada: Add PIE support to backtraces on Linux" uses _r_debug under Linux unconditionally. It is incorrect since musl libc does not define _r_debug like glibc. gcc/ada/ * adaint.c [Linux]: Include . (__gnat_get_executable_load_address) [Linux]: Enable only for glibc and uClibc. --- gcc/ada/adaint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 1c23d15..8522094 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -3526,6 +3526,7 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) #if defined (__APPLE__) #include #elif defined (__linux__) +#include #include #endif @@ -3535,7 +3536,7 @@ __gnat_get_executable_load_address (void) #if defined (__APPLE__) return _dyld_get_image_header (0); -#elif defined (__linux__) +#elif defined (__linux__) && (defined (__GLIBC__) || defined (__UCLIBC__)) struct link_map *map = _r_debug.r_map; return (const void *)map->l_addr; -- 2.7.4