diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 414346558654..2586a1368903 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -101,6 +101,8 @@ #define _LARGEFILE64_SOURCE 1 #endif +#include "adaint.h" + #ifdef IN_RTS #include "tconfig.h" #include "tsystem.h" @@ -243,8 +245,6 @@ UINT __gnat_current_ccs_encoding; #include #endif -#include "adaint.h" - /* Define symbols O_BINARY and O_TEXT as harmless zeroes if they are not defined in the current system. On DOS-like systems these flags control whether the file is opened/created in text-translation mode (CR/LF in diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 0d12f7e90209..74182446d4ac 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -319,6 +319,7 @@ extern void *__gnat_lwp_self (void); /* Routines for interface to required CPU set primitives */ +#define _GNU_SOURCE #include extern cpu_set_t *__gnat_cpu_alloc (size_t); diff --git a/gcc/ada/argv.c b/gcc/ada/argv.c index f62cf1eb37dc..0b6c5fe6f0df 100644 --- a/gcc/ada/argv.c +++ b/gcc/ada/argv.c @@ -42,6 +42,8 @@ main program, and these routines are accessed from the Ada.Command_Line.Environment package. */ +#include "adaint.h" + #ifdef IN_RTS #include "runtime.h" #include @@ -51,8 +53,6 @@ #include "system.h" #endif -#include "adaint.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/gcc/ada/cio.c b/gcc/ada/cio.c index ff97abe36ef1..56aa3477c8cd 100644 --- a/gcc/ada/cio.c +++ b/gcc/ada/cio.c @@ -29,6 +29,8 @@ * * ****************************************************************************/ +#include "adaint.h" + #ifdef IN_RTS #include "runtime.h" #include @@ -37,8 +39,6 @@ #include "system.h" #endif -#include "adaint.h" - /* We need L_tmpnam definition */ #include diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c index cdcb531e2b3f..dde6b9948089 100644 --- a/gcc/ada/cstreams.c +++ b/gcc/ada/cstreams.c @@ -58,6 +58,8 @@ #include "vxWorks.h" #endif +#include "adaint.h" + #ifdef IN_RTS #include #else @@ -65,8 +67,6 @@ #include "system.h" #endif -#include "adaint.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 0258f106d404..0416244ae428 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -2205,7 +2205,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 #endif /* __vxworks */ +#include "adaint.h" + #ifdef IN_RTS #include "runtime.h" #include @@ -53,8 +55,6 @@ #endif #endif -#include "adaint.h" - /* This function provides a portable binding to the mkdir function. */ int diff --git a/gcc/ada/raise.c b/gcc/ada/raise.c index 70ad6cd3282a..eb92de1b2137 100644 --- a/gcc/ada/raise.c +++ b/gcc/ada/raise.c @@ -32,6 +32,8 @@ /* Shared routines to support exception handling. __gnat_unhandled_terminate is shared between all exception handling mechanisms. */ +#include "adaint.h" + #ifdef IN_RTS #include "runtime.h" #else @@ -39,7 +41,6 @@ #include "system.h" #endif -#include "adaint.h" #include "raise.h" #ifdef __cplusplus diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 98b3901cb16f..98db6a14c2d5 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -52,6 +52,8 @@ #undef __linux__ #endif +#include "adaint.h" + #ifdef IN_RTS #define POSIX #include "runtime.h" @@ -74,8 +76,6 @@ extern struct tm *localtime_r(const time_t *, struct tm *); #endif -#include "adaint.h" - /* Don't use macros versions of this functions on VxWorks since they cause imcompatible changes in some VxWorks versions */ #ifdef __vxworks --- a/gcc/ada/terminals.c 2019-01-08 10:54:04.000000000 +0100 +++ b/gcc/ada/terminals.c 2019-05-15 13:14:09.935742526 +0200 @@ -1136,7 +1136,7 @@ /* 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 @@ -1150,7 +1150,7 @@ #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) @@ -1199,8 +1199,8 @@ int master_fd = -1; char *slave_name = NULL; -#ifdef USE_GETPT - master_fd = getpt (); +#if defined(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)