From: Dongsheng Song Date: Tue, 14 Feb 2023 11:51:29 +0000 (+0100) Subject: Fix musl build on Linux X-Git-Tag: basepoints/gcc-14~1223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a16fc9333f1762d9b5a9da7239fe6a5cc9a6d190;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 1c23d15846b1..8522094164e0 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;