aboutsummaryrefslogtreecommitdiffstats
path: root/main/gcc/ada-musl.patch
blob: 7a86ae4afa3286fd53a97e4ffb78f5ecf7887390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 3b0aea9..ee0bb69 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -76,6 +76,11 @@
 #include <sys/param.h>
 #include <sys/pstat.h>
 #endif
+ 
+#if defined (linux)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
 
 #ifdef __PikeOS__
 #define __BSD_VISIBLE 1
@@ -3255,7 +3260,6 @@ __gnat_lwp_self (void)
 #endif
 
 #if defined (__linux__)
-#include <sched.h>
 
 /* glibc versions earlier than 2.7 do not define the routines to handle
    dynamically allocated CPU sets. For these targets, we use the static
@@ -3265,7 +3269,7 @@ __gnat_lwp_self (void)
 
 /* Dynamic cpu sets */
 
-cpu_set_t *
+void *
 __gnat_cpu_alloc (size_t count)
 {
   return CPU_ALLOC (count);
@@ -3278,33 +3282,33 @@ __gnat_cpu_alloc_size (size_t count)
 }
 
 void
-__gnat_cpu_free (cpu_set_t *set)
+__gnat_cpu_free (void *set)
 {
-  CPU_FREE (set);
+  CPU_FREE ((cpu_set_t *) set);
 }
 
 void
-__gnat_cpu_zero (size_t count, cpu_set_t *set)
+__gnat_cpu_zero (size_t count, void *set)
 {
-  CPU_ZERO_S (count, set);
+  CPU_ZERO_S (count, (cpu_set_t *) set);
 }
 
 void
-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
+__gnat_cpu_set (int cpu, size_t count, void *set)
 {
   /* Ada handles CPU numbers starting from 1, while C identifies the first
      CPU by a 0, so we need to adjust. */
-  CPU_SET_S (cpu - 1, count, set);
+  CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
 }
 
 #else /* !CPU_ALLOC */
 
 /* Static cpu sets */
 
-cpu_set_t *
+void *
 __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
 {
-  return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
+  return xmalloc (sizeof (cpu_set_t));
 }
 
 size_t
@@ -3314,23 +3318,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
 }
 
 void
-__gnat_cpu_free (cpu_set_t *set)
+__gnat_cpu_free (void *set)
 {
   free (set);
 }
 
 void
-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
 {
-  CPU_ZERO (set);
+  CPU_ZERO ((cpu_set_t *) set);
 }
 
 void
-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
 {
   /* Ada handles CPU numbers starting from 1, while C identifies the first
      CPU by a 0, so we need to adjust. */
-  CPU_SET (cpu - 1, set);
+  CPU_SET (cpu - 1, (cpu_set_t *) set);
 }
 #endif /* !CPU_ALLOC */
 #endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 0d12f7e..a063b47 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -316,13 +316,11 @@ extern void   *__gnat_lwp_self			   (void);
 
 /* Routines for interface to required CPU set primitives */
 
-#include <sched.h>
-
-extern cpu_set_t *__gnat_cpu_alloc                 (size_t);
+extern void * __gnat_cpu_alloc                 (size_t);
 extern size_t __gnat_cpu_alloc_size                (size_t);
-extern void   __gnat_cpu_free                  (cpu_set_t *);
-extern void   __gnat_cpu_zero                      (size_t, cpu_set_t *);
-extern void   __gnat_cpu_set                       (int, size_t, cpu_set_t *);
+extern void   __gnat_cpu_free                  (void *);
+extern void   __gnat_cpu_zero                      (size_t, void *);
+extern void   __gnat_cpu_set                       (int, size_t, void *);
 #endif
 
 #if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 7025f57..207b50d 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1108,13 +1108,6 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
 #include <stdio.h>
 #include <stdlib.h>
 
-/* On some system termio is either absent or including it will disable termios
-   (HP-UX) */
-#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
-  && !defined (__rtems__) && !defined (__QNXNTO__)
-#   include <termio.h>
-#endif
-
 #include <sys/ioctl.h>
 #include <termios.h>
 #include <fcntl.h>
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index ebb955e..08cfbee 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1028,7 +1028,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
   $(TRASYM_DWARF_UNIX_PAIRS) \
   g-sercom.adb<libgnat/g-sercom__linux.adb \
-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+  s-tsmona.adb<libgnat/s-tsmona.adb \
   a-exetim.adb<libgnarl/a-exetim__posix.adb \
   a-exetim.ads<libgnarl/a-exetim__default.ads \
   s-linux.ads<libgnarl/s-linux.ads \
@@ -1545,7 +1545,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
   g-sercom.adb<libgnat/g-sercom__linux.adb \
   $(TRASYM_DWARF_UNIX_PAIRS) \
-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+  s-tsmona.adb<libgnat/s-tsmona.adb \
   $(ATOMICS_TARGET_PAIRS) \
   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
   system.ads<libgnat/system-linux-ppc.ads
@@ -1574,7 +1574,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
 endif
 
 # ARM linux, GNU eabi
-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<libgnarl/a-intnam__linux.ads \
   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
@@ -1774,7 +1774,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
   s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
   g-sercom.adb<libgnat/g-sercom__linux.adb \
   $(TRASYM_DWARF_UNIX_PAIRS) \
-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+  s-tsmona.adb<libgnat/s-tsmona.adb \
   $(ATOMICS_TARGET_PAIRS) \
   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
   system.ads<libgnat/system-linux-ia64.ads
@@ -1871,7 +1871,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
   s-taspri.ads<libgnarl/s-taspri__posix.ads \
   g-sercom.adb<libgnat/g-sercom__linux.adb \
   $(TRASYM_DWARF_UNIX_PAIRS) \
-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+  s-tsmona.adb<libgnat/s-tsmona.adb \
   $(ATOMICS_TARGET_PAIRS) \
   $(X86_64_TARGET_PAIRS) \
   system.ads<libgnat/system-linux-x86.ads
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 207b50d..bd3a02c 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1152,7 +1152,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
 #if defined (__APPLE__) || defined (BSD)
 #define USE_OPENPTY
 #elif defined (__linux__)
-#define USE_GETPT
+#define USE_POSIX_OPENPT
 #elif defined (__sun__)
 #define USE_CLONE_DEVICE "/dev/ptmx"
 #elif defined (_AIX)
@@ -1201,8 +1201,8 @@ allocate_pty_desc (pty_desc **desc) {
    int  master_fd   = -1;
    char *slave_name = NULL;
 
-#ifdef USE_GETPT
-  master_fd = getpt ();
+#ifdef USE_POSIX_OPENPT
+  master_fd = posix_openpt(O_RDWR | O_NOCTTY);
 #elif defined (USE_OPENPTY)
   status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
 #elif defined (USE_CLONE_DEVICE)