public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5984] Fix musl build on Linux
@ 2023-02-14 11:55 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-02-14 11:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a16fc9333f1762d9b5a9da7239fe6a5cc9a6d190

commit r13-5984-ga16fc9333f1762d9b5a9da7239fe6a5cc9a6d190
Author: Dongsheng Song <dongsheng.song@gmail.com>
Date:   Tue Feb 14 12:51:29 2023 +0100

    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.

Diff:
---
 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 1c23d15846b..8522094164e 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-14 11:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 11:55 [gcc r13-5984] Fix musl build on Linux Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).