OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
6.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/pkg/gcc/0027-ada-libgnarl-compatibility-for-musl.patch
  5. # Copyright (C) 2020 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From 4e1b3a26f558e7693853d3600ee677705e67406c Mon Sep 17 00:00:00 2001
  17. From: Ariadne Conill <ariadne@dereferenced.org>
  18. Date: Fri, 21 Aug 2020 07:06:30 +0000
  19. Subject: [PATCH 27/30] ada: libgnarl compatibility for musl
  20. ---
  21. gcc/ada/libgnarl/s-osinte__linux.ads | 11 ------
  22. gcc/ada/libgnarl/s-taprop__linux.adb | 53 ++--------------------------
  23. 2 files changed, 3 insertions(+), 61 deletions(-)
  24. diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
  25. index 80cb2b2a793..701b7a3aeab 100644
  26. --- a/gcc/ada/libgnarl/s-osinte__linux.ads
  27. +++ b/gcc/ada/libgnarl/s-osinte__linux.ads
  28. @@ -399,12 +399,6 @@ package System.OS_Interface is
  29. PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
  30. PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
  31. - function pthread_rwlockattr_setkind_np
  32. - (attr : access pthread_rwlockattr_t;
  33. - pref : int) return int;
  34. - pragma Import
  35. - (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
  36. -
  37. function pthread_rwlock_init
  38. (mutex : access pthread_rwlock_t;
  39. attr : access pthread_rwlockattr_t) return int;
  40. @@ -466,11 +460,6 @@ package System.OS_Interface is
  41. protocol : int) return int;
  42. pragma Import (C, pthread_mutexattr_setprotocol);
  43. - function pthread_mutexattr_setprioceiling
  44. - (attr : access pthread_mutexattr_t;
  45. - prioceiling : int) return int;
  46. - pragma Import (C, pthread_mutexattr_setprioceiling);
  47. -
  48. type struct_sched_param is record
  49. sched_priority : int; -- scheduling priority
  50. end record;
  51. diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
  52. index c45559e5ba0..0b0f173e7d4 100644
  53. --- a/gcc/ada/libgnarl/s-taprop__linux.adb
  54. +++ b/gcc/ada/libgnarl/s-taprop__linux.adb
  55. @@ -202,9 +202,6 @@ package body System.Task_Primitives.Operations is
  56. pragma Import
  57. (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
  58. - function GNAT_has_cap_sys_nice return C.int;
  59. - pragma Import
  60. - (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
  61. -- We do not have pragma Linker_Options ("-lcap"); here, because this
  62. -- library is not present on many Linux systems. 'libcap' is the Linux
  63. -- "capabilities" library, called by __gnat_has_cap_sys_nice.
  64. @@ -214,38 +211,6 @@ package body System.Task_Primitives.Operations is
  65. -- Convert Ada priority to Linux priority. Priorities are 1 .. 99 on
  66. -- GNU/Linux, so we map 0 .. 98 to 1 .. 99.
  67. - function Get_Ceiling_Support return Boolean;
  68. - -- Get the value of the Ceiling_Support constant (see below).
  69. - -- Note well: If this function or related code is modified, it should be
  70. - -- tested by hand, because automated testing doesn't exercise it.
  71. -
  72. - -------------------------
  73. - -- Get_Ceiling_Support --
  74. - -------------------------
  75. -
  76. - function Get_Ceiling_Support return Boolean is
  77. - Ceiling_Support : Boolean := False;
  78. - begin
  79. - if Locking_Policy /= 'C' then
  80. - return False;
  81. - end if;
  82. -
  83. - declare
  84. - function geteuid return Integer;
  85. - pragma Import (C, geteuid, "geteuid");
  86. - Superuser : constant Boolean := geteuid = 0;
  87. - Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
  88. - pragma Assert (Has_Cap in 0 | 1);
  89. - begin
  90. - Ceiling_Support := Superuser or else Has_Cap = 1;
  91. - end;
  92. -
  93. - return Ceiling_Support;
  94. - end Get_Ceiling_Support;
  95. -
  96. - pragma Warnings (Off, "non-static call not allowed in preelaborated unit");
  97. - Ceiling_Support : constant Boolean := Get_Ceiling_Support;
  98. - pragma Warnings (On, "non-static call not allowed in preelaborated unit");
  99. -- True if the locking policy is Ceiling_Locking, and the current process
  100. -- has permission to use this policy. The process has permission if it is
  101. -- running as 'root', or if the capability was set by the setcap command,
  102. @@ -348,7 +313,9 @@ package body System.Task_Primitives.Operations is
  103. -- Init_Mutex --
  104. ----------------
  105. + pragma Warnings (Off, "formal parameter * is not referenced");
  106. function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
  107. + pragma Warnings (On, "formal parameter * is not referenced");
  108. Mutex_Attr : aliased pthread_mutexattr_t;
  109. Result, Result_2 : C.int;
  110. @@ -360,16 +327,7 @@ package body System.Task_Primitives.Operations is
  111. return Result;
  112. end if;
  113. - if Ceiling_Support then
  114. - Result := pthread_mutexattr_setprotocol
  115. - (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
  116. - pragma Assert (Result = 0);
  117. -
  118. - Result := pthread_mutexattr_setprioceiling
  119. - (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
  120. - pragma Assert (Result = 0);
  121. -
  122. - elsif Locking_Policy = 'I' then
  123. + if Locking_Policy = 'I' then
  124. Result := pthread_mutexattr_setprotocol
  125. (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
  126. pragma Assert (Result = 0);
  127. @@ -409,11 +367,6 @@ package body System.Task_Primitives.Operations is
  128. Result := pthread_rwlockattr_init (RWlock_Attr'Access);
  129. pragma Assert (Result = 0);
  130. - Result := pthread_rwlockattr_setkind_np
  131. - (RWlock_Attr'Access,
  132. - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
  133. - pragma Assert (Result = 0);
  134. -
  135. Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
  136. pragma Assert (Result in 0 | ENOMEM);
  137. --
  138. 2.27.0