musl-ada.patch (6286B)
1diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c 2index 3b0aea9..ee0bb69 100644 3--- gcc/ada/adaint.c 4+++ gcc/ada/adaint.c 5@@ -76,6 +76,11 @@ 6 #include <sys/param.h> 7 #include <sys/pstat.h> 8 #endif 9+ 10+#if defined (linux) 11+#define _GNU_SOURCE 1 12+#include <sched.h> 13+#endif 14 15 #ifdef __PikeOS__ 16 #define __BSD_VISIBLE 1 17@@ -3255,7 +3260,6 @@ __gnat_lwp_self (void) 18 #endif 19 20 #if defined (__linux__) 21-#include <sched.h> 22 23 /* glibc versions earlier than 2.7 do not define the routines to handle 24 dynamically allocated CPU sets. For these targets, we use the static 25@@ -3265,7 +3269,7 @@ __gnat_lwp_self (void) 26 27 /* Dynamic cpu sets */ 28 29-cpu_set_t * 30+void * 31 __gnat_cpu_alloc (size_t count) 32 { 33 return CPU_ALLOC (count); 34@@ -3278,33 +3282,33 @@ __gnat_cpu_alloc_size (size_t count) 35 } 36 37 void 38-__gnat_cpu_free (cpu_set_t *set) 39+__gnat_cpu_free (void *set) 40 { 41- CPU_FREE (set); 42+ CPU_FREE ((cpu_set_t *) set); 43 } 44 45 void 46-__gnat_cpu_zero (size_t count, cpu_set_t *set) 47+__gnat_cpu_zero (size_t count, void *set) 48 { 49- CPU_ZERO_S (count, set); 50+ CPU_ZERO_S (count, (cpu_set_t *) set); 51 } 52 53 void 54-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set) 55+__gnat_cpu_set (int cpu, size_t count, void *set) 56 { 57 /* Ada handles CPU numbers starting from 1, while C identifies the first 58 CPU by a 0, so we need to adjust. */ 59- CPU_SET_S (cpu - 1, count, set); 60+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set); 61 } 62 63 #else /* !CPU_ALLOC */ 64 65 /* Static cpu sets */ 66 67-cpu_set_t * 68+void * 69 __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED) 70 { 71- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t)); 72+ return xmalloc (sizeof (cpu_set_t)); 73 } 74 75 size_t 76@@ -3314,23 +3318,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED) 77 } 78 79 void 80-__gnat_cpu_free (cpu_set_t *set) 81+__gnat_cpu_free (void *set) 82 { 83 free (set); 84 } 85 86 void 87-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) 88+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set) 89 { 90- CPU_ZERO (set); 91+ CPU_ZERO ((cpu_set_t *) set); 92 } 93 94 void 95-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) 96+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set) 97 { 98 /* Ada handles CPU numbers starting from 1, while C identifies the first 99 CPU by a 0, so we need to adjust. */ 100- CPU_SET (cpu - 1, set); 101+ CPU_SET (cpu - 1, (cpu_set_t *) set); 102 } 103 #endif /* !CPU_ALLOC */ 104 #endif /* __linux__ */ 105diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h 106index 0d12f7e..a063b47 100644 107--- gcc/ada/adaint.h 108+++ gcc/ada/adaint.h 109@@ -316,13 +316,11 @@ extern void *__gnat_lwp_self (void); 110 111 /* Routines for interface to required CPU set primitives */ 112 113-#include <sched.h> 114- 115-extern cpu_set_t *__gnat_cpu_alloc (size_t); 116+extern void * __gnat_cpu_alloc (size_t); 117 extern size_t __gnat_cpu_alloc_size (size_t); 118-extern void __gnat_cpu_free (cpu_set_t *); 119-extern void __gnat_cpu_zero (size_t, cpu_set_t *); 120-extern void __gnat_cpu_set (int, size_t, cpu_set_t *); 121+extern void __gnat_cpu_free (void *); 122+extern void __gnat_cpu_zero (size_t, void *); 123+extern void __gnat_cpu_set (int, size_t, void *); 124 #endif 125 126 #if defined (_WIN32) 127--- gcc/ada/Makefile.rtl 2020-07-23 08:35:17.052381336 +0200 128+++ - 2020-08-09 19:38:24.230351406 +0200 129@@ -1533,7 +1533,7 @@ 130 s-intman.adb<libgnarl/s-intman__posix.adb \ 131 s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ 132 $(TRASYM_DWARF_UNIX_PAIRS) \ 133- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ 134+ s-tsmona.adb<libgnat/s-tsmona.adb \ 135 a-exetim.adb<libgnarl/a-exetim__posix.adb \ 136 a-exetim.ads<libgnarl/a-exetim__default.ads \ 137 s-linux.ads<libgnarl/s-linux.ads \ 138@@ -2083,7 +2083,7 @@ 139 s-osinte.adb<libgnarl/s-osinte__posix.adb \ 140 s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ 141 $(TRASYM_DWARF_UNIX_PAIRS) \ 142- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ 143+ s-tsmona.adb<libgnat/s-tsmona.adb \ 144 $(ATOMICS_TARGET_PAIRS) \ 145 $(ATOMICS_BUILTINS_TARGET_PAIRS) \ 146 system.ads<libgnat/system-linux-ppc.ads 147@@ -2112,7 +2112,7 @@ 148 endif 149 150 # ARM linux, GNU eabi 151-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),) 152+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),) 153 LIBGNAT_TARGET_PAIRS = \ 154 a-intnam.ads<libgnarl/a-intnam__linux.ads \ 155 s-inmaop.adb<libgnarl/s-inmaop__posix.adb \ 156@@ -2305,7 +2305,7 @@ 157 s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ 158 s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \ 159 $(TRASYM_DWARF_UNIX_PAIRS) \ 160- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ 161+ s-tsmona.adb<libgnat/s-tsmona.adb \ 162 $(ATOMICS_TARGET_PAIRS) \ 163 $(ATOMICS_BUILTINS_TARGET_PAIRS) \ 164 system.ads<libgnat/system-linux-ia64.ads 165@@ -2401,7 +2401,7 @@ 166 s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ 167 s-taspri.ads<libgnarl/s-taspri__posix.ads \ 168 $(TRASYM_DWARF_UNIX_PAIRS) \ 169- s-tsmona.adb<libgnat/s-tsmona__linux.adb \ 170+ s-tsmona.adb<libgnat/s-tsmona.adb \ 171 $(ATOMICS_TARGET_PAIRS) \ 172 $(X86_64_TARGET_PAIRS) \ 173 system.ads<libgnat/system-linux-x86.ads 174--- gcc/ada/terminals.c 2019-01-08 10:54:04.000000000 +0100 175+++ gcc/ada/terminals.c 2019-05-15 13:14:09.935742526 +0200 176@@ -1136,7 +1136,7 @@ 177 /* POSIX does not specify how to open the master side of a terminal.Several 178 methods are available (system specific): 179 1- using a cloning device (USE_CLONE_DEVICE) 180- 2- getpt (USE_GETPT) 181+ 2- posix_openpt (USE_POSIX_OPENPT) 182 3- openpty (USE_OPENPTY) 183 184 When using the cloning device method, the macro USE_CLONE_DEVICE should 185@@ -1150,7 +1150,7 @@ 186 #if defined (__APPLE__) || defined (BSD) 187 #define USE_OPENPTY 188 #elif defined (__linux__) 189-#define USE_GETPT 190+#define USE_POSIX_OPENPT 191 #elif defined (__sun__) 192 #define USE_CLONE_DEVICE "/dev/ptmx" 193 #elif defined (_AIX) 194@@ -1199,8 +1199,8 @@ 195 int master_fd = -1; 196 char *slave_name = NULL; 197 198-#ifdef USE_GETPT 199- master_fd = getpt (); 200+#if defined(USE_POSIX_OPENPT) 201+ master_fd = posix_openpt(O_RDWR | O_NOCTTY); 202 #elif defined (USE_OPENPTY) 203 status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL); 204 #elif defined (USE_CLONE_DEVICE)