galeb

Једноставна статичка дистрибуција заснована на musl-у
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

0026-ada-libgnarl-compatibility-for-musl.patch (5516B)


      1 From: Ariadne Conill <ariadne@dereferenced.org>
      2 From: Olsken (updated patches)
      3 Date: Sat, 21 Aug 2021 08:51:52 +0000
      4 Subject: [PATCH] ada: libgnarl compatibility for musl
      5 
      6 diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
      7 index 2272f83d6..1d7845654 100644
      8 --- a/gcc/ada/libgnarl/s-osinte__linux.ads
      9 +++ b/gcc/ada/libgnarl/s-osinte__linux.ads
     10 @@ -401,12 +401,6 @@ package System.OS_Interface is
     11     PTHREAD_RWLOCK_PREFER_WRITER_NP              : constant := 1;
     12     PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
     13  
     14 -   function pthread_rwlockattr_setkind_np
     15 -     (attr : access pthread_rwlockattr_t;
     16 -      pref : int) return int;
     17 -   pragma Import
     18 -     (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
     19 -
     20     function pthread_rwlock_init
     21       (mutex : access pthread_rwlock_t;
     22        attr  : access pthread_rwlockattr_t) return int;
     23 @@ -468,11 +462,6 @@ package System.OS_Interface is
     24        protocol : int) return int;
     25     pragma Import (C, pthread_mutexattr_setprotocol);
     26  
     27 -   function pthread_mutexattr_setprioceiling
     28 -     (attr        : access pthread_mutexattr_t;
     29 -      prioceiling : int) return int;
     30 -   pragma Import (C, pthread_mutexattr_setprioceiling);
     31 -
     32     type struct_sched_param is record
     33        sched_priority : int;  --  scheduling priority
     34     end record;
     35 diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
     36 index 757a6cdfd..18e60e8d1 100644
     37 --- a/gcc/ada/libgnarl/s-taprop__linux.adb
     38 +++ b/gcc/ada/libgnarl/s-taprop__linux.adb
     39 @@ -198,9 +198,6 @@ package body System.Task_Primitives.Operations is
     40     pragma Import
     41       (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
     42  
     43 -   function GNAT_has_cap_sys_nice return C.int;
     44 -   pragma Import
     45 -     (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
     46     --  We do not have pragma Linker_Options ("-lcap"); here, because this
     47     --  library is not present on many Linux systems. 'libcap' is the Linux
     48     --  "capabilities" library, called by __gnat_has_cap_sys_nice.
     49 @@ -210,44 +207,6 @@ package body System.Task_Primitives.Operations is
     50     --  Convert Ada priority to Linux priority. Priorities are 1 .. 99 on
     51     --  GNU/Linux, so we map 0 .. 98 to 1 .. 99.
     52  
     53 -   function Get_Ceiling_Support return Boolean;
     54 -   --  Get the value of the Ceiling_Support constant (see below).
     55 -   --  Note well: If this function or related code is modified, it should be
     56 -   --  tested by hand, because automated testing doesn't exercise it.
     57 -
     58 -   -------------------------
     59 -   -- Get_Ceiling_Support --
     60 -   -------------------------
     61 -
     62 -   function Get_Ceiling_Support return Boolean is
     63 -      Ceiling_Support : Boolean := False;
     64 -   begin
     65 -      if Locking_Policy /= 'C' then
     66 -         return False;
     67 -      end if;
     68 -
     69 -      declare
     70 -         function geteuid return Integer;
     71 -         pragma Import (C, geteuid, "geteuid");
     72 -         Superuser : constant Boolean := geteuid = 0;
     73 -         Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
     74 -         pragma Assert (Has_Cap in 0 | 1);
     75 -      begin
     76 -         Ceiling_Support := Superuser or else Has_Cap = 1;
     77 -      end;
     78 -
     79 -      return Ceiling_Support;
     80 -   end Get_Ceiling_Support;
     81 -
     82 -   pragma Warnings (Off, "non-preelaborable call not allowed*");
     83 -   Ceiling_Support : constant Boolean := Get_Ceiling_Support;
     84 -   pragma Warnings (On, "non-preelaborable call not allowed*");
     85 -   --  True if the locking policy is Ceiling_Locking, and the current process
     86 -   --  has permission to use this policy. The process has permission if it is
     87 -   --  running as 'root', or if the capability was set by the setcap command,
     88 -   --  as in "sudo /sbin/setcap cap_sys_nice=ep exe_file". If it doesn't have
     89 -   --  permission, then a request for Ceiling_Locking is ignored.
     90 -
     91     type RTS_Lock_Ptr is not null access all RTS_Lock;
     92  
     93     function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int;
     94 @@ -344,7 +303,9 @@ package body System.Task_Primitives.Operations is
     95     -- Init_Mutex --
     96     ----------------
     97  
     98 +   pragma Warnings (Off, "formal parameter * is not referenced");
     99     function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
    100 +   pragma Warnings (On, "formal parameter * is not referenced");
    101        Mutex_Attr : aliased pthread_mutexattr_t;
    102        Result, Result_2 : C.int;
    103  
    104 @@ -356,16 +317,7 @@ package body System.Task_Primitives.Operations is
    105           return Result;
    106        end if;
    107  
    108 -      if Ceiling_Support then
    109 -         Result := pthread_mutexattr_setprotocol
    110 -           (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
    111 -         pragma Assert (Result = 0);
    112 -
    113 -         Result := pthread_mutexattr_setprioceiling
    114 -           (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
    115 -         pragma Assert (Result = 0);
    116 -
    117 -      elsif Locking_Policy = 'I' then
    118 +      if Locking_Policy = 'I' then
    119           Result := pthread_mutexattr_setprotocol
    120             (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
    121           pragma Assert (Result = 0);
    122 @@ -405,11 +357,6 @@ package body System.Task_Primitives.Operations is
    123              Result := pthread_rwlockattr_init (RWlock_Attr'Access);
    124              pragma Assert (Result = 0);
    125  
    126 -            Result := pthread_rwlockattr_setkind_np
    127 -              (RWlock_Attr'Access,
    128 -               PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
    129 -            pragma Assert (Result = 0);
    130 -
    131              Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
    132  
    133              pragma Assert (Result in 0 | ENOMEM);