https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119698

John David Anglin <danglin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #20 from John David Anglin <danglin at gcc dot gnu.org> ---
sh debian/ada/check_ali_update.sh /usr/lib/gcc/hppa-linux-gnu/12
build/gcc/ada/rts
error: changes in Ada Library Information files.
You are seeing this because
 * build and host GCC major versions match.
 * build_type=build-native and with_libgnat=yes in debian/rules.defs.

 * differing files: s-oscons.ali s-osprim.ali s-parame.ali

--- /usr/lib/gcc/hppa-linux-gnu/12/adainclude/s-oscons.ads
+++ build/gcc/ada/rts/s-oscons.ads
@@ -357,8 +357,8 @@
    SO_BROADCAST                  : constant := 32;         --  Can send
broadcast msgs
    SO_SNDBUF                     : constant := 4097;       --  Set/get send
buffer size
    SO_RCVBUF                     : constant := 4098;       --  Set/get recv
buffer size
-   SO_SNDTIMEO                   : constant := 4101;       --  Emission
timeout
-   SO_RCVTIMEO                   : constant := 4102;       --  Reception
timeout
+   SO_SNDTIMEO                   : constant := 16449;      --  Emission
timeout
+   SO_RCVTIMEO                   : constant := 16448;      --  Reception
timeout
    SO_ERROR                      : constant := 4103;       --  Get/clear error
status
    SO_BUSY_POLL                  : constant := 16423;      --  Busy polling
    IP_MULTICAST_IF               : constant := 32;         --  Set/get mcast
interface
@@ -394,8 +394,8 @@
    ----------------------

    --  Sizes (in bytes) of the components of struct timeval
-   SIZEOF_tv_sec                 : constant := 4;          --  tv_sec
-   SIZEOF_tv_usec                : constant := 4;          --  tv_usec
+   SIZEOF_tv_sec                 : constant := 8;          --  tv_sec
+   SIZEOF_tv_usec                : constant := 8;          --  tv_usec

    --  Maximum allowed value for tv_sec
    MAX_tv_sec                    : constant := 2 ** (SIZEOF_tv_sec * 8 - 1) -
1;
@@ -469,6 +469,6 @@
    --------------------------------

    SIZEOF_struct_file_attributes : constant := 32;         --  struct
file_attributes
-   SIZEOF_struct_dirent_alloc    : constant := 267;        --  struct dirent
allocation
+   SIZEOF_struct_dirent_alloc    : constant := 275;        --  struct dirent
allocation

 end System.OS_Constants;
--- /usr/lib/gcc/hppa-linux-gnu/12/adainclude/s-osprim.adb
+++ build/gcc/ada/rts/s-osprim.adb
@@ -29,15 +29,18 @@
 --                                                                          --
 ------------------------------------------------------------------------------

---  This version is for POSIX-like operating systems
-with System.Parameters;
+--  This version is for POSIX.1-2008-like operating systems

+with System.CRTL;
+with System.OS_Constants;
+with System.Parameters;
 package body System.OS_Primitives is

-   --  ??? These definitions are duplicated from System.OS_Interface
-   --  because we don't want to depend on any package. Consider removing
-   --  these declarations in System.OS_Interface and move these ones in
-   --  the spec.
+   subtype int is System.CRTL.int;
+
+   --  ??? These definitions are duplicated from System.OS_Interface because
+   --  we don't want to depend on any package. Consider removing these
+   --  declarations in System.OS_Interface and move these ones to the spec.

    type time_t is range -2 ** (System.Parameters.time_t_bits - 1)
      .. 2 ** (System.Parameters.time_t_bits - 1) - 1;
@@ -56,43 +59,22 @@
    -----------

    function Clock return Duration is
+      TS     : aliased timespec;
+      Result : int;

-      type timeval is array (1 .. 3) of Long_Integer;
-      --  The timeval array is sized to contain Long_Long_Integer sec and
-      --  Long_Integer usec. If Long_Long_Integer'Size = Long_Integer'Size
then
-      --  it will be overly large but that will not effect the implementation
-      --  since it is not accessed directly.
-
-      procedure timeval_to_duration
-        (T    : not null access timeval;
-         sec  : not null access Long_Long_Integer;
-         usec : not null access Long_Integer);
-      pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
-
-      Micro  : constant := 10**6;
-      sec    : aliased Long_Long_Integer;
-      usec   : aliased Long_Integer;
-      TV     : aliased timeval;
-      Result : Integer;
-      pragma Unreferenced (Result);
-
-      function gettimeofday
-        (Tv : access timeval;
-         Tz : System.Address := System.Null_Address) return Integer;
-      pragma Import (C, gettimeofday, "gettimeofday");
+      type clockid_t is new int;
+      CLOCK_REALTIME : constant clockid_t :=
+         System.OS_Constants.CLOCK_REALTIME;
+
+      function clock_gettime
+        (clock_id : clockid_t;
+         tp       : access timespec) return int;
+      pragma Import (C, clock_gettime, "clock_gettime");

    begin
-      --  The return codes for gettimeofday are as follows (from man pages):
-      --    EPERM  settimeofday is called by someone other than the superuser
-      --    EINVAL Timezone (or something else) is invalid
-      --    EFAULT One of tv or tz pointed outside accessible address space
-
-      --  None of these codes signal a potential clock skew, hence the return
-      --  value is never checked.
-
-      Result := gettimeofday (TV'Access, System.Null_Address);
-      timeval_to_duration (TV'Access, sec'Access, usec'Access);
-      return Duration (sec) + Duration (usec) / Micro;
+      Result := clock_gettime (CLOCK_REALTIME, TS'Unchecked_Access);
+      pragma Assert (Result = 0);
+      return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
    end Clock;

    -----------------
--- /usr/lib/gcc/hppa-linux-gnu/12/adainclude/s-parame.ads
+++ build/gcc/ada/rts/s-parame.ads
@@ -29,7 +29,7 @@
 --                                                                          --
 ------------------------------------------------------------------------------

---  Default version used when no target-specific version is provided
+--  This is the Posix 2008 version for 64 bit time_t.

 --  This package defines some system dependent parameters for GNAT. These
 --  are values that are referenced by the runtime library and are therefore
@@ -102,8 +102,9 @@
    -- Characteristics of time_t type --
    ------------------------------------

-   time_t_bits : constant := Long_Integer'Size;
-   --  Number of bits in type time_t
+   time_t_bits : constant := Long_Long_Integer'Size;
+   --  Number of bits in type time_t. Use for targets that are Posix 2008
+   --  compliant (fixes the year 2038 time_t overflow).

    ----------------------------------------------
    -- Characteristics of types in Interfaces.C --

This may break Ada packages, see
https://people.debian.org/~lbrenta/debian-ada-policy.html.
If you are uploading to Debian, please contact debian-...@lists.debian.org.
debian/ada/check_ali_update.sh: 66: DEB_FAIL_ON_ADA_LIB_INFO_CHANGE: parameter
not set
make[1]: [debian/rules2:1343: stamps/05-build-stamp] Error 2 (ignored)
touch stamps/05-build-stamp

The switch to s-osprim.adb for POSIX.1-2008-like operating systems was
in this Debian patch: pr114065-proposed.diff.

This was Matthias' proposed fix for pr114065 (gnat build with -D_TIME_BITS=64
-D_FILE_OFFSET_BITS=64 fails on 32bit archs).

I suspect this patch needs to be removed until there is a proper fix for
pr114065, but maybe there is more...

Probably, this a duplicate of 114065.

*** This bug has been marked as a duplicate of bug 114065 ***

Reply via email to