On Thu, Nov 14, 2013 at 1:16 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
> On Thu, Nov 14, 2013 at 6:16 AM, Arnaud Charlet <char...@adacore.com> wrote:
>>> I also changed s-osinte-posix.adb and s-osprim-posix.adb
>>> for x32.  They aren't Linux specific.  What should I do with
>>> them?
>>
>> I would use the time_t type defined in s-osinte* (all POSIX implementations
>> of s-osinte* have such definition, or if they don't, it's easy to add), and
>> in the s-osinte-linux version we can have a renaming:
>>
>>    subtype time_t is System.Linux.time_t
>>
>> and in System.Linux have either:
>>
>>    type time_t is new Long_Integer;
>>
>> or
>>
>>    type time_t is new Long_Long_Integer;
>>
>> depending on the variant.
>>
>> Arno
>
> Another problem.  s-osprim-posix.adb has
>
>    --  ??? 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.
>
> I can't use time_t from s-osinte-linux.ads since System.OS_Interface
> isn't available. What should I do?
>

This is what I got.  I added s-posix-time.ads which declares
System.OS_Time.time_t.  I use it instead long for time_t.  I
didn't add time_t to s-linux.ads since it isn't used by
s-osprim-posix.adb.

It passes all tests with -m32, -mx32 and -m64 on Linux/x86-64
I don't know if I do it right.  If it isn't right, please tell me exactly
how to fix it since I don't know Ada.

Thanks.

-- 
H.J.
---
2013-11-14  H.J. Lu  <hongjiu...@intel.com>

    PR ada/54040
    * s-osinte-linux.ads (time_t): Replace long with
    System.OS_Time.time_t.
    (timespec): Replace long with time_t.
    * s-osinte-posix.adb (To_Timespec): Likewise.
    * s-osprim-posix.adb (time_t): Replace Long_Integer with
    System.OS_Time.time_t.
    (timespec): Replace Long_Integer with time_t.
    (timeval): Likewise.
    (To_Timespec): Likewise.
    * s-posix-time-x32.ads: New file.
    * s-posix-time.ads: Likewise.
    * s-taprop-linux.adb (timeval): Replace C.long with
    System.OS_Time.time_t.
    * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Add
    s-ostime.ads<s-posix-time.ads when s-osinte-android.adb or
    s-osinte-posix.adb is used.  Use s-posix-time-x32.ads for x32.
    (EXTRA_GNATRTL_TASKING_OBJS): Add s-ostime.o if s-ostime.ads is
    added.
diff --git a/gcc/ada/gcc-interface/Makefile.in 
b/gcc/ada/gcc-interface/Makefile.in
index 91778c5..18d3974 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1007,6 +1007,7 @@ ifeq ($(strip $(filter-out arm% 
linux-androideabi,$(target_cpu) $(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-android.adb \
   s-osinte.ads<s-osinte-android.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1021,7 +1022,7 @@ ifeq ($(strip $(filter-out arm% 
linux-androideabi,$(target_cpu) $(target_os))),)
     indepsw.adb<indepsw-gnu.adb
 
   GNATRTL_SOCKETS_OBJS =
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=
   THREADSLIB =
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1086,6 +1087,7 @@ ifeq ($(strip $(filter-out sparc% sun 
solaris%,$(target_cpu) $(target_vendor) $(
     a-intnam.ads<a-intnam-solaris.ads \
     s-inmaop.adb<s-inmaop-posix.adb \
     s-intman.adb<s-intman-posix.adb \
+    s-ostime.ads<s-posix-time.ads \
     s-osinte.adb<s-osinte-posix.adb \
     s-osinte.ads<s-osinte-solaris-posix.ads \
     s-osprim.adb<s-osprim-solaris.adb \
@@ -1095,6 +1097,7 @@ ifeq ($(strip $(filter-out sparc% sun 
solaris%,$(target_cpu) $(target_vendor) $(
     g-soliop.ads<g-soliop-solaris.ads \
     system.ads<system-solaris-sparc.ads
 
+    EXTRA_GNATRTL_TASKING_OBJS=s-ostime.o
     THREADSLIB = -lposix4 -lpthread
   endif
 
@@ -1173,6 +1176,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) 
$(target_os))),)
   a-exetim.adb<a-exetim-posix.adb \
   a-exetim.ads<a-exetim-default.ads \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   $(ATOMICS_TARGET_PAIRS)
 
@@ -1210,7 +1214,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) 
$(target_os))),)
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread -lrt
   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o s-ostime.o
 
   TOOLS_TARGET_PAIRS =  \
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
@@ -1228,6 +1232,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) 
$(target_os))),)
   a-intnam.ads<a-intnam-freebsd.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1245,6 +1250,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) 
$(target_os))),)
     indepsw.adb<indepsw-gnu.adb
 
   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-ostime.o
 
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
@@ -1261,6 +1267,7 @@ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) 
$(target_os))),)
   a-numaux.ads<a-numaux-x86.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-kfreebsd-gnu.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1275,6 +1282,7 @@ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
