]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix Ada runtime library breakage on Solaris
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 17 May 2024 22:21:56 +0000 (00:21 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 17 May 2024 22:24:46 +0000 (00:24 +0200)
The recent changes made to the runtime library broke its build on Solaris
because it uses Solaris threads instead of POSIX threads on this platform.

gcc/ada/
PR ada/115133
* libgnarl/s-osinte__solaris.ads (mutex_t): Fix typo.
* libgnarl/s-taprop__solaris.adb (Record_Lock): Add conversion.
(Check_Sleep): Likewise.
(Record_Wakeup): Likewise.
(Check_Unlock): Likewise.
* libgnarl/s-tasini.adb (Initialize_RTS_Lock): Add pragma Import
on the overlaid variable.
(Finalize_RTS_Lock): Likewise.
(Acquire_RTS_Lock): Likewise.
(Release_RTS_Lock): Likewise.
* libgnarl/s-taspri__solaris.ads (To_RTS_Lock_Ptr): New instance
of Ada.Unchecked_Conversion.
* libgnat/s-oslock__solaris.ads: Add with clause for
Ada.Unchecked_Conversion.
(array_type_9): Add missing name qualification.
(record_type_3): Likewise.
(mutex_t): Fix formatting.

gcc/ada/libgnarl/s-osinte__solaris.ads
gcc/ada/libgnarl/s-taprop__solaris.adb
gcc/ada/libgnarl/s-tasini.adb
gcc/ada/libgnarl/s-taspri__solaris.ads
gcc/ada/libgnat/s-oslock__solaris.ads

index 12ad52bb48ed4c8a4571416e0ad3e7c7a47dde1d..3703697ef44fa91fc46761a897c8637fb86d38e2 100644 (file)
@@ -298,7 +298,7 @@ package System.OS_Interface is
 
    function To_thread_t is new Ada.Unchecked_Conversion (Integer, thread_t);
 
-   subtype mutex_t is System.OS_Lock.mutex_t;
+   subtype mutex_t is System.OS_Locks.mutex_t;
 
    type cond_t is limited private;
 
index 88b77b09820dabd3b21728c15ae81e98a11539ec..82e51b8d25c557c664188b3ca20cbe90ab5282d1 100644 (file)
@@ -1399,7 +1399,7 @@ package body System.Task_Primitives.Operations is
       P := Self_ID.Common.LL.Locks;
 
       if P /= null then
-         L.Next := P;
+         L.Next := To_RTS_Lock_Ptr (P);
       end if;
 
       Self_ID.Common.LL.Locking := null;
@@ -1440,7 +1440,7 @@ package body System.Task_Primitives.Operations is
 
       Self_ID.Common.LL.L.Owner := null;
       P := Self_ID.Common.LL.Locks;
-      Self_ID.Common.LL.Locks := Self_ID.Common.LL.Locks.Next;
+      Self_ID.Common.LL.Locks := To_Lock_Ptr (Self_ID.Common.LL.Locks.Next);
       P.Next := null;
       return True;
    end Check_Sleep;
@@ -1468,7 +1468,7 @@ package body System.Task_Primitives.Operations is
       P := Self_ID.Common.LL.Locks;
 
       if P /= null then
-         L.Next := P;
+         L.Next := To_RTS_Lock_Ptr (P);
       end if;
 
       Self_ID.Common.LL.Locking := null;
@@ -1549,7 +1549,7 @@ package body System.Task_Primitives.Operations is
 
       L.Owner := null;
       P := Self_ID.Common.LL.Locks;
-      Self_ID.Common.LL.Locks := Self_ID.Common.LL.Locks.Next;
+      Self_ID.Common.LL.Locks := To_Lock_Ptr (Self_ID.Common.LL.Locks.Next);
       P.Next := null;
       return True;
    end Check_Unlock;
index 794183f5356ad099ebe4e7fc2e3f9cae488803d1..d42d2881df456c13e41b4af1001827f20b81859d 100644 (file)
@@ -246,6 +246,7 @@ package body System.Tasking.Initialization is
    procedure Initialize_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Initialize_Lock (Lock'Unchecked_Access, PO_Level);
@@ -258,6 +259,7 @@ package body System.Tasking.Initialization is
    procedure Finalize_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Finalize_Lock (Lock'Unchecked_Access);
@@ -270,6 +272,7 @@ package body System.Tasking.Initialization is
    procedure Acquire_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Write_Lock (Lock'Unchecked_Access);
@@ -282,6 +285,7 @@ package body System.Tasking.Initialization is
    procedure Release_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Unlock (Lock'Unchecked_Access);
index ca40229993bdc2598852d0fa5c321d3fd3b9afb2..16fc4196b005f0004f1df25a7a5c7e9d0bdc432d 100644 (file)
@@ -47,6 +47,8 @@ package System.Task_Primitives is
 
    function To_Lock_Ptr is
      new Ada.Unchecked_Conversion (OS_Locks.RTS_Lock_Ptr, Lock_Ptr);
+   function To_RTS_Lock_Ptr is
+     new Ada.Unchecked_Conversion (Lock_Ptr, OS_Locks.RTS_Lock_Ptr);
 
    type Suspension_Object is limited private;
    --  Should be used for the implementation of Ada.Synchronous_Task_Control
index 8cf7c694904391908f1e387f9db869bce3f37758..cc5a83df02e2e202c10872ae9494aa56e9af3ab1 100644 (file)
@@ -31,6 +31,7 @@
 
 --  This is a Solaris (native) version of this package
 
+with Ada.Unchecked_Conversion;
 with Interfaces.C;
 
 package System.OS_Locks is
@@ -65,10 +66,10 @@ package System.OS_Locks is
 
 private
 
-   type array_type_9 is array (0 .. 3) of unsigned_char;
+   type array_type_9 is array (0 .. 3) of Interfaces.C.unsigned_char;
    type record_type_3 is record
       flag  : array_type_9;
-      Xtype : unsigned_long;
+      Xtype : Interfaces.C.unsigned_long;
    end record;
    pragma Convention (C, record_type_3);
 
@@ -79,6 +80,6 @@ private
       lock  : upad64_t;
       data  : upad64_t;
    end record;
-  pragma Convention (C, mutex_t);
+   pragma Convention (C, mutex_t);
 
 end System.OS_Locks;