2023-05-29 16:47:58 +00:00
|
|
|
From e1e6dccc9124e0907c5ae174d20acb3bad87e633 Mon Sep 17 00:00:00 2001
|
2020-08-21 10:18:02 +00:00
|
|
|
From: Ariadne Conill <ariadne@dereferenced.org>
|
|
|
|
Date: Fri, 21 Aug 2020 07:07:48 +0000
|
2023-05-29 16:47:58 +00:00
|
|
|
Subject: [PATCH 26/33] ada: musl support fixes
|
2020-08-21 10:18:02 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
gcc/ada/Makefile.rtl | 10 +++++-----
|
|
|
|
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
|
|
|
|
gcc/ada/adaint.h | 10 ++++------
|
|
|
|
gcc/ada/terminals.c | 8 ++++----
|
|
|
|
4 files changed, 32 insertions(+), 30 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
|
2023-05-15 08:15:31 +00:00
|
|
|
index 96306f8cc9a..090b6770ae5 100644
|
2020-08-21 10:18:02 +00:00
|
|
|
--- a/gcc/ada/Makefile.rtl
|
|
|
|
+++ b/gcc/ada/Makefile.rtl
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
|
2020-08-21 10:18:02 +00:00
|
|
|
s-intman.adb<libgnarl/s-intman__posix.adb \
|
|
|
|
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
|
|
|
|
$(TRASYM_DWARF_UNIX_PAIRS) \
|
|
|
|
- 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 \
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
|
2021-11-25 09:09:10 +00:00
|
|
|
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
|
|
|
|
s-taspri.ads<libgnarl/s-taspri__posix.ads \
|
2020-08-21 10:18:02 +00:00
|
|
|
$(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
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
|
2020-08-21 10:18:02 +00:00
|
|
|
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 \
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
|
2020-08-21 10:18:02 +00:00
|
|
|
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
|
|
|
|
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
|
|
|
|
$(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) \
|
2021-11-25 09:09:10 +00:00
|
|
|
$(GNATRTL_128BIT_PAIRS) \
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
|
2020-08-21 10:18:02 +00:00
|
|
|
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
|
|
|
|
s-taspri.ads<libgnarl/s-taspri__posix.ads \
|
|
|
|
$(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) \
|
2023-05-15 08:15:31 +00:00
|
|
|
$(SIMD_PATH_TARGET_PAIRS) \
|
2018-09-27 17:15:08 +00:00
|
|
|
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
|
2023-05-15 08:15:31 +00:00
|
|
|
index 8522094164e..92b230a462b 100644
|
2018-09-27 17:15:08 +00:00
|
|
|
--- a/gcc/ada/adaint.c
|
|
|
|
+++ b/gcc/ada/adaint.c
|
2021-11-25 09:09:10 +00:00
|
|
|
@@ -91,6 +91,11 @@
|
2017-06-14 17:10:21 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/pstat.h>
|
|
|
|
#endif
|
|
|
|
+
|
2021-11-25 09:09:10 +00:00
|
|
|
+#if defined (linux) || defined(__linux__)
|
2017-06-14 17:10:21 +00:00
|
|
|
+#define _GNU_SOURCE 1
|
|
|
|
+#include <sched.h>
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#ifdef __PikeOS__
|
|
|
|
#define __BSD_VISIBLE 1
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
|
2018-09-27 17:15:08 +00:00
|
|
|
#endif
|
2017-06-14 17:10:21 +00:00
|
|
|
|
2018-09-27 17:15:08 +00:00
|
|
|
#if defined (__linux__)
|
2017-06-14 17:10:21 +00:00
|
|
|
-#include <sched.h>
|
2018-09-27 17:15:08 +00:00
|
|
|
|
2017-06-14 17:10:21 +00:00
|
|
|
/* glibc versions earlier than 2.7 do not define the routines to handle
|
|
|
|
dynamically allocated CPU sets. For these targets, we use the static
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
|
2017-06-14 17:10:21 +00:00
|
|
|
|
|
|
|
/* Dynamic cpu sets */
|
|
|
|
|
|
|
|
-cpu_set_t *
|
|
|
|
+void *
|
|
|
|
__gnat_cpu_alloc (size_t count)
|
|
|
|
{
|
|
|
|
return CPU_ALLOC (count);
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
|
2017-06-14 17:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
|
2017-06-14 17:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 */
|
2018-09-27 17:15:08 +00:00
|
|
|
#endif /* __linux__ */
|
|
|
|
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
|
2023-05-15 08:15:31 +00:00
|
|
|
index 987432c9307..4d782f07de9 100644
|
2018-09-27 17:15:08 +00:00
|
|
|
--- a/gcc/ada/adaint.h
|
|
|
|
+++ b/gcc/ada/adaint.h
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self (void);
|
2017-06-14 17:10:21 +00:00
|
|
|
|
|
|
|
/* 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)
|
2020-08-21 10:18:02 +00:00
|
|
|
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
|
2023-05-15 08:15:31 +00:00
|
|
|
index c0ee4a16bb1..ed796a48c1b 100644
|
2020-08-21 10:18:02 +00:00
|
|
|
--- a/gcc/ada/terminals.c
|
|
|
|
+++ b/gcc/ada/terminals.c
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
|
2019-09-12 14:01:29 +00:00
|
|
|
/* POSIX does not specify how to open the master side of a terminal.Several
|
|
|
|
methods are available (system specific):
|
|
|
|
1- using a cloning device (USE_CLONE_DEVICE)
|
|
|
|
- 2- getpt (USE_GETPT)
|
|
|
|
+ 2- posix_openpt (USE_POSIX_OPENPT)
|
|
|
|
3- openpty (USE_OPENPTY)
|
|
|
|
|
|
|
|
When using the cloning device method, the macro USE_CLONE_DEVICE should
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
|
2018-09-27 17:15:08 +00:00
|
|
|
#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)
|
2023-05-15 08:15:31 +00:00
|
|
|
@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
|
2018-09-27 17:15:08 +00:00
|
|
|
int master_fd = -1;
|
|
|
|
char *slave_name = NULL;
|
|
|
|
|
|
|
|
-#ifdef USE_GETPT
|
|
|
|
- master_fd = getpt ();
|
2019-09-12 14:01:29 +00:00
|
|
|
+#if defined(USE_POSIX_OPENPT)
|
2018-09-27 17:15:08 +00:00
|
|
|
+ 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)
|
2023-05-15 08:15:31 +00:00
|
|
|
--
|
|
|
|
2.40.1
|
|
|
|
|