Hello. Please skip v14 and review v15. A diff with v13 is attached. The full v15 is at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065, but my SMTP server refused them as attachments.
Patch 1 implements the new Ada.Calendar_Conversions.To_{Duration,Struct_Timespec}64 with System.C_Time, as already done for the unsuffixed version in v13. It adds a comment explaining that the conversion fails when the C struct cannot represent the value, even if Long_Long_Integer can. Patch 2 selects the time64 symbols for C time functions in the 32bits/time64/glibc case with explicit External_Names (instead of duplicating a test is several files in v13), so that glibc/musl specifics are only written once in s-oscons-tplt.c. Do these changes answer your concerns? --- v13/0002-Ada-merge-all-timeval-and-timespec-definitions-and-c.patch 2025-04-12 16:01:11.085526147 +0200 +++ v15/0001-Ada-merge-all-timeval-and-timespec-definitions-and-c.patch 2025-04-13 19:09:48.932492634 +0200 @@ -1,7 +1,7 @@ -From 29fa6493e708fd44af9cfb0197d146c13221c0b8 Mon Sep 17 00:00:00 2001 +From a3ecab71b8dbdf79055c1e9a9124e40636ad1355 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> -Date: Tue, 23 Apr 2024 08:37:43 +0200 -Subject: [PATCH 2/9] Ada: merge all timeval and timespec definitions and +Date: Sat, 22 Feb 2025 15:58:18 +0100 +Subject: [PATCH 1/8] Ada: merge all timeval and timespec definitions and conversions [PR114065] Add a new System.C_Time unit in libgnat, @@ -20,9 +20,9 @@ conversions, preventing some avoidable roundings (when Duration'Size = 32) or overflows (when time_t'Size = 64). -Remove the non portable conversions based on long int from the private +Remove the non portable conversions based on long (long) int from the private part of a-calend.ads but keep them in Ada.Calendar.Conversions and -GNAT.Calendar for backward compatibility. +GNAT.Calendar, with the same base types, for backward compatibility. In s-oscons-tmplt.c, add sizeof(timespec.tv_nsec) because it is not always a long int. @@ -89,7 +89,7 @@ * gcc/ada/libgnat/a-calcon.adb: Likewise. * gcc/ada/libgnat/a-calcon.ads: Keep To_{Duration,Timespec} for compatibility. * gcc/ada/libgnat/a-calend.adb: Likewise. - * gcc/ada/libgnat/a-calend.ads: Remove non-portable (long int) + * gcc/ada/libgnat/a-calend.ads: Remove non-portable long (long) int conversions from the private part. * gcc/ada/libgnat/g-calend.adb: Likewise * gcc/ada/libgnat/g-calend.ads: Keep To_{Duration,Timeval} for compatibility. @@ -127,7 +127,7 @@ * gcc/ada/libgnat/s-c_time.ads: New file. --- gcc/ada/Makefile.rtl | 4 +- - gcc/ada/cal.c | 74 ------- + gcc/ada/cal.c | 74 ------ gcc/ada/gcc-interface/Makefile.in | 1 - gcc/ada/libgnarl/a-exetim__posix.adb | 7 +- gcc/ada/libgnarl/s-linux.ads | 17 -- @@ -140,30 +140,30 @@ gcc/ada/libgnarl/s-linux__sparc.ads | 17 -- gcc/ada/libgnarl/s-linux__x32.ads | 19 -- gcc/ada/libgnarl/s-osinte__aix.adb | 32 --- - gcc/ada/libgnarl/s-osinte__aix.ads | 25 +-- - gcc/ada/libgnarl/s-osinte__android.adb | 74 ------- - gcc/ada/libgnarl/s-osinte__android.ads | 25 +-- + gcc/ada/libgnarl/s-osinte__aix.ads | 25 +- + gcc/ada/libgnarl/s-osinte__android.adb | 74 ------ + gcc/ada/libgnarl/s-osinte__android.ads | 25 +- gcc/ada/libgnarl/s-osinte__cheribsd.ads | 27 +-- - gcc/ada/libgnarl/s-osinte__darwin.adb | 61 +----- - gcc/ada/libgnarl/s-osinte__darwin.ads | 25 +-- + gcc/ada/libgnarl/s-osinte__darwin.adb | 61 +---- + gcc/ada/libgnarl/s-osinte__darwin.ads | 25 +- gcc/ada/libgnarl/s-osinte__dragonfly.adb | 33 --- gcc/ada/libgnarl/s-osinte__dragonfly.ads | 27 +-- gcc/ada/libgnarl/s-osinte__freebsd.adb | 32 --- gcc/ada/libgnarl/s-osinte__freebsd.ads | 27 +-- gcc/ada/libgnarl/s-osinte__gnu.adb | 33 --- gcc/ada/libgnarl/s-osinte__gnu.ads | 27 +-- - gcc/ada/libgnarl/s-osinte__hpux.ads | 25 +-- + gcc/ada/libgnarl/s-osinte__hpux.ads | 25 +- gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads | 27 +-- gcc/ada/libgnarl/s-osinte__linux.ads | 18 +- gcc/ada/libgnarl/s-osinte__lynxos178.adb | 32 --- gcc/ada/libgnarl/s-osinte__lynxos178e.ads | 35 +-- gcc/ada/libgnarl/s-osinte__posix.adb | 33 --- gcc/ada/libgnarl/s-osinte__qnx.adb | 33 --- - gcc/ada/libgnarl/s-osinte__qnx.ads | 25 +-- + gcc/ada/libgnarl/s-osinte__qnx.ads | 25 +- gcc/ada/libgnarl/s-osinte__rtems.adb | 30 --- gcc/ada/libgnarl/s-osinte__rtems.ads | 29 +-- gcc/ada/libgnarl/s-osinte__solaris.adb | 34 --- - gcc/ada/libgnarl/s-osinte__solaris.ads | 25 +-- + gcc/ada/libgnarl/s-osinte__solaris.ads | 25 +- gcc/ada/libgnarl/s-osinte__vxworks.adb | 32 --- gcc/ada/libgnarl/s-osinte__vxworks.ads | 28 +-- gcc/ada/libgnarl/s-osinte__x32.adb | 33 --- @@ -171,43 +171,43 @@ gcc/ada/libgnarl/s-taprop__solaris.adb | 17 +- gcc/ada/libgnarl/s-taprop__vxworks.adb | 5 +- gcc/ada/libgnarl/s-tpopmo.adb | 18 +- - gcc/ada/libgnat/a-calcon.adb | 33 --- - gcc/ada/libgnat/a-calcon.ads | 23 +- - gcc/ada/libgnat/a-calend.adb | 38 ---- - gcc/ada/libgnat/a-calend.ads | 11 - + gcc/ada/libgnat/a-calcon.adb | 66 ------ + gcc/ada/libgnat/a-calcon.ads | 44 ++-- + gcc/ada/libgnat/a-calend.adb | 63 ----- + gcc/ada/libgnat/a-calend.ads | 28 --- gcc/ada/libgnat/g-calend.adb | 58 ----- - gcc/ada/libgnat/g-calend.ads | 25 +-- + gcc/ada/libgnat/g-calend.ads | 25 +- gcc/ada/libgnat/g-socket.adb | 79 +------ gcc/ada/libgnat/g-socthi.adb | 4 +- gcc/ada/libgnat/g-socthi__vxworks.adb | 4 +- gcc/ada/libgnat/g-sothco.ads | 24 +- gcc/ada/libgnat/g-spogwa.adb | 11 +- - gcc/ada/libgnat/s-c_time.adb | 231 ++++++++++++++++++++ - gcc/ada/libgnat/s-c_time.ads | 128 +++++++++++ + gcc/ada/libgnat/s-c_time.adb | 248 ++++++++++++++++++++ + gcc/ada/libgnat/s-c_time.ads | 135 +++++++++++ gcc/ada/libgnat/s-optide.adb | 6 +- gcc/ada/libgnat/s-osprim__darwin.adb | 59 +---- - gcc/ada/libgnat/s-osprim__posix.adb | 63 +----- + gcc/ada/libgnat/s-osprim__posix.adb | 63 +---- gcc/ada/libgnat/s-osprim__posix2008.adb | 48 +--- gcc/ada/libgnat/s-osprim__rtems.adb | 71 +----- gcc/ada/libgnat/s-osprim__solaris.adb | 27 +-- gcc/ada/libgnat/s-osprim__unix.adb | 27 +-- - gcc/ada/libgnat/s-osprim__x32.adb | 65 +----- + gcc/ada/libgnat/s-osprim__x32.adb | 65 +---- gcc/ada/libgnat/s-parame.ads | 7 - gcc/ada/libgnat/s-parame__hpux.ads | 7 - gcc/ada/libgnat/s-parame__posix2008.ads | 8 - gcc/ada/libgnat/s-parame__vxworks.ads | 15 -- gcc/ada/s-oscons-tmplt.c | 11 + - 71 files changed, 577 insertions(+), 1702 deletions(-) + 71 files changed, 617 insertions(+), 1782 deletions(-) delete mode 100644 gcc/ada/cal.c delete mode 100644 gcc/ada/libgnarl/s-osinte__android.adb create mode 100644 gcc/ada/libgnat/s-c_time.adb create mode 100644 gcc/ada/libgnat/s-c_time.ads diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index 4d32bc47185..acf97ec7c37 100644 +index 61600adf1f3..27343779374 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl -@@ -754,6 +754,7 @@ GNATRTL_NONTASKING_OBJS= \ +@@ -760,6 +760,7 @@ GNATRTL_NONTASKING_OBJS= \ s-string$(objext) \ s-ststop$(objext) \ s-tasloc$(objext) \ @@ -215,7 +215,7 @@ s-traceb$(objext) \ s-traent$(objext) \ s-trasym$(objext) \ -@@ -1412,7 +1413,6 @@ ifeq ($(strip $(filter-out arm% aarch64 linux-android%,$(target_cpu) $(target_os +@@ -1422,7 +1423,6 @@ ifeq ($(strip $(filter-out arm% aarch64 linux-android%,$(target_cpu) $(target_os a-intnam.ads<libgnarl/a-intnam__linux.ads \ s-inmaop.adb<libgnarl/s-inmaop__posix.adb \ s-intman.adb<libgnarl/s-intman__android.adb \ @@ -223,7 +223,7 @@ s-osinte.ads<libgnarl/s-osinte__android.ads \ s-oslock.ads<libgnat/s-oslock__posix.ads \ s-osprim.adb<libgnat/s-osprim__posix.adb \ -@@ -3098,7 +3098,7 @@ LIBGNAT_TARGET_PAIRS += \ +@@ -3195,7 +3195,7 @@ LIBGNAT_TARGET_PAIRS += \ # library. LIBGNAT_OBJS is the list of object files for libgnat. # thread.c is special as put into GNATRTL_TASKING_OBJS LIBGNAT_OBJS = adadecode.o adaint.o argv.o aux-io.o \ @@ -234,7 +234,7 @@ raise.o seh_init.o socket.o sysdep.o \ diff --git a/gcc/ada/cal.c b/gcc/ada/cal.c deleted file mode 100644 -index 4485af06e61..00000000000 +index 0a61e0f251a..00000000000 --- a/gcc/ada/cal.c +++ /dev/null @@ -1,74 +0,0 @@ @@ -246,7 +246,7 @@ - * * - * C Implementation File * - * * -- * Copyright (C) 1992-2024, Free Software Foundation, Inc. * +- * Copyright (C) 1992-2025, Free Software Foundation, Inc. * - * * - * GNAT is free software; you can redistribute it and/or modify it under * - * terms of the GNU General Public License as published by the Free Soft- * @@ -313,10 +313,10 @@ - t->tv_usec = usec; -} diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in -index 12f9d652a85..6b4ffdcd734 100644 +index 4ffdc1e165d..622afbe0fa3 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in -@@ -922,7 +922,6 @@ tracebak.o : tracebak.c +@@ -937,7 +937,6 @@ tracebak.o : tracebak.c adadecode.o : adadecode.c adadecode.h aux-io.o : aux-io.c argv.o : argv.c @@ -325,7 +325,7 @@ errno.o : errno.c exit.o : adaint.h exit.c diff --git a/gcc/ada/libgnarl/a-exetim__posix.adb b/gcc/ada/libgnarl/a-exetim__posix.adb -index 6f3eecb2fe6..424dee7c3cb 100644 +index ee27ff29f15..02c20262bc0 100644 --- a/gcc/ada/libgnarl/a-exetim__posix.adb +++ b/gcc/ada/libgnarl/a-exetim__posix.adb @@ -34,6 +34,7 @@ @@ -364,7 +364,7 @@ -------------------------- diff --git a/gcc/ada/libgnarl/s-linux.ads b/gcc/ada/libgnarl/s-linux.ads -index 233b831bd08..5ce6c70a53b 100644 +index 62176f1bd96..f41a67bd8a3 100644 --- a/gcc/ada/libgnarl/s-linux.ads +++ b/gcc/ada/libgnarl/s-linux.ads @@ -36,7 +36,6 @@ @@ -401,7 +401,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-linux__alpha.ads b/gcc/ada/libgnarl/s-linux__alpha.ads -index 72d703d4bf3..20dce8dab0a 100644 +index 855e6672e36..c05b90c04cb 100644 --- a/gcc/ada/libgnarl/s-linux__alpha.ads +++ b/gcc/ada/libgnarl/s-linux__alpha.ads @@ -36,7 +36,6 @@ @@ -438,7 +438,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-linux__android-arm.ads b/gcc/ada/libgnarl/s-linux__android-arm.ads -index 1a21f78ffd8..7cca0f89ea9 100644 +index 3e0325e1902..867fd1e447e 100644 --- a/gcc/ada/libgnarl/s-linux__android-arm.ads +++ b/gcc/ada/libgnarl/s-linux__android-arm.ads @@ -36,7 +36,6 @@ @@ -475,7 +475,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-linux__hppa.ads b/gcc/ada/libgnarl/s-linux__hppa.ads -index aaa15f80109..362408e556c 100644 +index a3ce02bcb6e..e249846cd30 100644 --- a/gcc/ada/libgnarl/s-linux__hppa.ads +++ b/gcc/ada/libgnarl/s-linux__hppa.ads @@ -36,7 +36,6 @@ @@ -512,7 +512,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-linux__loongarch.ads b/gcc/ada/libgnarl/s-linux__loongarch.ads -index 56733352061..ae22441864d 100644 +index e0eaaa47e71..20e3d909c0e 100644 --- a/gcc/ada/libgnarl/s-linux__loongarch.ads +++ b/gcc/ada/libgnarl/s-linux__loongarch.ads @@ -35,7 +35,6 @@ @@ -550,7 +550,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-linux__mips.ads b/gcc/ada/libgnarl/s-linux__mips.ads -index e7a4597b69d..395d125930d 100644 +index 3ad7f45379e..6a575c7a865 100644 --- a/gcc/ada/libgnarl/s-linux__mips.ads +++ b/gcc/ada/libgnarl/s-linux__mips.ads @@ -35,7 +35,6 @@ @@ -599,7 +599,7 @@ sa_flags_pos : constant := 0; diff --git a/gcc/ada/libgnarl/s-linux__riscv.ads b/gcc/ada/libgnarl/s-linux__riscv.ads -index 17df09425a9..5ef97a33bca 100644 +index 867cb1fa807..ad0a07b8c50 100644 --- a/gcc/ada/libgnarl/s-linux__riscv.ads +++ b/gcc/ada/libgnarl/s-linux__riscv.ads @@ -35,7 +35,6 @@ @@ -648,7 +648,7 @@ SA_SIGINFO : constant := 16#04#; SA_ONSTACK : constant := 16#08000000#; diff --git a/gcc/ada/libgnarl/s-linux__sparc.ads b/gcc/ada/libgnarl/s-linux__sparc.ads -index 9bfefc2bea4..4f42192774d 100644 +index 5ff201cf832..037834617d7 100644 --- a/gcc/ada/libgnarl/s-linux__sparc.ads +++ b/gcc/ada/libgnarl/s-linux__sparc.ads @@ -36,7 +36,6 @@ @@ -685,7 +685,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-linux__x32.ads b/gcc/ada/libgnarl/s-linux__x32.ads -index 93a27181d16..e586ae0b8f0 100644 +index 6144b8b34ce..d1571673a8f 100644 --- a/gcc/ada/libgnarl/s-linux__x32.ads +++ b/gcc/ada/libgnarl/s-linux__x32.ads @@ -38,8 +38,6 @@ @@ -724,7 +724,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-osinte__aix.adb b/gcc/ada/libgnarl/s-osinte__aix.adb -index 6ca3d980001..2cd23b5f0b3 100644 +index da057d47cf5..3a2df424d91 100644 --- a/gcc/ada/libgnarl/s-osinte__aix.adb +++ b/gcc/ada/libgnarl/s-osinte__aix.adb @@ -35,15 +35,6 @@ package body System.OS_Interface is @@ -774,7 +774,7 @@ -- sched_yield -- ----------------- diff --git a/gcc/ada/libgnarl/s-osinte__aix.ads b/gcc/ada/libgnarl/s-osinte__aix.ads -index ba61be13131..4f1cbac23c1 100644 +index 1e115b80d6f..eb417a2cc99 100644 --- a/gcc/ada/libgnarl/s-osinte__aix.ads +++ b/gcc/ada/libgnarl/s-osinte__aix.ads @@ -43,8 +43,8 @@ with Ada.Unchecked_Conversion; @@ -843,7 +843,7 @@ -- typedef struct __pt_attr *pthread_attr_t; diff --git a/gcc/ada/libgnarl/s-osinte__android.adb b/gcc/ada/libgnarl/s-osinte__android.adb deleted file mode 100644 -index 46708079c1e..00000000000 +index 3e36d284c91..00000000000 --- a/gcc/ada/libgnarl/s-osinte__android.adb +++ /dev/null @@ -1,74 +0,0 @@ @@ -855,7 +855,7 @@ --- -- --- B o d y -- --- -- ---- Copyright (C) 1995-2024, AdaCore -- +--- Copyright (C) 1995-2025, AdaCore -- --- -- --- GNAT is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- @@ -922,7 +922,7 @@ - -end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-osinte__android.ads b/gcc/ada/libgnarl/s-osinte__android.ads -index ee8319890c7..a9ef8f025c2 100644 +index cd7e148933d..cecc338f639 100644 --- a/gcc/ada/libgnarl/s-osinte__android.ads +++ b/gcc/ada/libgnarl/s-osinte__android.ads @@ -42,10 +42,10 @@ with Ada.Unchecked_Conversion; @@ -991,7 +991,7 @@ -- Local type only used to get the alignment of this type below diff --git a/gcc/ada/libgnarl/s-osinte__cheribsd.ads b/gcc/ada/libgnarl/s-osinte__cheribsd.ads -index fd3c603d8b4..f4e5ae11a65 100644 +index d9dae354d41..350fa1f15ad 100644 --- a/gcc/ada/libgnarl/s-osinte__cheribsd.ads +++ b/gcc/ada/libgnarl/s-osinte__cheribsd.ads @@ -44,8 +44,8 @@ with Ada.Unchecked_Conversion; @@ -1064,7 +1064,7 @@ type pthread_attr_t is new System.Address; type pthread_mutexattr_t is new System.Address; diff --git a/gcc/ada/libgnarl/s-osinte__darwin.adb b/gcc/ada/libgnarl/s-osinte__darwin.adb -index a2ab6d2febf..4d4cec4cb74 100644 +index f512210d343..eeafbdbef8f 100644 --- a/gcc/ada/libgnarl/s-osinte__darwin.adb +++ b/gcc/ada/libgnarl/s-osinte__darwin.adb @@ -36,15 +36,6 @@ with Interfaces.C.Extensions; @@ -1184,7 +1184,7 @@ if nsec > 0 then Result := 0; diff --git a/gcc/ada/libgnarl/s-osinte__darwin.ads b/gcc/ada/libgnarl/s-osinte__darwin.ads -index 0ffa18b481a..acf007e7d3f 100644 +index ea62f24cbc0..1b2a40b3cbe 100644 --- a/gcc/ada/libgnarl/s-osinte__darwin.ads +++ b/gcc/ada/libgnarl/s-osinte__darwin.ads @@ -40,9 +40,9 @@ @@ -1250,7 +1250,7 @@ -- Darwin specific signal implementation -- diff --git a/gcc/ada/libgnarl/s-osinte__dragonfly.adb b/gcc/ada/libgnarl/s-osinte__dragonfly.adb -index 6f9c95546e5..96d6c212e36 100644 +index 73061d9eeb0..adfbaeb27fc 100644 --- a/gcc/ada/libgnarl/s-osinte__dragonfly.adb +++ b/gcc/ada/libgnarl/s-osinte__dragonfly.adb @@ -69,15 +69,6 @@ package body System.OS_Interface is @@ -1299,7 +1299,7 @@ - end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-osinte__dragonfly.ads b/gcc/ada/libgnarl/s-osinte__dragonfly.ads -index e34c7fb7cc9..d3eece54020 100644 +index 00dc11de274..9e7b88e3c6e 100644 --- a/gcc/ada/libgnarl/s-osinte__dragonfly.ads +++ b/gcc/ada/libgnarl/s-osinte__dragonfly.ads @@ -43,8 +43,8 @@ with Ada.Unchecked_Conversion; @@ -1372,7 +1372,7 @@ type pthread_attr_t is new System.Address; type pthread_mutexattr_t is new System.Address; diff --git a/gcc/ada/libgnarl/s-osinte__freebsd.adb b/gcc/ada/libgnarl/s-osinte__freebsd.adb -index 16925368bed..05537714d37 100644 +index a3240bb38d1..4516935bbc8 100644 --- a/gcc/ada/libgnarl/s-osinte__freebsd.adb +++ b/gcc/ada/libgnarl/s-osinte__freebsd.adb @@ -69,15 +69,6 @@ package body System.OS_Interface is @@ -1420,7 +1420,7 @@ - end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-osinte__freebsd.ads b/gcc/ada/libgnarl/s-osinte__freebsd.ads -index bda06b9c5fe..40ed7e54ccb 100644 +index b10270a4cc4..027f81d060b 100644 --- a/gcc/ada/libgnarl/s-osinte__freebsd.ads +++ b/gcc/ada/libgnarl/s-osinte__freebsd.ads @@ -43,8 +43,8 @@ with Ada.Unchecked_Conversion; @@ -1493,7 +1493,7 @@ type pthread_attr_t is new System.Address; type pthread_mutexattr_t is new System.Address; diff --git a/gcc/ada/libgnarl/s-osinte__gnu.adb b/gcc/ada/libgnarl/s-osinte__gnu.adb -index f5a03115107..9ebcb9e4c22 100644 +index 675cd0d9399..2c70f0dea15 100644 --- a/gcc/ada/libgnarl/s-osinte__gnu.adb +++ b/gcc/ada/libgnarl/s-osinte__gnu.adb @@ -93,15 +93,6 @@ package body System.OS_Interface is @@ -1542,7 +1542,7 @@ - end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-osinte__gnu.ads b/gcc/ada/libgnarl/s-osinte__gnu.ads -index 62645b6d44b..aebb369ba27 100644 +index 870059d0967..18410c60415 100644 --- a/gcc/ada/libgnarl/s-osinte__gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__gnu.ads @@ -42,8 +42,8 @@ with Ada.Unchecked_Conversion; @@ -1616,7 +1616,7 @@ -- typedef struct __pthread_attr pthread_attr_t; -- /usr/include/i386-gnu/bits/thread-attr.h: struct __pthread_attr... diff --git a/gcc/ada/libgnarl/s-osinte__hpux.ads b/gcc/ada/libgnarl/s-osinte__hpux.ads -index 5d3d35240c3..1a174527ee9 100644 +index 9d0f26d50f7..60fab698113 100644 --- a/gcc/ada/libgnarl/s-osinte__hpux.ads +++ b/gcc/ada/libgnarl/s-osinte__hpux.ads @@ -42,8 +42,8 @@ with Ada.Unchecked_Conversion; @@ -1684,7 +1684,7 @@ type pthread_condattr_t is new int; type pthread_mutexattr_t is new int; diff --git a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads -index 5725a1115bd..14f578e0241 100644 +index 9924659cce5..fc6d7a992f1 100644 --- a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads @@ -42,8 +42,8 @@ with Ada.Unchecked_Conversion; @@ -1758,7 +1758,7 @@ detachstate : int; schedpolicy : int; diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads -index 71788be0431..f7504f2f0b4 100644 +index 7aeb15da523..2c6b353a5e0 100644 --- a/gcc/ada/libgnarl/s-osinte__linux.ads +++ b/gcc/ada/libgnarl/s-osinte__linux.ads @@ -42,6 +42,7 @@ with Ada.Unchecked_Conversion; @@ -1817,7 +1817,7 @@ -------------------------- diff --git a/gcc/ada/libgnarl/s-osinte__lynxos178.adb b/gcc/ada/libgnarl/s-osinte__lynxos178.adb -index ea8cfab06b5..bd941dd0fc6 100644 +index 88758a954f8..beeefb617fe 100644 --- a/gcc/ada/libgnarl/s-osinte__lynxos178.adb +++ b/gcc/ada/libgnarl/s-osinte__lynxos178.adb @@ -85,15 +85,6 @@ package body System.OS_Interface is @@ -1867,7 +1867,7 @@ -- sigwait -- ------------- diff --git a/gcc/ada/libgnarl/s-osinte__lynxos178e.ads b/gcc/ada/libgnarl/s-osinte__lynxos178e.ads -index d9f2f121a78..03641f4fef8 100644 +index 8b31e204acb..dcc36b25185 100644 --- a/gcc/ada/libgnarl/s-osinte__lynxos178e.ads +++ b/gcc/ada/libgnarl/s-osinte__lynxos178e.ads @@ -42,9 +42,9 @@ with Ada.Unchecked_Conversion; @@ -1953,7 +1953,7 @@ stksize : int; prio : int; diff --git a/gcc/ada/libgnarl/s-osinte__posix.adb b/gcc/ada/libgnarl/s-osinte__posix.adb -index a91a9ae8557..70a3f2e5268 100644 +index 1cb4f23aec6..9676b5bd5ff 100644 --- a/gcc/ada/libgnarl/s-osinte__posix.adb +++ b/gcc/ada/libgnarl/s-osinte__posix.adb @@ -58,15 +58,6 @@ package body System.OS_Interface is @@ -2002,7 +2002,7 @@ - end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-osinte__qnx.adb b/gcc/ada/libgnarl/s-osinte__qnx.adb -index d752eca74f1..aef54650480 100644 +index 720022548df..4fc4229b228 100644 --- a/gcc/ada/libgnarl/s-osinte__qnx.adb +++ b/gcc/ada/libgnarl/s-osinte__qnx.adb @@ -70,15 +70,6 @@ package body System.OS_Interface is @@ -2051,7 +2051,7 @@ - end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-osinte__qnx.ads b/gcc/ada/libgnarl/s-osinte__qnx.ads -index 91b1d18739d..109b979d5a9 100644 +index ea940d86330..ee13235d891 100644 --- a/gcc/ada/libgnarl/s-osinte__qnx.ads +++ b/gcc/ada/libgnarl/s-osinte__qnx.ads @@ -41,9 +41,9 @@ with Ada.Unchecked_Conversion; @@ -2119,7 +2119,7 @@ -- Local type only used to get the alignment of this type below diff --git a/gcc/ada/libgnarl/s-osinte__rtems.adb b/gcc/ada/libgnarl/s-osinte__rtems.adb -index 19b45c4dc19..15e13c9d4c8 100644 +index c0f6c265b50..efd602e73f8 100644 --- a/gcc/ada/libgnarl/s-osinte__rtems.adb +++ b/gcc/ada/libgnarl/s-osinte__rtems.adb @@ -92,15 +92,6 @@ package body System.OS_Interface is @@ -2167,7 +2167,7 @@ -- Binary_Semaphore_Create -- ----------------------------- diff --git a/gcc/ada/libgnarl/s-osinte__rtems.ads b/gcc/ada/libgnarl/s-osinte__rtems.ads -index de7174c23cd..d8abcdc2e60 100644 +index 21b1be8a306..184d4897836 100644 --- a/gcc/ada/libgnarl/s-osinte__rtems.ads +++ b/gcc/ada/libgnarl/s-osinte__rtems.ads @@ -52,9 +52,9 @@ @@ -2250,7 +2250,7 @@ CLOCK_MONOTONIC : constant clockid_t := System.OS_Constants.CLOCK_MONOTONIC; diff --git a/gcc/ada/libgnarl/s-osinte__solaris.adb b/gcc/ada/libgnarl/s-osinte__solaris.adb -index 32e5911bb25..21cb90ffde5 100644 +index e5626fc4f0d..78144efdbcd 100644 --- a/gcc/ada/libgnarl/s-osinte__solaris.adb +++ b/gcc/ada/libgnarl/s-osinte__solaris.adb @@ -35,42 +35,8 @@ @@ -2297,7 +2297,7 @@ -- pthread_init -- ------------------ diff --git a/gcc/ada/libgnarl/s-osinte__solaris.ads b/gcc/ada/libgnarl/s-osinte__solaris.ads -index 3703697ef44..64e54d8794e 100644 +index d62dd37110e..e9b59fe1ca9 100644 --- a/gcc/ada/libgnarl/s-osinte__solaris.ads +++ b/gcc/ada/libgnarl/s-osinte__solaris.ads @@ -42,8 +42,8 @@ with Ada.Unchecked_Conversion; @@ -2363,7 +2363,7 @@ type record_type_3 is record flag : array_type_9; diff --git a/gcc/ada/libgnarl/s-osinte__vxworks.adb b/gcc/ada/libgnarl/s-osinte__vxworks.adb -index b4f5a6b5bb5..675b6038f26 100644 +index 5c227a1e54c..0b2b5d44269 100644 --- a/gcc/ada/libgnarl/s-osinte__vxworks.adb +++ b/gcc/ada/libgnarl/s-osinte__vxworks.adb @@ -41,38 +41,6 @@ package body System.OS_Interface is @@ -2406,7 +2406,7 @@ -- To_VxWorks_Priority -- ------------------------- diff --git a/gcc/ada/libgnarl/s-osinte__vxworks.ads b/gcc/ada/libgnarl/s-osinte__vxworks.ads -index 00e9e2dca4f..533e0015467 100644 +index a4095735bd6..ecb63440a5d 100644 --- a/gcc/ada/libgnarl/s-osinte__vxworks.ads +++ b/gcc/ada/libgnarl/s-osinte__vxworks.ads @@ -40,10 +40,10 @@ @@ -2461,7 +2461,7 @@ ---------------------- diff --git a/gcc/ada/libgnarl/s-osinte__x32.adb b/gcc/ada/libgnarl/s-osinte__x32.adb -index ad21941c4d7..3bf9623293d 100644 +index 27313a4bcc0..5e70c1181da 100644 --- a/gcc/ada/libgnarl/s-osinte__x32.adb +++ b/gcc/ada/libgnarl/s-osinte__x32.adb @@ -59,15 +59,6 @@ package body System.OS_Interface is @@ -2510,7 +2510,7 @@ - end System.OS_Interface; diff --git a/gcc/ada/libgnarl/s-qnx.ads b/gcc/ada/libgnarl/s-qnx.ads -index 6fd02b8f7fe..61cfcca972b 100644 +index 1197be15ef6..c678858d66f 100644 --- a/gcc/ada/libgnarl/s-qnx.ads +++ b/gcc/ada/libgnarl/s-qnx.ads @@ -37,8 +37,6 @@ @@ -2547,7 +2547,7 @@ -- Errno -- ----------- diff --git a/gcc/ada/libgnarl/s-taprop__solaris.adb b/gcc/ada/libgnarl/s-taprop__solaris.adb -index c24925c9304..e6b74090b12 100644 +index 8edc58ea9d8..1b65100362c 100644 --- a/gcc/ada/libgnarl/s-taprop__solaris.adb +++ b/gcc/ada/libgnarl/s-taprop__solaris.adb @@ -36,6 +36,7 @@ @@ -2626,7 +2626,7 @@ pragma Assert (Check_Sleep (Delay_Sleep)); diff --git a/gcc/ada/libgnarl/s-taprop__vxworks.adb b/gcc/ada/libgnarl/s-taprop__vxworks.adb -index feafab4257b..f8150f16340 100644 +index a0f1885a7e8..a4dab5fa9d1 100644 --- a/gcc/ada/libgnarl/s-taprop__vxworks.adb +++ b/gcc/ada/libgnarl/s-taprop__vxworks.adb @@ -38,6 +38,7 @@ with Ada.Unchecked_Conversion; @@ -2653,7 +2653,7 @@ ------------------- diff --git a/gcc/ada/libgnarl/s-tpopmo.adb b/gcc/ada/libgnarl/s-tpopmo.adb -index a38f9f4eded..7fb0deaa2f6 100644 +index 9ff1ecdc329..547a5e44abc 100644 --- a/gcc/ada/libgnarl/s-tpopmo.adb +++ b/gcc/ada/libgnarl/s-tpopmo.adb @@ -31,6 +31,8 @@ @@ -2736,10 +2736,10 @@ Inner : loop exit Outer diff --git a/gcc/ada/libgnat/a-calcon.adb b/gcc/ada/libgnat/a-calcon.adb -index 8654d1ec569..3c5ec21763f 100644 +index c5fb2a403a5..955c8d3d096 100644 --- a/gcc/ada/libgnat/a-calcon.adb +++ b/gcc/ada/libgnat/a-calcon.adb -@@ -69,39 +69,6 @@ package body Ada.Calendar.Conversions is +@@ -79,72 +79,6 @@ package body Ada.Calendar.Conversions is (Year, Month, Day, Hour, Minute, Second, DST); end To_Ada_Time; @@ -2757,6 +2757,20 @@ - return Conversion_Operations.To_Duration (Secs, Nano_Secs); - end To_Duration; - +- -------------------- +- -- To_Duration_64 -- +- -------------------- +- +- function To_Duration_64 +- (tv_sec : long_long; +- tv_nsec : long) return Duration +- is +- Secs : constant Long_Long_Integer := Long_Long_Integer (tv_sec); +- Nano_Secs : constant Long_Integer := Long_Integer (tv_nsec); +- begin +- return Conversion_Operations.To_Duration_64 (Secs, Nano_Secs); +- end To_Duration_64; +- - ------------------------ - -- To_Struct_Timespec -- - ------------------------ @@ -2776,11 +2790,30 @@ - tv_nsec := long (Nano_Secs); - end To_Struct_Timespec; - +- --------------------------- +- -- To_Struct_Timespec_64 -- +- --------------------------- +- +- procedure To_Struct_Timespec_64 +- (D : Duration; +- tv_sec : out long_long; +- tv_nsec : out long) +- is +- Secs : Long_Long_Integer; +- Nano_Secs : Long_Integer; +- +- begin +- Conversion_Operations.To_Struct_Timespec_64 (D, Secs, Nano_Secs); +- +- tv_sec := long_long (Secs); +- tv_nsec := long (Nano_Secs); +- end To_Struct_Timespec_64; +- ------------------ -- To_Struct_Tm -- ------------------ diff --git a/gcc/ada/libgnat/a-calcon.ads b/gcc/ada/libgnat/a-calcon.ads -index 97df2a90175..196028e4738 100644 +index 904b143e104..5cfbefd2c7b 100644 --- a/gcc/ada/libgnat/a-calcon.ads +++ b/gcc/ada/libgnat/a-calcon.ads @@ -33,6 +33,7 @@ @@ -2791,42 +2824,77 @@ package Ada.Calendar.Conversions is -@@ -68,20 +69,18 @@ package Ada.Calendar.Conversions is +@@ -72,39 +73,48 @@ package Ada.Calendar.Conversions is + -- the input values are out of the defined ranges or if tm_sec equals 60 -- and the instance in time is not a leap second occurrence. ++ -- The following functions are provided for backward ++ -- compatibility, but lead to non portable interfaces with C. ++ -- They deliberately raise Constraint_Error when the represented ++ -- value overflows timespec, even if the Ada types would otherwise ++ -- allow a direct conversion. ++ function To_Duration - (tv_sec : Interfaces.C.long; - tv_nsec : Interfaces.C.long) return Duration; ++ (tv_sec : System.C_Time.Tv_Sec_Long; ++ tv_nsec : System.C_Time.Tv_Nsec_Long) ++ return System.C_Time.Non_Negative_Duration ++ renames System.C_Time.To_Duration; + pragma + Obsolescent + (To_Duration, "This function may be removed in a future version"); + -- Old version which will overflow at the 2038 Epochalypse ++ -- Deprecated for System.C_Time.timespec. + + function To_Duration_64 +- (tv_sec : Interfaces.C.long_long; +- tv_nsec : Interfaces.C.long) return Duration; - -- Convert an elapsed time value expressed in Unix-like fields of struct - -- timespec into a Duration value. The expected ranges are: - - -- tv_sec - seconds - -- tv_nsec - nanoseconds -+ (tv_sec : System.C_Time.Tv_Sec_Long; ++ (tv_sec : System.C_Time.Tv_Sec_Long_Long; + tv_nsec : System.C_Time.Tv_Nsec_Long) + return System.C_Time.Non_Negative_Duration + renames System.C_Time.To_Duration; -+ -- Deprecated. Please use C_Time directly. ++ -- Deprecated for System.C_Time.timespec. procedure To_Struct_Timespec - (D : Duration; - tv_sec : out Interfaces.C.long; - tv_nsec : out Interfaces.C.long); ++ (D : System.C_Time.Non_Negative_Duration; ++ tv_sec : out System.C_Time.Tv_Sec_Long; ++ tv_nsec : out System.C_Time.Tv_Nsec_Long) ++ renames System.C_Time.To_Struct_Timespec; + pragma + Obsolescent + (To_Struct_Timespec, + "This function may be removed in a future version"); + -- Old version which will overflow at the 2038 Epochalypse ++ -- Deprecated for System.C_Time.timespec. + + procedure To_Struct_Timespec_64 +- (D : Duration; +- tv_sec : out Interfaces.C.long_long; +- tv_nsec : out Interfaces.C.long); - -- Convert a Duration value into the constituents of struct timespec. - -- Formal tv_sec denotes seconds and tv_nsecs denotes nanoseconds. + (D : System.C_Time.Non_Negative_Duration; -+ tv_sec : out System.C_Time.Tv_Sec_Long; ++ tv_sec : out System.C_Time.Tv_Sec_Long_Long; + tv_nsec : out System.C_Time.Tv_Nsec_Long) + renames System.C_Time.To_Struct_Timespec; -+ -- Deprecated. Please use C_Time directly. ++ -- Deprecated for System.C_Time.timespec. procedure To_Struct_Tm (T : Time; diff --git a/gcc/ada/libgnat/a-calend.adb b/gcc/ada/libgnat/a-calend.adb -index c28042d13c4..3bb36f7f4d1 100644 +index 4f89a401a9c..5b92430ed3f 100644 --- a/gcc/ada/libgnat/a-calend.adb +++ b/gcc/ada/libgnat/a-calend.adb -@@ -1011,44 +1011,6 @@ is +@@ -1020,69 +1020,6 @@ is raise Time_Error; end To_Ada_Time; @@ -2838,10 +2906,22 @@ - (tv_sec : Long_Integer; - tv_nsec : Long_Integer) return Duration - is +- begin +- return To_Duration_64 (Long_Long_Integer (tv_sec), tv_nsec); +- end To_Duration; +- +- -------------------- +- -- To_Duration_64 -- +- -------------------- +- +- function To_Duration_64 +- (tv_sec : Long_Long_Integer; +- tv_nsec : Long_Integer) return Duration +- is - pragma Unsuppress (Overflow_Check); - begin - return Duration (tv_sec) + Duration (tv_nsec) / Nano_F; -- end To_Duration; +- end To_Duration_64; - - ------------------------ - -- To_Struct_Timespec -- @@ -2852,6 +2932,19 @@ - tv_sec : out Long_Integer; - tv_nsec : out Long_Integer) - is +- begin +- To_Struct_Timespec_64 (D, Long_Long_Integer (tv_sec), tv_nsec); +- end To_Struct_Timespec; +- +- --------------------------- +- -- To_Struct_Timespec_64 -- +- --------------------------- +- +- procedure To_Struct_Timespec_64 +- (D : Duration; +- tv_sec : out Long_Long_Integer; +- tv_nsec : out Long_Integer) +- is - pragma Unsuppress (Overflow_Check); - Secs : Duration; - Nano_Secs : Duration; @@ -2860,41 +2953,58 @@ - -- Seconds extraction, avoid potential rounding errors - - Secs := D - 0.5; -- tv_sec := Long_Integer (Secs); +- tv_sec := Long_Long_Integer (Secs); - - -- Nanoseconds extraction - - Nano_Secs := D - Duration (tv_sec); - tv_nsec := Long_Integer (Nano_Secs * Nano); -- end To_Struct_Timespec; +- end To_Struct_Timespec_64; - ------------------ -- To_Struct_Tm -- ------------------ diff --git a/gcc/ada/libgnat/a-calend.ads b/gcc/ada/libgnat/a-calend.ads -index 9625f4d4153..cfffc707979 100644 +index 97efbcc44ed..ed1583444d2 100644 --- a/gcc/ada/libgnat/a-calend.ads +++ b/gcc/ada/libgnat/a-calend.ads -@@ -303,17 +303,6 @@ private +@@ -308,34 +308,6 @@ private tm_isdst : Integer) return Time; -- Struct tm to Ada Epoch conversion - function To_Duration - (tv_sec : Long_Integer; - tv_nsec : Long_Integer) return Duration; +- pragma Obsolescent +- (To_Duration, "This function may be removed in a future version"); +- -- Old Struct timespec to Duration conversion +- +- function To_Duration_64 +- (tv_sec : Long_Long_Integer; +- tv_nsec : Long_Integer) return Duration; - -- Struct timespec to Duration conversion - - procedure To_Struct_Timespec - (D : Duration; - tv_sec : out Long_Integer; - tv_nsec : out Long_Integer); +- pragma +- Obsolescent +- (To_Struct_Timespec, +- "This function may be removed in a future version"); +- -- Old Duration to struct timespec conversion +- +- procedure To_Struct_Timespec_64 +- (D : Duration; +- tv_sec : out Long_Long_Integer; +- tv_nsec : out Long_Integer); - -- Duration to struct timespec conversion - procedure To_Struct_Tm (T : Time; tm_year : out Integer; diff --git a/gcc/ada/libgnat/g-calend.adb b/gcc/ada/libgnat/g-calend.adb -index 0a98eb235a6..e0d34f5c999 100644 +index e410c3e9408..1a6b8ddd097 100644 --- a/gcc/ada/libgnat/g-calend.adb +++ b/gcc/ada/libgnat/g-calend.adb @@ -29,11 +29,8 @@ @@ -2972,7 +3082,7 @@ -- Week_In_Year -- ------------------ diff --git a/gcc/ada/libgnat/g-calend.ads b/gcc/ada/libgnat/g-calend.ads -index b9dd15d61ef..4a21d497b56 100644 +index a3294993aa6..1ff97a22bf2 100644 --- a/gcc/ada/libgnat/g-calend.ads +++ b/gcc/ada/libgnat/g-calend.ads @@ -40,7 +40,7 @@ @@ -3019,7 +3129,7 @@ function Julian_Day (Year : Ada.Calendar.Year_Number; diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb -index e2f91b33930..02c2bab19b4 100644 +index 5042dacc166..b7604655a77 100644 --- a/gcc/ada/libgnat/g-socket.adb +++ b/gcc/ada/libgnat/g-socket.adb @@ -45,6 +45,7 @@ pragma Warnings (Off, GNAT.Sockets.Linker_Options); @@ -3173,7 +3283,7 @@ -- Value -- ----------- diff --git a/gcc/ada/libgnat/g-socthi.adb b/gcc/ada/libgnat/g-socthi.adb -index f8ddcc7fca6..0af1cbaffbc 100644 +index 5540dce04ae..c79b8db868b 100644 --- a/gcc/ada/libgnat/g-socthi.adb +++ b/gcc/ada/libgnat/g-socthi.adb @@ -40,6 +40,8 @@ with GNAT.Task_Lock; @@ -3195,7 +3305,7 @@ begin Reset_Socket_Set (WSet'Access); diff --git a/gcc/ada/libgnat/g-socthi__vxworks.adb b/gcc/ada/libgnat/g-socthi__vxworks.adb -index 53ddc43abe3..7621ea51e52 100644 +index a3f05b38402..6ae74eb5f6b 100644 --- a/gcc/ada/libgnat/g-socthi__vxworks.adb +++ b/gcc/ada/libgnat/g-socthi__vxworks.adb @@ -40,6 +40,8 @@ with GNAT.Task_Lock; @@ -3217,7 +3327,7 @@ Reset_Socket_Set (WSet'Access); loop diff --git a/gcc/ada/libgnat/g-sothco.ads b/gcc/ada/libgnat/g-sothco.ads -index da1e6f5bcdd..478121739ca 100644 +index cdf0a16ef08..404ee44ba4c 100644 --- a/gcc/ada/libgnat/g-sothco.ads +++ b/gcc/ada/libgnat/g-sothco.ads @@ -34,7 +34,7 @@ @@ -3264,7 +3374,7 @@ ------------------------------------------- -- Mapping tables to low level constants -- diff --git a/gcc/ada/libgnat/g-spogwa.adb b/gcc/ada/libgnat/g-spogwa.adb -index c16674e48bb..530a6cdd643 100644 +index a4bbf962a9f..3752b2bf442 100644 --- a/gcc/ada/libgnat/g-spogwa.adb +++ b/gcc/ada/libgnat/g-spogwa.adb @@ -29,7 +29,7 @@ @@ -3303,10 +3413,10 @@ Reset_Socket_Set (Rfds); diff --git a/gcc/ada/libgnat/s-c_time.adb b/gcc/ada/libgnat/s-c_time.adb new file mode 100644 -index 00000000000..4a96c8da475 +index 00000000000..658abff1e5f --- /dev/null +++ b/gcc/ada/libgnat/s-c_time.adb -@@ -0,0 +1,231 @@ +@@ -0,0 +1,248 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- @@ -3315,7 +3425,7 @@ +-- -- +-- B o d y -- +-- -- -+-- Copyright (C) 1998-2024, Free Software Foundation, Inc. -- ++-- Copyright (C) 1998-2025, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- @@ -3451,6 +3561,14 @@ + tv_nsec => nsec_t (tv_nsec))); + end To_Duration; + ++ function To_Duration (tv_sec : Tv_Sec_Long_Long; ++ tv_nsec : Tv_Nsec_Long) ++ return Non_Negative_Duration is ++ begin ++ return To_Duration (timespec'(tv_sec => time_t (tv_sec), ++ tv_nsec => nsec_t (tv_nsec))); ++ end To_Duration; ++ + ------------------------ + -- To_Struct_Timespec -- + ------------------------ @@ -3464,6 +3582,15 @@ + tv_nsec := Tv_Nsec_Long (T.tv_nsec); + end To_Struct_Timespec; + ++ procedure To_Struct_Timespec (D : Non_Negative_Duration; ++ tv_sec : out Tv_Sec_Long_Long; ++ tv_nsec : out Tv_Nsec_Long) is ++ T : constant timespec := To_Timespec (D); ++ begin ++ tv_sec := Tv_Sec_Long_Long (T.tv_sec); ++ tv_nsec := Tv_Nsec_Long (T.tv_nsec); ++ end To_Struct_Timespec; ++ + ----------------- + -- To_Timespec -- + ----------------- @@ -3540,10 +3667,10 @@ +end System.C_Time; diff --git a/gcc/ada/libgnat/s-c_time.ads b/gcc/ada/libgnat/s-c_time.ads new file mode 100644 -index 00000000000..8eaf22d2827 +index 00000000000..91cfd754f88 --- /dev/null +++ b/gcc/ada/libgnat/s-c_time.ads -@@ -0,0 +1,128 @@ +@@ -0,0 +1,135 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- @@ -3552,7 +3679,7 @@ +-- -- +-- S p e c -- +-- -- -+-- Copyright (C) 1998-2024, Free Software Foundation, Inc. -- ++-- Copyright (C) 1998-2025, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- @@ -3629,15 +3756,22 @@ + -- but lead to non portable interfaces with C. + -- Tv_sec and tv_nsec do not match the long int type on x32, + -- or on 32 bits ARM with a 2038-compatible GNU libc. -+ ++ subtype Tv_Sec_Long_Long is Interfaces.C.long_long ++ range 0 .. Interfaces.C.long_long'Last; + subtype Tv_Sec_Long is Interfaces.C.long range 0 .. Interfaces.C.long'Last; + subtype Tv_Nsec_Long is Interfaces.C.long range 0 .. 999_999_999; + function To_Duration (tv_sec : Tv_Sec_Long; + tv_nsec : Tv_Nsec_Long) return Non_Negative_Duration + with Inline; ++ function To_Duration (tv_sec : Tv_Sec_Long_Long; ++ tv_nsec : Tv_Nsec_Long) return Non_Negative_Duration ++ with Inline; + procedure To_Struct_Timespec (D : Non_Negative_Duration; + tv_sec : out Tv_Sec_Long; + tv_nsec : out Tv_Nsec_Long) with Inline; ++ procedure To_Struct_Timespec (D : Non_Negative_Duration; ++ tv_sec : out Tv_Sec_Long_Long; ++ tv_nsec : out Tv_Nsec_Long) with Inline; + -- a-calcon.ads + +private @@ -3673,7 +3807,7 @@ + +end System.C_Time; diff --git a/gcc/ada/libgnat/s-optide.adb b/gcc/ada/libgnat/s-optide.adb -index c73d44f7dc1..e15493c85c4 100644 +index 6abe6d3a0e6..69b8402997d 100644 --- a/gcc/ada/libgnat/s-optide.adb +++ b/gcc/ada/libgnat/s-optide.adb @@ -36,8 +36,8 @@ procedure Timed_Delay @@ -3697,7 +3831,7 @@ Check_Time := Clock; diff --git a/gcc/ada/libgnat/s-osprim__darwin.adb b/gcc/ada/libgnat/s-osprim__darwin.adb -index ce1ec3f0f37..5f7568838fd 100644 +index 28bfcb8c683..ff7f2f1aa18 100644 --- a/gcc/ada/libgnat/s-osprim__darwin.adb +++ b/gcc/ada/libgnat/s-osprim__darwin.adb @@ -31,7 +31,7 @@ @@ -3808,7 +3942,7 @@ Check_Time := Clock; diff --git a/gcc/ada/libgnat/s-osprim__posix.adb b/gcc/ada/libgnat/s-osprim__posix.adb -index ba61a0cb1da..bb9a28d3f88 100644 +index 94d06c325bb..9984676d9dc 100644 --- a/gcc/ada/libgnat/s-osprim__posix.adb +++ b/gcc/ada/libgnat/s-osprim__posix.adb @@ -30,7 +30,7 @@ @@ -3909,7 +4043,7 @@ -- Timed_Delay -- ----------------- diff --git a/gcc/ada/libgnat/s-osprim__posix2008.adb b/gcc/ada/libgnat/s-osprim__posix2008.adb -index d8198587c99..377fb3a1b9f 100644 +index 78b21c6444d..b2904712d70 100644 --- a/gcc/ada/libgnat/s-osprim__posix2008.adb +++ b/gcc/ada/libgnat/s-osprim__posix2008.adb @@ -31,9 +31,10 @@ @@ -3998,7 +4132,7 @@ -- Timed_Delay -- ----------------- diff --git a/gcc/ada/libgnat/s-osprim__rtems.adb b/gcc/ada/libgnat/s-osprim__rtems.adb -index 2d1302cd793..f7b607a6372 100644 +index c8fbc8270ca..99644b39424 100644 --- a/gcc/ada/libgnat/s-osprim__rtems.adb +++ b/gcc/ada/libgnat/s-osprim__rtems.adb @@ -31,7 +31,8 @@ @@ -4121,7 +4255,7 @@ Check_Time := Clock; diff --git a/gcc/ada/libgnat/s-osprim__solaris.adb b/gcc/ada/libgnat/s-osprim__solaris.adb -index e41d07420e3..70c8dc426e7 100644 +index a08feb5f666..b4532a9facc 100644 --- a/gcc/ada/libgnat/s-osprim__solaris.adb +++ b/gcc/ada/libgnat/s-osprim__solaris.adb @@ -32,6 +32,8 @@ @@ -4198,7 +4332,7 @@ C_select (timeout => timeval'Unchecked_Access); Check_Time := Clock; diff --git a/gcc/ada/libgnat/s-osprim__unix.adb b/gcc/ada/libgnat/s-osprim__unix.adb -index e7a66aaecb9..c1c7e516d93 100644 +index 5848df6f63f..82f33799e0a 100644 --- a/gcc/ada/libgnat/s-osprim__unix.adb +++ b/gcc/ada/libgnat/s-osprim__unix.adb @@ -32,6 +32,8 @@ @@ -4275,7 +4409,7 @@ C_select (timeout => timeval'Unchecked_Access); Check_Time := Clock; diff --git a/gcc/ada/libgnat/s-osprim__x32.adb b/gcc/ada/libgnat/s-osprim__x32.adb -index 23408662d46..644c41c51ba 100644 +index e127107aa57..c0ed6afe99e 100644 --- a/gcc/ada/libgnat/s-osprim__x32.adb +++ b/gcc/ada/libgnat/s-osprim__x32.adb @@ -31,7 +31,7 @@ @@ -4392,10 +4526,10 @@ Check_Time := Clock; diff --git a/gcc/ada/libgnat/s-parame.ads b/gcc/ada/libgnat/s-parame.ads -index e5ed7bfc04e..81bd8392935 100644 +index 98284a4d13e..8587453c947 100644 --- a/gcc/ada/libgnat/s-parame.ads +++ b/gcc/ada/libgnat/s-parame.ads -@@ -96,13 +96,6 @@ package System.Parameters is +@@ -97,13 +97,6 @@ package System.Parameters is -- Indicates if secondary stacks can grow and shrink at run-time. If False, -- the size of a secondary stack is fixed at the point of its creation. @@ -4410,7 +4544,7 @@ -- Characteristics of types in Interfaces.C -- ---------------------------------------------- diff --git a/gcc/ada/libgnat/s-parame__hpux.ads b/gcc/ada/libgnat/s-parame__hpux.ads -index cd98dc7c337..264e12ac7a4 100644 +index a8a7b691802..832f344a592 100644 --- a/gcc/ada/libgnat/s-parame__hpux.ads +++ b/gcc/ada/libgnat/s-parame__hpux.ads @@ -96,13 +96,6 @@ package System.Parameters is @@ -4428,7 +4562,7 @@ -- Characteristics of Types in Interfaces.C -- ---------------------------------------------- diff --git a/gcc/ada/libgnat/s-parame__posix2008.ads b/gcc/ada/libgnat/s-parame__posix2008.ads -index 2652e563e88..5d4cf282355 100644 +index 1cf09c6e39f..ce2888cd5d4 100644 --- a/gcc/ada/libgnat/s-parame__posix2008.ads +++ b/gcc/ada/libgnat/s-parame__posix2008.ads @@ -96,14 +96,6 @@ package System.Parameters is @@ -4447,7 +4581,7 @@ -- Characteristics of types in Interfaces.C -- ---------------------------------------------- diff --git a/gcc/ada/libgnat/s-parame__vxworks.ads b/gcc/ada/libgnat/s-parame__vxworks.ads -index 802357e1b2b..d0bcecdafc6 100644 +index dbaadb404b7..de9afdbb0b2 100644 --- a/gcc/ada/libgnat/s-parame__vxworks.ads +++ b/gcc/ada/libgnat/s-parame__vxworks.ads @@ -98,21 +98,6 @@ package System.Parameters is @@ -4473,7 +4607,7 @@ -- Characteristics of types in Interfaces.C -- ---------------------------------------------- diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c -index 96eb99dfdac..75e97922a23 100644 +index 97537ef5e94..fdf8ab84a2d 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -1764,6 +1764,17 @@ CND(SIZEOF_tv_usec, "tv_usec") --- v13/0003-Ada-select-64-bits-time-functions-from-GNU-libc-when.patch 2025-04-12 16:01:11.089526186 +0200 +++ v15/0002-Ada-select-64-bits-time-functions-from-GNU-libc-when.patch 2025-04-13 19:09:48.936492658 +0200 @@ -1,7 +1,7 @@ -From 82b1430d2852ea02eb3d2fd0a06abca4d7d5c9f1 Mon Sep 17 00:00:00 2001 +From c6e76495e62b592d48f3a3d4a0513b1eab3d0b0f Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> -Date: Fri, 26 Apr 2024 20:08:21 +0200 -Subject: [PATCH 3/9] Ada: select 64 bits time functions from GNU libc when +Date: Sat, 12 Apr 2025 00:54:53 +0200 +Subject: [PATCH 2/8] Ada: select 64 bits time functions from GNU libc when __USE_TIME64_REDIRECTS [PR114065] Without this, on system affected by the Y2038 Glibc transition, @@ -15,31 +15,31 @@ Signed-off-by: Nicolas Boulenguez <nico...@debian.org> ChangeLog: - * gcc/ada/libgnarl/a-exetim__posix.adb: select C time functions - at link time depending on Glibc_Use_Time_Bits64. + * gcc/ada/libgnarl/a-exetim__posix.adb: import time functions + with the symbol read from System.OS_Constants. * gcc/ada/libgnarl/s-osinte__gnu.ads: Likewise. * gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * gcc/ada/libgnarl/s-osinte__linux.ads: Likewise. * gcc/ada/libgnat/g-spogwa.adb: Likewise. * gcc/ada/libgnat/s-osprim__posix.adb: Likewise. * gcc/ada/libgnat/s-osprim__posix2008.adb: Likewise. - * gcc/ada/s-oscons-tmplt.c (defined): Set Ada Glibc_Use_Time_Bits64 - reflecting C __USE_TIME64_REDIRECTS or __USE_TIME_BITS64. + * gcc/ada/s-oscons-tmplt.c (defined): Generate symbols for + glibc/musl time functions. Co-Authored-By: Simon Chopin <simon.cho...@canonical.com> --- - gcc/ada/libgnarl/a-exetim__posix.adb | 5 ++++- - gcc/ada/libgnarl/s-osinte__gnu.ads | 14 ++++++++++---- - gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads | 14 ++++++++++---- - gcc/ada/libgnarl/s-osinte__linux.ads | 10 +++++++--- - gcc/ada/libgnat/g-spogwa.adb | 4 +++- - gcc/ada/libgnat/s-osprim__posix.adb | 7 +++++-- - gcc/ada/libgnat/s-osprim__posix2008.adb | 6 ++++-- - gcc/ada/s-oscons-tmplt.c | 16 ++++++++++++++++ - 8 files changed, 59 insertions(+), 17 deletions(-) + gcc/ada/libgnarl/a-exetim__posix.adb | 4 +- + gcc/ada/libgnarl/s-osinte__gnu.ads | 10 +++-- + gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads | 10 +++-- + gcc/ada/libgnarl/s-osinte__linux.ads | 7 ++-- + gcc/ada/libgnat/g-spogwa.adb | 3 +- + gcc/ada/libgnat/s-osprim__posix.adb | 5 ++- + gcc/ada/libgnat/s-osprim__posix2008.adb | 4 +- + gcc/ada/s-oscons-tmplt.c | 43 +++++++++++++++++++++ + 8 files changed, 69 insertions(+), 17 deletions(-) diff --git a/gcc/ada/libgnarl/a-exetim__posix.adb b/gcc/ada/libgnarl/a-exetim__posix.adb -index 424dee7c3cb..c62d16f206c 100644 +index 02c20262bc0..bb1aae1e41e 100644 --- a/gcc/ada/libgnarl/a-exetim__posix.adb +++ b/gcc/ada/libgnarl/a-exetim__posix.adb @@ -35,6 +35,7 @@ with Ada.Task_Identification; use Ada.Task_Identification; @@ -50,19 +50,18 @@ with System.Tasking; with System.OS_Interface; use System.OS_Interface; with System.Task_Primitives.Operations; use System.Task_Primitives.Operations; -@@ -115,7 +116,9 @@ package body Ada.Execution_Time is +@@ -115,7 +116,8 @@ package body Ada.Execution_Time is (clock_id : Interfaces.C.int; tp : access System.C_Time.timespec) return Interfaces.C.int; - pragma Import (C, clock_gettime, "clock_gettime"); + pragma Import (C, clock_gettime, -+ (if System.OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_gettime64" else "clock_gettime")); ++ System.OS_Constants.Y2038_clock_gettime); -- Function from the POSIX.1b Realtime Extensions library function pthread_getcpuclockid diff --git a/gcc/ada/libgnarl/s-osinte__gnu.ads b/gcc/ada/libgnarl/s-osinte__gnu.ads -index aebb369ba27..24cdcf97c48 100644 +index 18410c60415..a64c28cff1d 100644 --- a/gcc/ada/libgnarl/s-osinte__gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__gnu.ads @@ -43,6 +43,7 @@ with Ada.Unchecked_Conversion; @@ -73,46 +72,42 @@ with System.OS_Locks; package System.OS_Interface is -@@ -211,7 +212,8 @@ package System.OS_Interface is +@@ -211,7 +212,7 @@ package System.OS_Interface is -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) function nanosleep (rqtp, rmtp : access C_Time.timespec) return int; - pragma Import (C, nanosleep, "nanosleep"); -+ pragma Import (C, nanosleep, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__nanosleep64" else "nanosleep")); ++ pragma Import (C, nanosleep, OS_Constants.Y2038_nanosleep); type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; -@@ -221,12 +223,14 @@ package System.OS_Interface is +@@ -221,12 +222,12 @@ package System.OS_Interface is (clock_id : clockid_t; tp : access C_Time.timespec) return int; - pragma Import (C, clock_gettime, "clock_gettime"); -+ pragma Import (C, clock_gettime, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_gettime64" else "clock_gettime")); ++ pragma Import (C, clock_gettime, OS_Constants.Y2038_clock_gettime); function clock_getres (clock_id : clockid_t; res : access C_Time.timespec) return int; - pragma Import (C, clock_getres, "clock_getres"); -+ pragma Import (C, clock_getres, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_getres64" else "clock_getres")); ++ pragma Import (C, clock_getres, OS_Constants.Y2038_clock_getres); -- From: /usr/include/unistd.h function sysconf (name : int) return long; -@@ -480,7 +484,9 @@ package System.OS_Interface is +@@ -480,7 +481,8 @@ package System.OS_Interface is (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access C_Time.timespec) return int; - pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); + pragma Import (C, pthread_cond_timedwait, -+ (if OS_Constants.Glibc_Use_Time_Bits64 then "__pthread_cond_timedwait64" -+ else "pthread_cond_timedwait")); ++ OS_Constants.Y2038_pthread_cond_timedwait); Relative_Timed_Wait : constant Boolean := False; -- pthread_cond_timedwait requires an absolute delay time diff --git a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads -index 14f578e0241..fdb07bdea57 100644 +index fc6d7a992f1..8b80867b0d1 100644 --- a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads @@ -43,6 +43,7 @@ with Ada.Unchecked_Conversion; @@ -123,93 +118,85 @@ with System.OS_Locks; package System.OS_Interface is -@@ -206,7 +207,8 @@ package System.OS_Interface is +@@ -206,7 +207,7 @@ package System.OS_Interface is -- Indicates whether time slicing is supported (i.e SCHED_RR is supported) function nanosleep (rqtp, rmtp : access C_Time.timespec) return int; - pragma Import (C, nanosleep, "nanosleep"); -+ pragma Import (C, nanosleep, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__nanosleep64" else "nanosleep")); ++ pragma Import (C, nanosleep, OS_Constants.Y2038_nanosleep); type clockid_t is new int; CLOCK_REALTIME : constant clockid_t := 0; -@@ -215,12 +217,14 @@ package System.OS_Interface is +@@ -215,12 +216,12 @@ package System.OS_Interface is (clock_id : clockid_t; tp : access C_Time.timespec) return int; - pragma Import (C, clock_gettime, "clock_gettime"); -+ pragma Import (C, clock_gettime, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_gettime64" else "clock_gettime"); ++ pragma Import (C, clock_gettime, OS_Constants.Y2038_clock_gettime); function clock_getres (clock_id : clockid_t; res : access C_Time.timespec) return int; - pragma Import (C, clock_getres, "clock_getres"); -+ pragma Import (C, clock_getres, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_getres64" else "clock_getres"); ++ pragma Import (C, clock_getres, OS_Constants.Y2038_clock_getres); function sysconf (name : int) return long; pragma Import (C, sysconf); -@@ -423,7 +427,9 @@ package System.OS_Interface is +@@ -423,7 +424,8 @@ package System.OS_Interface is (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access C_Time.timespec) return int; - pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); + pragma Import (C, pthread_cond_timedwait, -+ (if OS_Constants.Glibc_Use_Time_Bits64 then "__pthread_cond_timedwait64" -+ else "pthread_cond_timedwait"); ++ OS_Constants.Y2038_pthread_cond_timedwait); -------------------------- -- POSIX.1c Section 13 -- diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads -index f7504f2f0b4..02140990628 100644 +index 2c6b353a5e0..086e8afc6ad 100644 --- a/gcc/ada/libgnarl/s-osinte__linux.ads +++ b/gcc/ada/libgnarl/s-osinte__linux.ads -@@ -232,12 +232,14 @@ package System.OS_Interface is +@@ -232,12 +232,12 @@ package System.OS_Interface is function clock_gettime (clock_id : clockid_t; tp : access C_Time.timespec) return int; - pragma Import (C, clock_gettime, "clock_gettime"); -+ pragma Import (C, clock_gettime, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_gettime64" else "clock_gettime")); ++ pragma Import (C, clock_gettime, OS_Constants.Y2038_clock_gettime); function clock_getres (clock_id : clockid_t; res : access C_Time.timespec) return int; - pragma Import (C, clock_getres, "clock_getres"); -+ pragma Import (C, clock_getres, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__clock_getres64" else "clock_getres")); ++ pragma Import (C, clock_getres, OS_Constants.Y2038_clock_getres); function sysconf (name : int) return long; pragma Import (C, sysconf); -@@ -448,7 +450,9 @@ package System.OS_Interface is +@@ -448,7 +448,8 @@ package System.OS_Interface is (cond : access pthread_cond_t; mutex : access pthread_mutex_t; abstime : access C_Time.timespec) return int; - pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); + pragma Import (C, pthread_cond_timedwait, -+ (if OS_Constants.Glibc_Use_Time_Bits64 then "__pthread_cond_timedwait64" -+ else "pthread_cond_timedwait")); ++ OS_Constants.Y2038_pthread_cond_timedwait); -------------------------- -- POSIX.1c Section 13 -- diff --git a/gcc/ada/libgnat/g-spogwa.adb b/gcc/ada/libgnat/g-spogwa.adb -index 530a6cdd643..598f3fc4d24 100644 +index 3752b2bf442..5c5e2c10ee9 100644 --- a/gcc/ada/libgnat/g-spogwa.adb +++ b/gcc/ada/libgnat/g-spogwa.adb -@@ -42,7 +42,9 @@ is +@@ -42,7 +42,8 @@ is writefds : access FD_Set_Type; exceptfds : access FD_Set_Type; timeout : access System.C_Time.timeval) return Integer - with Import => True, Convention => Stdcall, External_Name => "select"; + with Import => True, Convention => Stdcall, -+ External_Name => (if System.OS_Constants.Glibc_Use_Time_Bits64 -+ then "__select64" else "select"); ++ External_Name => System.OS_Constants.Y2038_select; Timeout_V : aliased System.C_Time.timeval; Timeout_A : access System.C_Time.timeval; diff --git a/gcc/ada/libgnat/s-osprim__posix.adb b/gcc/ada/libgnat/s-osprim__posix.adb -index bb9a28d3f88..9e861217125 100644 +index 9984676d9dc..f6604aec16b 100644 --- a/gcc/ada/libgnat/s-osprim__posix.adb +++ b/gcc/ada/libgnat/s-osprim__posix.adb @@ -31,6 +31,7 @@ @@ -220,73 +207,96 @@ package body System.OS_Primitives is -@@ -41,7 +42,8 @@ package body System.OS_Primitives is +@@ -41,7 +42,7 @@ package body System.OS_Primitives is function nanosleep (rqtp, rmtp : not null access C_Time.timespec) return Integer; - pragma Import (C, nanosleep, "nanosleep"); -+ pragma Import (C, nanosleep, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__nanosleep64" else "nanosleep")); ++ pragma Import (C, nanosleep, OS_Constants.Y2038_nanosleep); ----------- -- Clock -- -@@ -56,7 +58,8 @@ package body System.OS_Primitives is +@@ -56,7 +57,7 @@ package body System.OS_Primitives is function gettimeofday (Tv : access C_Time.timeval; Tz : System.Address := System.Null_Address) return Integer; - pragma Import (C, gettimeofday, "gettimeofday"); -+ pragma Import (C, gettimeofday, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__gettimeofday64" else "gettimeofday")); ++ pragma Import (C, gettimeofday, OS_Constants.Y2038_gettimeofday); begin -- The return codes for gettimeofday are as follows (from man pages): diff --git a/gcc/ada/libgnat/s-osprim__posix2008.adb b/gcc/ada/libgnat/s-osprim__posix2008.adb -index 377fb3a1b9f..76823c11f1c 100644 +index b2904712d70..a7022e4d5c8 100644 --- a/gcc/ada/libgnat/s-osprim__posix2008.adb +++ b/gcc/ada/libgnat/s-osprim__posix2008.adb -@@ -45,7 +45,8 @@ package body System.OS_Primitives is +@@ -45,7 +45,7 @@ package body System.OS_Primitives is function nanosleep (rqtp, rmtp : not null access C_Time.timespec) return Integer; - pragma Import (C, nanosleep, "nanosleep"); -+ pragma Import (C, nanosleep, (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__nanosleep64" else "nanosleep")); ++ pragma Import (C, nanosleep, OS_Constants.Y2038_nanosleep); ----------- -- Clock -- -@@ -62,7 +63,8 @@ package body System.OS_Primitives is +@@ -62,7 +62,7 @@ package body System.OS_Primitives is function clock_gettime (clock_id : clockid_t; tp : access C_Time.timespec) return int; - pragma Import (C, clock_gettime, "clock_gettime"); -+ pragma Import (C, clock_gettime, (if OS_Constants.Glibc_Use_Time_Bits64 -+ thon "__clock_gettime64" else "clock_gettime")); ++ pragma Import (C, clock_gettime, OS_Constants.Y2038_clock_gettime); begin Result := clock_gettime (CLOCK_REALTIME, TS'Unchecked_Access); diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c -index 75e97922a23..abdb5b6890f 100644 +index fdf8ab84a2d..ead838ea3ff 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c -@@ -1775,6 +1775,22 @@ CNS(MAX_tv_sec, "") +@@ -1775,6 +1775,49 @@ CNS(MAX_tv_sec, "") CND(SIZEOF_tv_nsec, "tv_nsec"); } +/* + -+ -- Functions with time_t suseconds_t timeval timespec parameters like -+ -- clock_get{res,time} gettimeofday nanosleep -+ -- pthread_cond_{,timed}wait select -+ -- must be imported from the GNU C library with -+ -- External_Name => (if Glibc_Use_Time_Bits64 then "__foo64" else "foo") -+ -- The test is safe in files that do not require GNU specifically. -+ ++ -- On 32 bits architectures, glibc and musl also support representing time ++ -- types on 64 bits. The usual names are reserved symbols for the 32 bits ++ -- function for backwards compatibility, so distinct symbols are necessary ++ -- for the current version. In other contexts, define Y2038_foo as "foo" ++ -- so that other files may safely Import with External_Name => Y2038_foo. +*/ +#if defined(__USE_TIME64_REDIRECTS) || (__TIMESIZE == 32 && __USE_TIME_BITS64) -+ C("Glibc_Use_Time_Bits64", Boolean, "True", "Y2038 Glibc transition") ++/* glibc */ ++# define Y2038_clock_getres "__clock_getres64" ++# define Y2038_clock_gettime "__clock_gettime64" ++# define Y2038_gettimeofday "__gettimeofday64" ++# define Y2038_nanosleep "__nanosleep64" ++# define Y2038_pthread_cond_timedwait "__pthread_cond_timedwait64" ++# define Y2038_pthread_cond_wait "__pthread_cond_wait64" ++# define Y2038_select "__select64" ++#elif defined(_REDIR_TIME64) ++/* musl */ ++# define Y2038_clock_getres "__clock_getres_time64" ++# define Y2038_clock_gettime "__clock_gettime64" ++# define Y2038_gettimeofday "__gettimeofday_time64" ++# define Y2038_nanosleep "__nanosleep_time64" ++# define Y2038_pthread_cond_timedwait "__pthread_cond_timedwait_time64" ++# define Y2038_pthread_cond_wait "__pthread_cond_wait_time64" ++# define Y2038_select "__select_time64" +#else -+ C("Glibc_Use_Time_Bits64", Boolean, "False", "Y2038 Glibc transition") ++# define Y2038_clock_getres "clock_getres" ++# define Y2038_clock_gettime "clock_gettime" ++# define Y2038_gettimeofday "gettimeofday" ++# define Y2038_nanosleep "nanosleep" ++# define Y2038_pthread_cond_timedwait "pthread_cond_timedwait" ++# define Y2038_pthread_cond_wait "pthread_cond_wait" ++# define Y2038_select "select" +#endif ++CST(Y2038_clock_getres, "") ++CST(Y2038_clock_gettime, "") ++CST(Y2038_gettimeofday, "") ++CST(Y2038_nanosleep, "") ++CST(Y2038_pthread_cond_timedwait, "") ++CST(Y2038_pthread_cond_wait, "") ++CST(Y2038_select, "") + /* --- v13/0004-Ada-fix-type-name-in-documentation-of-Ada.Calendar.t.patch 2025-04-12 16:01:11.093526226 +0200 +++ v15/0003-Ada-fix-type-name-in-documentation-of-Ada.Calendar.t.patch 2025-04-13 19:09:48.940492682 +0200 @@ -1,7 +1,7 @@ -From 104e1501206eb3f6eee970dfd21b7337ae10bf90 Mon Sep 17 00:00:00 2001 +From c6f7a754167fb08f115482f6b6473cd8f1f6d131 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Thu, 16 May 2024 16:34:02 +0200 -Subject: [PATCH 4/9] Ada: fix type name in documentation of +Subject: [PATCH 3/8] Ada: fix type name in documentation of Ada.Calendar.timeval Signed-off-by: Nicolas Boulenguez <nico...@debian.org> --- v13/0005-Ada-deprecate-System.OS_Lib.time_t.patch 2025-04-12 16:01:11.093526226 +0200 +++ v15/0004-Ada-deprecate-System.OS_Lib.time_t.patch 2025-04-13 19:09:48.940492682 +0200 @@ -1,7 +1,7 @@ -From 63dfc121b77c0e0167774601dcfa5f6afbef3044 Mon Sep 17 00:00:00 2001 +From 792aeb05672eab129f042a370fa3aec8758833ad Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Sat, 13 Apr 2024 19:31:25 +0200 -Subject: [PATCH 5/9] Ada: deprecate System.OS_Lib.time_t +Subject: [PATCH 4/8] Ada: deprecate System.OS_Lib.time_t Signed-off-by: Nicolas Boulenguez <nico...@debian.org> ChangeLog: @@ -12,7 +12,7 @@ 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gcc/ada/libgnat/s-os_lib.ads b/gcc/ada/libgnat/s-os_lib.ads -index 54e7205c3e6..d60af706c2e 100644 +index 38cfc88c4ea..1380caee6e1 100644 --- a/gcc/ada/libgnat/s-os_lib.ads +++ b/gcc/ada/libgnat/s-os_lib.ads @@ -169,18 +169,11 @@ package System.OS_Lib is --- v13/0006-Ada-drop-unneeded-x32-variant-of-System.Linux.patch 2025-04-12 16:01:11.097526264 +0200 +++ v15/0005-Ada-drop-unneeded-x32-variant-of-System.Linux.patch 2025-04-13 19:09:48.944492704 +0200 @@ -1,7 +1,7 @@ -From 934289035df132f2c1b581f15e3d793a4d63af20 Mon Sep 17 00:00:00 2001 +From 317072a1b3dffd4d23bc4c508511e7b7ab20cc56 Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Mon, 1 Apr 2024 12:20:43 +0200 -Subject: [PATCH 6/9] Ada: drop unneeded x32 variant of System.Linux +Subject: [PATCH 5/8] Ada: drop unneeded x32 variant of System.Linux This is possible after first patch for PR ada/114065. @@ -17,10 +17,10 @@ delete mode 100644 gcc/ada/libgnarl/s-linux__x32.ads diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index acf97ec7c37..05fe625f6e1 100644 +index 27343779374..4ef1019504d 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl -@@ -2859,7 +2859,6 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) +@@ -2942,7 +2942,6 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) a-synbar.ads<libgnarl/a-synbar__posix.ads \ s-inmaop.adb<libgnarl/s-inmaop__posix.adb \ s-intman.adb<libgnarl/s-intman__posix.adb \ @@ -30,7 +30,7 @@ s-osinte.adb<libgnarl/s-osinte__x32.adb \ diff --git a/gcc/ada/libgnarl/s-linux__x32.ads b/gcc/ada/libgnarl/s-linux__x32.ads deleted file mode 100644 -index e586ae0b8f0..00000000000 +index d1571673a8f..00000000000 --- a/gcc/ada/libgnarl/s-linux__x32.ads +++ /dev/null @@ -1,114 +0,0 @@ @@ -42,7 +42,7 @@ --- -- --- S p e c -- --- -- ---- Copyright (C) 2013-2024, Free Software Foundation, Inc. -- +--- Copyright (C) 2013-2025, Free Software Foundation, Inc. -- --- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- v13/0007-Ada-drop-unneeded-posix2008-variant-of-System.Parame.patch 2025-04-12 16:01:11.101526303 +0200 +++ v15/0006-Ada-drop-unneeded-posix2008-variant-of-System.Parame.patch 2025-04-13 19:09:48.944492704 +0200 @@ -1,7 +1,7 @@ -From 6f0f53a0e2a4b93ada65bd6629be34d55659309a Mon Sep 17 00:00:00 2001 +From 6a447815b0e7d4a698a5bdd6203c3fa2502d137a Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Sat, 30 Mar 2024 17:32:51 +0100 -Subject: [PATCH 7/9] Ada: drop unneeded posix2008 variant of System.Parameters +Subject: [PATCH 6/8] Ada: drop unneeded posix2008 variant of System.Parameters This is possible after first patch for PR ada/114065. @@ -17,10 +17,10 @@ delete mode 100644 gcc/ada/libgnat/s-parame__posix2008.ads diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index 05fe625f6e1..613d775b41c 100644 +index 4ef1019504d..7c009203860 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl -@@ -2089,7 +2089,6 @@ ifeq ($(strip $(filter-out lynxos178%,$(target_os))),) +@@ -2147,7 +2147,6 @@ ifeq ($(strip $(filter-out lynxos178%,$(target_os))),) ifeq ($(strip $(filter-out lynxos178e,$(target_os))),) LIBGNAT_TARGET_PAIRS += \ @@ -28,7 +28,7 @@ s-osinte.ads<libgnarl/s-osinte__lynxos178e.ads \ s-osprim.adb<libgnat/s-osprim__posix2008.adb \ s-tracon.adb<hie/s-tracon__ppc-eabi.adb -@@ -2116,7 +2115,6 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),) +@@ -2174,7 +2173,6 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),) s-oslock.ads<libgnat/s-oslock__posix.ads \ s-osprim.adb<libgnat/s-osprim__rtems.adb \ s-parame.adb<libgnat/s-parame__rtems.adb \ @@ -36,7 +36,7 @@ s-taprop.adb<libgnarl/s-taprop__rtems.adb \ s-taspri.ads<libgnarl/s-taspri__posix.ads \ s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \ -@@ -2864,7 +2862,6 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) +@@ -2947,7 +2945,6 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) s-osinte.adb<libgnarl/s-osinte__x32.adb \ s-oslock.ads<libgnat/s-oslock__posix.ads \ s-osprim.adb<libgnat/s-osprim__x32.adb \ @@ -46,7 +46,7 @@ s-tasinf.adb<libgnarl/s-tasinf__linux.adb \ diff --git a/gcc/ada/libgnat/s-parame__posix2008.ads b/gcc/ada/libgnat/s-parame__posix2008.ads deleted file mode 100644 -index 5d4cf282355..00000000000 +index ce2888cd5d4..00000000000 --- a/gcc/ada/libgnat/s-parame__posix2008.ads +++ /dev/null @@ -1,181 +0,0 @@ @@ -58,7 +58,7 @@ --- -- --- S p e c -- --- -- ---- Copyright (C) 1992-2024, Free Software Foundation, Inc. -- +--- Copyright (C) 1992-2025, Free Software Foundation, Inc. -- --- -- --- GNAT is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- v13/0008-Ada-drop-unneeded-darwin-solaris-x32-variants-of-Sys.patch 2025-04-12 16:01:11.105526342 +0200 +++ v15/0007-Ada-drop-unneeded-darwin-solaris-x32-variants-of-Sys.patch 2025-04-13 19:09:48.948492728 +0200 @@ -1,7 +1,7 @@ -From 83874c32d6492475dcdc13c9678c09ebab186520 Mon Sep 17 00:00:00 2001 +From 06c064d3939d128ca249158bde156f039d1cf9ca Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Sun, 21 Apr 2024 19:52:28 +0200 -Subject: [PATCH 8/9] Ada: drop unneeded darwin, solaris, x32 variants of +Subject: [PATCH 7/8] Ada: drop unneeded darwin, solaris, x32 variants of System.OS_Primitives This is possible after first patch for PR ada/114065. @@ -28,10 +28,10 @@ delete mode 100644 gcc/ada/libgnat/s-osprim__x32.adb diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index 613d775b41c..2f1aabbb66a 100644 +index 7c009203860..697484004f0 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl -@@ -1524,7 +1524,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $( +@@ -1534,7 +1534,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $( s-osinte.adb<libgnarl/s-osinte__solaris.adb \ s-osinte.ads<libgnarl/s-osinte__solaris.ads \ s-oslock.ads<libgnat/s-oslock__solaris.ads \ @@ -40,7 +40,7 @@ s-taprop.adb<libgnarl/s-taprop__solaris.adb \ s-tasinf.adb<libgnarl/s-tasinf__solaris.adb \ s-tasinf.ads<libgnarl/s-tasinf__solaris.ads \ -@@ -1573,7 +1573,7 @@ ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),) +@@ -1583,7 +1583,7 @@ ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),) s-osinte.adb<libgnarl/s-osinte__solaris.adb \ s-osinte.ads<libgnarl/s-osinte__solaris.ads \ s-oslock.ads<libgnat/s-oslock__solaris.ads \ @@ -49,7 +49,7 @@ s-taprop.adb<libgnarl/s-taprop__solaris.adb \ s-tasinf.adb<libgnarl/s-tasinf__solaris.adb \ s-tasinf.ads<libgnarl/s-tasinf__solaris.ads \ -@@ -2861,7 +2861,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) +@@ -2944,7 +2944,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) s-osinte.ads<libgnarl/s-osinte__linux.ads \ s-osinte.adb<libgnarl/s-osinte__x32.adb \ s-oslock.ads<libgnat/s-oslock__posix.ads \ @@ -58,7 +58,7 @@ s-taprop.adb<libgnarl/s-taprop__linux.adb \ s-tasinf.ads<libgnarl/s-tasinf__linux.ads \ s-tasinf.adb<libgnarl/s-tasinf__linux.adb \ -@@ -2957,7 +2957,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) +@@ -3044,7 +3044,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) ifeq ($(strip $(filter-out %86,$(target_cpu))),) LIBGNAT_TARGET_PAIRS += \ s-intman.adb<libgnarl/s-intman__susv3.adb \ @@ -67,7 +67,7 @@ $(ATOMICS_TARGET_PAIRS) \ system.ads<libgnat/system-darwin-x86.ads -@@ -2976,7 +2976,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) +@@ -3063,7 +3063,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) ifeq ($(strip $(filter-out %x86_64,$(target_cpu))),) LIBGNAT_TARGET_PAIRS += \ s-intman.adb<libgnarl/s-intman__susv3.adb \ @@ -76,7 +76,7 @@ a-exetim.ads<libgnarl/a-exetim__default.ads \ a-exetim.adb<libgnarl/a-exetim__darwin.adb \ $(ATOMICS_TARGET_PAIRS) \ -@@ -3023,7 +3023,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) +@@ -3110,7 +3110,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) ifeq ($(strip $(filter-out arm,$(target_cpu))),) LIBGNAT_TARGET_PAIRS += \ s-intman.adb<libgnarl/s-intman__susv3.adb \ @@ -85,7 +85,7 @@ $(ATOMICS_TARGET_PAIRS) \ $(ATOMICS_BUILTINS_TARGET_PAIRS) -@@ -3036,7 +3036,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) +@@ -3123,7 +3123,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \ s-intman.adb<libgnarl/s-intman__susv3.adb \ s-dorepr.adb<libgnat/s-dorepr__fma.adb \ @@ -96,7 +96,7 @@ $(GNATRTL_128BIT_PAIRS) diff --git a/gcc/ada/libgnat/s-osprim__darwin.adb b/gcc/ada/libgnat/s-osprim__darwin.adb deleted file mode 100644 -index 5f7568838fd..00000000000 +index ff7f2f1aa18..00000000000 --- a/gcc/ada/libgnat/s-osprim__darwin.adb +++ /dev/null @@ -1,130 +0,0 @@ @@ -108,7 +108,7 @@ --- -- --- B o d y -- --- -- ---- Copyright (C) 1998-2024, Free Software Foundation, Inc. -- +--- Copyright (C) 1998-2025, Free Software Foundation, Inc. -- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- @@ -231,7 +231,7 @@ - -end System.OS_Primitives; diff --git a/gcc/ada/libgnat/s-osprim__rtems.adb b/gcc/ada/libgnat/s-osprim__rtems.adb -index f7b607a6372..61163453ab6 100644 +index 99644b39424..6fbedc205e6 100644 --- a/gcc/ada/libgnat/s-osprim__rtems.adb +++ b/gcc/ada/libgnat/s-osprim__rtems.adb @@ -29,7 +29,7 @@ @@ -245,7 +245,7 @@ diff --git a/gcc/ada/libgnat/s-osprim__solaris.adb b/gcc/ada/libgnat/s-osprim__solaris.adb deleted file mode 100644 -index 70c8dc426e7..00000000000 +index b4532a9facc..00000000000 --- a/gcc/ada/libgnat/s-osprim__solaris.adb +++ /dev/null @@ -1,115 +0,0 @@ @@ -257,7 +257,7 @@ --- -- --- B o d y -- --- -- ---- Copyright (C) 1998-2024, Free Software Foundation, Inc. -- +--- Copyright (C) 1998-2025, Free Software Foundation, Inc. -- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- @@ -365,7 +365,7 @@ - -end System.OS_Primitives; diff --git a/gcc/ada/libgnat/s-osprim__unix.adb b/gcc/ada/libgnat/s-osprim__unix.adb -index c1c7e516d93..62e5e593b34 100644 +index 82f33799e0a..9f0f72c89cf 100644 --- a/gcc/ada/libgnat/s-osprim__unix.adb +++ b/gcc/ada/libgnat/s-osprim__unix.adb @@ -30,7 +30,8 @@ @@ -380,7 +380,7 @@ diff --git a/gcc/ada/libgnat/s-osprim__x32.adb b/gcc/ada/libgnat/s-osprim__x32.adb deleted file mode 100644 -index 644c41c51ba..00000000000 +index c0ed6afe99e..00000000000 --- a/gcc/ada/libgnat/s-osprim__x32.adb +++ /dev/null @@ -1,123 +0,0 @@ @@ -392,7 +392,7 @@ --- -- --- B o d y -- --- -- ---- Copyright (C) 2013-2024, Free Software Foundation, Inc. -- +--- Copyright (C) 2013-2025, Free Software Foundation, Inc. -- --- -- --- GNARL is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- v13/0009-Ada-import-nanosleep-from-System.OS_Primitives.Timed.patch 2025-04-12 16:01:11.105526342 +0200 +++ v15/0008-Ada-import-nanosleep-from-System.OS_Primitives.Timed.patch 2025-04-13 19:09:48.948492728 +0200 @@ -1,7 +1,7 @@ -From f1a3a16c7c2c04b71228bddd3f3da7ffc9d1d1a5 Mon Sep 17 00:00:00 2001 +From e24395435840b1a9612aeb47e23cdbe920cab59a Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Wed, 3 Apr 2024 17:43:50 +0200 -Subject: [PATCH 9/9] Ada: import nanosleep from +Subject: [PATCH 8/8] Ada: import nanosleep from System.OS_Primitives.Timed_Delay It improves readability to import this C function in the file where it @@ -14,16 +14,16 @@ * gcc/ada/libgnat/s-osprim__posix.adb: move nanosleep import to s-optide.adb. * gcc/ada/libgnat/s-osprim__posix2008.adb: Likewise. --- - gcc/ada/libgnat/s-optide.adb | 8 ++++++++ - gcc/ada/libgnat/s-osprim__posix.adb | 10 ---------- - gcc/ada/libgnat/s-osprim__posix2008.adb | 9 --------- - 3 files changed, 8 insertions(+), 19 deletions(-) + gcc/ada/libgnat/s-optide.adb | 7 +++++++ + gcc/ada/libgnat/s-osprim__posix.adb | 9 --------- + gcc/ada/libgnat/s-osprim__posix2008.adb | 8 -------- + 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/gcc/ada/libgnat/s-optide.adb b/gcc/ada/libgnat/s-optide.adb -index e15493c85c4..a9025d01f7d 100644 +index 69b8402997d..a4b916b6381 100644 --- a/gcc/ada/libgnat/s-optide.adb +++ b/gcc/ada/libgnat/s-optide.adb -@@ -36,6 +36,14 @@ procedure Timed_Delay +@@ -36,6 +36,13 @@ procedure Timed_Delay (Time : Duration; Mode : Integer) is @@ -32,17 +32,16 @@ + return Integer + with Import, + Convention => C, -+ External_Name => (if OS_Constants.Glibc_Use_Time_Bits64 -+ then "__nanosleep64" else "nanosleep"); ++ External_Name => OS_Constants.Y2038_nanosleep; + Request : aliased C_Time.timespec; Remaind : aliased C_Time.timespec; Rel_Time : Duration; diff --git a/gcc/ada/libgnat/s-osprim__posix.adb b/gcc/ada/libgnat/s-osprim__posix.adb -index 9e861217125..f6479688aa8 100644 +index f6604aec16b..c72e9479ec2 100644 --- a/gcc/ada/libgnat/s-osprim__posix.adb +++ b/gcc/ada/libgnat/s-osprim__posix.adb -@@ -35,16 +35,6 @@ with System.OS_Constants; +@@ -35,15 +35,6 @@ with System.OS_Constants; package body System.OS_Primitives is @@ -53,17 +52,16 @@ - - function nanosleep (rqtp, rmtp : not null access C_Time.timespec) - return Integer; -- pragma Import (C, nanosleep, (if OS_Constants.Glibc_Use_Time_Bits64 -- then "__nanosleep64" else "nanosleep")); +- pragma Import (C, nanosleep, OS_Constants.Y2038_nanosleep); - ----------- -- Clock -- ----------- diff --git a/gcc/ada/libgnat/s-osprim__posix2008.adb b/gcc/ada/libgnat/s-osprim__posix2008.adb -index 76823c11f1c..0dbde83e62b 100644 +index a7022e4d5c8..f6f606aa55a 100644 --- a/gcc/ada/libgnat/s-osprim__posix2008.adb +++ b/gcc/ada/libgnat/s-osprim__posix2008.adb -@@ -39,15 +39,6 @@ package body System.OS_Primitives is +@@ -39,14 +39,6 @@ package body System.OS_Primitives is subtype int is System.CRTL.int; @@ -73,8 +71,7 @@ - - function nanosleep (rqtp, rmtp : not null access C_Time.timespec) - return Integer; -- pragma Import (C, nanosleep, (if OS_Constants.Glibc_Use_Time_Bits64 -- then "__nanosleep64" else "nanosleep")); +- pragma Import (C, nanosleep, OS_Constants.Y2038_nanosleep); - ----------- -- Clock --