aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDongsheng Song <dongsheng.song@gmail.com>2023-02-14 12:51:29 +0100
committerEric Botcazou <ebotcazou@adacore.com>2023-02-14 12:54:37 +0100
commita16fc9333f1762d9b5a9da7239fe6a5cc9a6d190 (patch)
treedb4e6a44ff0bb562355897379465af4e2d5635c8 /gcc
parent994224236e0231807681b62e880d3c2772c69521 (diff)
downloadgcc-a16fc9333f1762d9b5a9da7239fe6a5cc9a6d190.zip
gcc-a16fc9333f1762d9b5a9da7239fe6a5cc9a6d190.tar.gz
gcc-a16fc9333f1762d9b5a9da7239fe6a5cc9a6d190.tar.bz2
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 <features.h>. (__gnat_get_executable_load_address) [Linux]: Enable only for glibc and uClibc.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/adaint.c3
1 files changed, 2 insertions, 1 deletions
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 <mach-o/dyld.h>
#elif defined (__linux__)
+#include <features.h>
#include <link.h>
#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;