summaryrefslogtreecommitdiffstats
path: root/main/gcc/ada-musl.patch
blob: a94f0e7442d9cf27e97e98528cfedfa8448462ab (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
diff -ru gcc-4.9.2/gcc/ada/adaint.c gcc-4.9.2/gcc/ada/adaint.c
--- gcc-4.9.2/gcc/ada/adaint.c	2014-02-24 18:51:58.000000000 -0200
+++ gcc-4.9.2/gcc/ada/adaint.c	2014-12-10 12:05:44.621173474 -0200
@@ -67,6 +67,11 @@
 #include <sys/pstat.h>
 #endif
 
+#if defined (linux)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
 #ifdef VMS
 #define _POSIX_EXIT 1
 #define HOST_EXECUTABLE_SUFFIX ".exe"
@@ -3891,8 +3896,6 @@
    return (void *) syscall (__NR_gettid);
 }
 
-#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
    versions. */
@@ -3901,7 +3904,7 @@
 
 /* Dynamic cpu sets */
 
-cpu_set_t *
+void *
 __gnat_cpu_alloc (size_t count)
 {
   return CPU_ALLOC (count);
@@ -3914,33 +3917,33 @@
 }
 
 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
@@ -3950,23 +3953,23 @@
 }
 
 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 -ru gcc-4.9.2/gcc/ada/adaint.h gcc-4.9.2/gcc/ada/adaint.h
--- gcc-4.9.2/gcc/ada/adaint.h	2014-02-24 18:51:58.000000000 -0200
+++ gcc-4.9.2/gcc/ada/adaint.h	2014-12-10 12:03:48.377834174 -0200
@@ -266,13 +266,11 @@
 
 /* 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)
--- gcc-4.9.2/gcc/ada/gcc-interface/Makefile.in.orig	2014-12-11 08:16:33.364902456 -0200
+++ gcc-4.9.2/gcc/ada/gcc-interface/Makefile.in	2014-12-11 08:16:51.998236755 -0200
@@ -1948,7 +1948,7 @@
 endif
 
 # ARM linux, GNU eabi
-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
   LIBGNAT_TARGET_PAIRS = \
   a-intnam.ads<a-intnam-linux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \