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.

239 lines
7.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/pkg/gcc/0028-ada-musl-support-fixes.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 5e3d7d2f1e2448b6c5eb207f9251c437629e43bc Mon Sep 17 00:00:00 2001
  17. From: Ariadne Conill <ariadne@dereferenced.org>
  18. Date: Fri, 21 Aug 2020 07:07:48 +0000
  19. Subject: [PATCH 28/30] ada: musl support fixes
  20. ---
  21. gcc/ada/Makefile.rtl | 10 +++++-----
  22. gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
  23. gcc/ada/adaint.h | 10 ++++------
  24. gcc/ada/terminals.c | 8 ++++----
  25. 4 files changed, 32 insertions(+), 30 deletions(-)
  26. diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
  27. index 55ff9b0f3d5..0fadf4e4b79 100644
  28. --- a/gcc/ada/Makefile.rtl
  29. +++ b/gcc/ada/Makefile.rtl
  30. @@ -1533,7 +1533,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
  31. s-intman.adb<libgnarl/s-intman__posix.adb \
  32. s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
  33. $(TRASYM_DWARF_UNIX_PAIRS) \
  34. - s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  35. + s-tsmona.adb<libgnat/s-tsmona.adb \
  36. a-exetim.adb<libgnarl/a-exetim__posix.adb \
  37. a-exetim.ads<libgnarl/a-exetim__default.ads \
  38. s-linux.ads<libgnarl/s-linux.ads \
  39. @@ -2083,7 +2083,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
  40. s-osinte.adb<libgnarl/s-osinte__posix.adb \
  41. s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
  42. $(TRASYM_DWARF_UNIX_PAIRS) \
  43. - s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  44. + s-tsmona.adb<libgnat/s-tsmona.adb \
  45. $(ATOMICS_TARGET_PAIRS) \
  46. $(ATOMICS_BUILTINS_TARGET_PAIRS) \
  47. system.ads<libgnat/system-linux-ppc.ads
  48. @@ -2112,7 +2112,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
  49. endif
  50. # ARM linux, GNU eabi
  51. -ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
  52. +ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
  53. LIBGNAT_TARGET_PAIRS = \
  54. a-intnam.ads<libgnarl/a-intnam__linux.ads \
  55. s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
  56. @@ -2305,7 +2305,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
  57. s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
  58. s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
  59. $(TRASYM_DWARF_UNIX_PAIRS) \
  60. - s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  61. + s-tsmona.adb<libgnat/s-tsmona.adb \
  62. $(ATOMICS_TARGET_PAIRS) \
  63. $(ATOMICS_BUILTINS_TARGET_PAIRS) \
  64. system.ads<libgnat/system-linux-ia64.ads
  65. @@ -2401,7 +2401,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
  66. s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
  67. s-taspri.ads<libgnarl/s-taspri__posix.ads \
  68. $(TRASYM_DWARF_UNIX_PAIRS) \
  69. - s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  70. + s-tsmona.adb<libgnat/s-tsmona.adb \
  71. $(ATOMICS_TARGET_PAIRS) \
  72. $(X86_64_TARGET_PAIRS) \
  73. system.ads<libgnat/system-linux-x86.ads
  74. diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
  75. index 595abf87d65..00858c24f53 100644
  76. --- a/gcc/ada/adaint.c
  77. +++ b/gcc/ada/adaint.c
  78. @@ -90,6 +90,11 @@
  79. #include <sys/param.h>
  80. #include <sys/pstat.h>
  81. #endif
  82. +
  83. +#if defined (linux)
  84. +#define _GNU_SOURCE 1
  85. +#include <sched.h>
  86. +#endif
  87. #ifdef __PikeOS__
  88. #define __BSD_VISIBLE 1
  89. @@ -3308,7 +3313,6 @@ __gnat_lwp_self (void)
  90. #endif
  91. #if defined (__linux__)
  92. -#include <sched.h>
  93. /* glibc versions earlier than 2.7 do not define the routines to handle
  94. dynamically allocated CPU sets. For these targets, we use the static
  95. @@ -3318,7 +3322,7 @@ __gnat_lwp_self (void)
  96. /* Dynamic cpu sets */
  97. -cpu_set_t *
  98. +void *
  99. __gnat_cpu_alloc (size_t count)
  100. {
  101. return CPU_ALLOC (count);
  102. @@ -3331,33 +3335,33 @@ __gnat_cpu_alloc_size (size_t count)
  103. }
  104. void
  105. -__gnat_cpu_free (cpu_set_t *set)
  106. +__gnat_cpu_free (void *set)
  107. {
  108. - CPU_FREE (set);
  109. + CPU_FREE ((cpu_set_t *) set);
  110. }
  111. void
  112. -__gnat_cpu_zero (size_t count, cpu_set_t *set)
  113. +__gnat_cpu_zero (size_t count, void *set)
  114. {
  115. - CPU_ZERO_S (count, set);
  116. + CPU_ZERO_S (count, (cpu_set_t *) set);
  117. }
  118. void
  119. -__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
  120. +__gnat_cpu_set (int cpu, size_t count, void *set)
  121. {
  122. /* Ada handles CPU numbers starting from 1, while C identifies the first
  123. CPU by a 0, so we need to adjust. */
  124. - CPU_SET_S (cpu - 1, count, set);
  125. + CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
  126. }
  127. #else /* !CPU_ALLOC */
  128. /* Static cpu sets */
  129. -cpu_set_t *
  130. +void *
  131. __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
  132. {
  133. - return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
  134. + return xmalloc (sizeof (cpu_set_t));
  135. }
  136. size_t
  137. @@ -3367,23 +3371,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
  138. }
  139. void
  140. -__gnat_cpu_free (cpu_set_t *set)
  141. +__gnat_cpu_free (void *set)
  142. {
  143. free (set);
  144. }
  145. void
  146. -__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
  147. +__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
  148. {
  149. - CPU_ZERO (set);
  150. + CPU_ZERO ((cpu_set_t *) set);
  151. }
  152. void
  153. -__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
  154. +__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
  155. {
  156. /* Ada handles CPU numbers starting from 1, while C identifies the first
  157. CPU by a 0, so we need to adjust. */
  158. - CPU_SET (cpu - 1, set);
  159. + CPU_SET (cpu - 1, (cpu_set_t *) set);
  160. }
  161. #endif /* !CPU_ALLOC */
  162. #endif /* __linux__ */
  163. diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
  164. index 311e240dfcc..1c4d0050103 100644
  165. --- a/gcc/ada/adaint.h
  166. +++ b/gcc/ada/adaint.h
  167. @@ -316,13 +316,11 @@ extern void *__gnat_lwp_self (void);
  168. /* Routines for interface to required CPU set primitives */
  169. -#include <sched.h>
  170. -
  171. -extern cpu_set_t *__gnat_cpu_alloc (size_t);
  172. +extern void * __gnat_cpu_alloc (size_t);
  173. extern size_t __gnat_cpu_alloc_size (size_t);
  174. -extern void __gnat_cpu_free (cpu_set_t *);
  175. -extern void __gnat_cpu_zero (size_t, cpu_set_t *);
  176. -extern void __gnat_cpu_set (int, size_t, cpu_set_t *);
  177. +extern void __gnat_cpu_free (void *);
  178. +extern void __gnat_cpu_zero (size_t, void *);
  179. +extern void __gnat_cpu_set (int, size_t, void *);
  180. #endif
  181. #if defined (_WIN32)
  182. diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
  183. index af4417fab90..bab6bf3ca87 100644
  184. --- a/gcc/ada/terminals.c
  185. +++ b/gcc/ada/terminals.c
  186. @@ -1145,7 +1145,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
  187. /* POSIX does not specify how to open the master side of a terminal.Several
  188. methods are available (system specific):
  189. 1- using a cloning device (USE_CLONE_DEVICE)
  190. - 2- getpt (USE_GETPT)
  191. + 2- posix_openpt (USE_POSIX_OPENPT)
  192. 3- openpty (USE_OPENPTY)
  193. When using the cloning device method, the macro USE_CLONE_DEVICE should
  194. @@ -1159,7 +1159,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
  195. #if defined (__APPLE__) || defined (BSD)
  196. #define USE_OPENPTY
  197. #elif defined (__linux__)
  198. -#define USE_GETPT
  199. +#define USE_POSIX_OPENPT
  200. #elif defined (__sun__)
  201. #define USE_CLONE_DEVICE "/dev/ptmx"
  202. #elif defined (_AIX)
  203. @@ -1208,8 +1208,8 @@ allocate_pty_desc (pty_desc **desc) {
  204. int master_fd = -1;
  205. char *slave_name = NULL;
  206. -#ifdef USE_GETPT
  207. - master_fd = getpt ();
  208. +#if defined(USE_POSIX_OPENPT)
  209. + master_fd = posix_openpt(O_RDWR | O_NOCTTY);
  210. #elif defined (USE_OPENPTY)
  211. status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
  212. #elif defined (USE_CLONE_DEVICE)
  213. --
  214. 2.27.0