+  EXTRA_GNATRTL_TASKING_OBJS=s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1347,6 +1355,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1379,7 +1388,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1412,6 +1421,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) 
$(target_vendor) $(tar
   a-intnam.ads<a-intnam-hpux.ads \
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-hpux.ads \
   s-parame.ads<s-parame-hpux.ads \
@@ -1423,6 +1433,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) 
$(target_vendor) $(tar
   system.ads<system-hpux.ads
 
   TOOLS_TARGET_PAIRS = mlib-tgt-specific.adb<mlib-tgt-specific-hpux.adb
+  EXTRA_GNATRTL_TASKING_OBJS=s-ostime.o
   EH_MECHANISM=-gcc
   TGT_LIB = /usr/lib/libcl.a
   THREADSLIB = -lpthread
@@ -1735,6 +1746,7 @@ ifeq ($(strip $(filter-out mips linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1745,6 +1757,7 @@ ifeq ($(strip $(filter-out mips linux%,$(target_cpu) 
$(target_os))),)
   s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
   system.ads<system-linux-mips.ads
 
+  EXTRA_GNATRTL_TASKING_OBJS=s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1759,6 +1772,7 @@ ifeq ($(strip $(filter-out mipsel linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux-mipsel.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1787,7 +1801,7 @@ ifeq ($(strip $(filter-out mipsel linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1802,6 +1816,7 @@ ifeq ($(strip $(filter-out mips64el linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux-mipsel.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1830,7 +1845,7 @@ ifeq ($(strip $(filter-out mips64el linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1849,6 +1864,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-tpopsp.adb<s-tpopsp-tls.adb \
   g-sercom.adb<g-sercom-linux.adb \
@@ -1894,7 +1910,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread -lrt
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1909,6 +1925,7 @@ ifeq ($(strip $(filter-out arm% 
linux-gnueabi,$(target_cpu) $(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1930,7 +1947,7 @@ ifeq ($(strip $(filter-out arm% 
linux-gnueabi,$(target_cpu) $(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1945,6 +1962,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux-sparc.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -1972,7 +1990,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -1987,6 +2005,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux-hppa.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -2001,7 +2020,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB = -lpthread
   GNATLIB_SHARED = gnatlib-shared-dual
@@ -2016,6 +2035,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osprim.adb<s-osprim-posix.adb \
@@ -2030,7 +2050,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-linux.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   MISCLIB=
   THREADSLIB = -lpthread
@@ -2051,6 +2071,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-mudido.adb<s-mudido-affinity.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osinte.adb<s-osinte-posix.adb \
@@ -2069,7 +2090,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o s-ostime.o
   EH_MECHANISM=-gcc
   MISCLIB=
   THREADSLIB=-lpthread -lrt
@@ -2114,6 +2135,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux-alpha.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-osinte.ads<s-osinte-linux.ads \
   s-osinte.adb<s-osinte-posix.adb \
   s-osprim.adb<s-osprim-posix.adb \
@@ -2130,7 +2152,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) 
$(target_os))),)
     mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
     indepsw.adb<indepsw-gnu.adb
 
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o s-ostime.o
   EH_MECHANISM=-gcc
   MISCLIB=
   THREADSLIB=-lpthread
@@ -2149,6 +2171,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time.ads \
   s-mudido.adb<s-mudido-affinity.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osinte.adb<s-osinte-posix.adb \
@@ -2168,7 +2191,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) 
$(target_os))),)
     indepsw.adb<indepsw-gnu.adb
 
   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB=-lpthread -lrt
   MISCLIB = -ldl
@@ -2187,6 +2210,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) 
$(target_os))),)
   s-inmaop.adb<s-inmaop-posix.adb \
   s-intman.adb<s-intman-posix.adb \
   s-linux.ads<s-linux.ads \
+  s-ostime.ads<s-posix-time-x32.ads \
   s-mudido.adb<s-mudido-affinity.adb \
   s-osinte.ads<s-osinte-linux.ads \
   s-osinte.adb<s-osinte-posix.adb \
@@ -2206,7 +2230,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) 
$(target_os))),)
     indepsw.adb<indepsw-gnu.adb
 
   EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
-  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
+  EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o s-ostime.o
   EH_MECHANISM=-gcc
   THREADSLIB=-lpthread -lrt
   GNATLIB_SHARED=gnatlib-shared-dual
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index a99c4e5..49c6832 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -42,6 +42,7 @@ with Ada.Unchecked_Conversion;
 with Interfaces.C;
 with System.Linux;
 with System.OS_Constants;
+with System.OS_Time;
 
 package System.OS_Interface is
    pragma Preelaborate;
@@ -596,11 +597,11 @@ private
 
    type pid_t is new int;
 
-   type time_t is new long;
+   type time_t is new System.OS_Time.time_t;
 
    type timespec is record
       tv_sec  : time_t;
-      tv_nsec : long;
+      tv_nsec : time_t;
    end record;
    pragma Convention (C, timespec);
 
diff --git a/gcc/ada/s-osinte-posix.adb b/gcc/ada/s-osinte-posix.adb
index 29579b2..402ddcb 100644
--- a/gcc/ada/s-osinte-posix.adb
+++ b/gcc/ada/s-osinte-posix.adb
@@ -104,7 +104,7 @@ package body System.OS_Interface is
       end if;
 
       return timespec'(tv_sec => S,
-                       tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
+                       tv_nsec => time_t (Long_Long_Integer (F * 10#1#E9)));
    end To_Timespec;
 
 end System.OS_Interface;
diff --git a/gcc/ada/s-osprim-posix.adb b/gcc/ada/s-osprim-posix.adb
index e03a132..a3717a7 100644
--- a/gcc/ada/s-osprim-posix.adb
+++ b/gcc/ada/s-osprim-posix.adb
@@ -31,6 +31,8 @@
 
 --  This version is for POSIX-like operating systems
 
+with System.OS_Time;
+
 package body System.OS_Primitives is
 
    --  ??? These definitions are duplicated from System.OS_Interface
@@ -38,11 +40,11 @@ package body System.OS_Primitives is
    --  these declarations in System.OS_Interface and move these ones in
    --  the spec.
 
-   type time_t is new Long_Integer;
+   type time_t is new System.OS_Time.time_t;
 
    type timespec is record
       tv_sec  : time_t;
-      tv_nsec : Long_Integer;
+      tv_nsec : time_t;
    end record;
    pragma Convention (C, timespec);
 
@@ -54,7 +56,7 @@ package body System.OS_Primitives is
    -----------
 
    function Clock return Duration is
-      type timeval is array (1 .. 2) of Long_Integer;
+      type timeval is array (1 .. 2) of time_t;
 
       procedure timeval_to_duration
         (T    : not null access timeval;
@@ -118,7 +120,7 @@ package body System.OS_Primitives is
 
       return
         timespec'(tv_sec  => S,
-                  tv_nsec => Long_Integer (Long_Long_Integer (F * 10#1#E9)));
+                  tv_nsec => time_t (Long_Long_Integer (F * 10#1#E9)));
    end To_Timespec;
 
    -----------------
diff --git a/gcc/ada/s-posix-time-x32.ads b/gcc/ada/s-posix-time-x32.ads
new file mode 100644
index 0000000..2f71869
--- /dev/null
+++ b/gcc/ada/s-posix-time-x32.ads
@@ -0,0 +1,44 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
+--                                                                          --
+--                          S Y S T E M .  O S _ T i m e                    --
+--                                                                          --
+--                                  S p e c                                 --
+--                                                                          --
+--          Copyright (C) 2013, 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- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This is the default version of this package
+
+--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
+--  Preelaborate. This package is designed to be a bottom-level (leaf) package
+
+package System.OS_Time is
+   pragma Preelaborate;
+
+   ------------
+   -- time_t --
+   ------------
+
+   type time_t is new Long_Long_Integer;
+
+end System.OS_Time;
diff --git a/gcc/ada/s-posix-time.ads b/gcc/ada/s-posix-time.ads
new file mode 100644
index 0000000..3cb8976
--- /dev/null
+++ b/gcc/ada/s-posix-time.ads
@@ -0,0 +1,44 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
+--                                                                          --
+--                          S Y S T E M .  O S _ T i m e                    --
+--                                                                          --
+--                                  S p e c                                 --
+--                                                                          --
+--          Copyright (C) 2013, 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- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This is the default version of this package
+
+--  PLEASE DO NOT add any with-clauses to this package or remove the pragma
+--  Preelaborate. This package is designed to be a bottom-level (leaf) package
+
+package System.OS_Time is
+   pragma Preelaborate;
+
+   ------------
+   -- time_t --
+   ------------
+
+   type time_t is new Long_Integer;
+
+end System.OS_Time;
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb
index 6047d31..1c78b37 100644
--- a/gcc/ada/s-taprop-linux.adb
+++ b/gcc/ada/s-taprop-linux.adb
@@ -46,6 +46,7 @@ with System.Interrupt_Management;
 with System.OS_Primitives;
 with System.Stack_Checking.Operations;
 with System.Multiprocessors;
+with System.OS_Time;
 
 with System.Soft_Links;
 --  We use System.Soft_Links instead of System.Tasking.Initialization
@@ -627,7 +628,7 @@ package body System.Task_Primitives.Operations is
    function Monotonic_Clock return Duration is
       use Interfaces;
 
-      type timeval is array (1 .. 2) of C.long;
+      type timeval is array (1 .. 2) of System.OS_Time.time_t;
 
       procedure timeval_to_duration
         (T    : not null access timeval;

Reply via email to