On Sun, 23 Nov 2025 13:47:43 +0100 Matthias Klose <[email protected]> wrote:
The first gcc-16 packaging has some gnat patches disabled, because they
don't apply. These need updates / reconfirmation.
these are:
+#debian_patches += \
+# 0001-Ada-merge-all-timeval-and-timespec-definitions-and-c \
+# 0002-Ada-select-64-bits-time-functions-from-GNU-libc-when \
Considering the comments in the upstream PR;
Comment 59; Add System.C_Time and GNAT.C_Time units to libgnat
Comment 60; Fix GNAT build failure for x32 multilib
and that there are no current build failures,
it seems that patch 0001 has already been mostly applied upstream,
especially as most hunks fail to apply with "can be reverse-applied".
Patch 0002 mainly applies with fuzz and offset,
but one hunk does not apply at all.
It looks to me that upstream, when applying patch 0001,
have not applied it exactly as is, so breaking patch 0002,
that depends on our patch 0001.
I suggest dropping patch 0001,
and attach an (untested) rebased patch 0002
PR ada/114065, patches v15
Index: b/src/gcc/ada/libgnarl/a-exetim__posix.adb
===================================================================
--- a/src/gcc/ada/libgnarl/a-exetim__posix.adb
+++ b/src/gcc/ada/libgnarl/a-exetim__posix.adb
@@ -35,6 +35,7 @@
with Ada.Unchecked_Conversion;
with System.C_Time;
+with System.OS_Constants;
with System.OS_Interface; use System.OS_Interface;
with System.Tasking;
with System.Task_Primitives.Operations; use System.Task_Primitives.Operations;
@@ -115,7 +116,8 @@
(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,
+ System.OS_Constants.Y2038_clock_gettime);
-- Function from the POSIX.1b Realtime Extensions library
function pthread_getcpuclockid
Index: b/src/gcc/ada/libgnarl/s-osinte__gnu.ads
===================================================================
--- a/src/gcc/ada/libgnarl/s-osinte__gnu.ads
+++ b/src/gcc/ada/libgnarl/s-osinte__gnu.ads
@@ -43,6 +43,7 @@
with Interfaces.C;
with System.C_Time;
+with System.OS_Constants;
with System.OS_Locks;
package System.OS_Interface is
@@ -211,7 +212,7 @@
-- 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, OS_Constants.Y2038_nanosleep);
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
@@ -221,12 +222,12 @@
(clock_id : clockid_t;
tp : access C_Time.timespec)
return int;
- pragma Import (C, clock_gettime, "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, OS_Constants.Y2038_clock_getres);
-- From: /usr/include/unistd.h
function sysconf (name : int) return long;
@@ -480,7 +481,8 @@
(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,
+ OS_Constants.Y2038_pthread_cond_timedwait);
Relative_Timed_Wait : constant Boolean := False;
-- pthread_cond_timedwait requires an absolute delay time
Index: b/src/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads
===================================================================
--- a/src/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads
+++ b/src/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads
@@ -43,6 +43,7 @@
with Interfaces.C;
with System.C_Time;
+with System.OS_Constants;
with System.OS_Locks;
package System.OS_Interface is
@@ -206,7 +207,7 @@
-- 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, OS_Constants.Y2038_nanosleep);
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
@@ -215,12 +216,12 @@
(clock_id : clockid_t;
tp : access C_Time.timespec)
return int;
- pragma Import (C, clock_gettime, "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, OS_Constants.Y2038_clock_getres);
function sysconf (name : int) return long;
pragma Import (C, sysconf);
@@ -423,7 +424,8 @@
(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,
+ OS_Constants.Y2038_pthread_cond_timedwait);
--------------------------
-- POSIX.1c Section 13 --
Index: b/src/gcc/ada/libgnarl/s-osinte__linux.ads
===================================================================
--- a/src/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/src/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -232,12 +232,12 @@
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, 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, OS_Constants.Y2038_clock_getres);
function sysconf (name : int) return long;
pragma Import (C, sysconf);
@@ -448,7 +448,8 @@
(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,
+ OS_Constants.Y2038_pthread_cond_timedwait);
--------------------------
-- POSIX.1c Section 13 --
Index: b/src/gcc/ada/libgnat/g-spogwa.adb
===================================================================
--- a/src/gcc/ada/libgnat/g-spogwa.adb
+++ b/src/gcc/ada/libgnat/g-spogwa.adb
@@ -42,7 +42,8 @@
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 => System.OS_Constants.Y2038_select;
Timeout_V : aliased System.C_Time.timeval;
Timeout_A : access System.C_Time.timeval;
Index: b/src/gcc/ada/libgnat/s-osprim__posix.adb
===================================================================
--- a/src/gcc/ada/libgnat/s-osprim__posix.adb
+++ b/src/gcc/ada/libgnat/s-osprim__posix.adb
@@ -32,6 +32,7 @@
-- This version is for POSIX-like operating systems
with System.C_Time;
+with System.OS_Constants;
package body System.OS_Primitives is
@@ -48,7 +49,7 @@
function gettimeofday
(Tv : access C_Time.timeval;
Tz : System.Address := System.Null_Address) return Integer;
- pragma Import (C, gettimeofday, "gettimeofday");
+ pragma Import (C, gettimeofday, OS_Constants.Y2038_gettimeofday);
begin
-- The return codes for gettimeofday are as follows (from man pages):
Index: b/src/gcc/ada/s-oscons-tmplt.c
===================================================================
--- a/src/gcc/ada/s-oscons-tmplt.c
+++ b/src/gcc/ada/s-oscons-tmplt.c
@@ -1777,6 +1777,49 @@
/*
+ -- 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)
+/* 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
+# 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, "")
+
+/*
+
-- Sizes of various data types
*/