aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/compilers/ghc/issue-18549.patch
blob: eb30d9d9dd4ce20cf2ddea1171f4bb4d1ab5849d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
From fac083e7ac8a37b61a4082bbbca2848e52fd1bb2 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Sun, 9 Aug 2020 09:15:16 -0400
Subject: [PATCH] Revert "[linker/rtsSymbols] More linker symbols"

This reverts commit aa2e5863699306920513b216f337de09e29b5bb8.
---
 rts/RtsSymbols.c | 224 ++++-------------------------------------------
 1 file changed, 17 insertions(+), 207 deletions(-)

diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index d10a6900db..b2f90a892d 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -58,6 +58,7 @@
       SymI_HasProto(signal_handlers)            \
       SymI_HasProto(stg_sig_install)            \
       SymI_HasProto(rtsTimerSignal)             \
+      SymI_HasProto(atexit)                     \
       SymI_NeedsDataProto(nocldstop)
 #endif
 
@@ -976,213 +977,29 @@
       RTS_USER_SIGNALS_SYMBOLS                                          \
       RTS_INTCHAR_SYMBOLS
 
+
 // 64-bit support functions in libgcc.a
-// See https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc
-#define RTS_LIBGCC_SYMBOLS_32                          \
-      SymI_NeedsProto(__fixunsdfdi)                    \
-      /* 4 The GCC low-level runtime library         */\
-      /* 4.1.1 Arithmetic functions                  */\
-      /* SymI_NeedsProto(__ashlsi3) */\
-      SymI_NeedsProto(__ashldi3) \
-      /* SymI_NeedsProto(__ashlti3) */\
-      /* These functions return the result of shifting a left by b bits. */\
-      /* SymI_NeedsProto(__ashrsi3) */\
-      SymI_NeedsProto(__ashrdi3) \
-      /* SymI_NeedsProto(__ashrti3) */\
-      /* These functions return the result of arithmetically shifting a right by b bits. */\
-      /* SymI_NeedsProto(__divsi3) */\
-      SymI_NeedsProto(__divdi3) \
-      /* SymI_NeedsProto(__divti3) */\
-      /* These functions return the quotient of the signed division of a and b. */\
-      /* SymI_NeedsProto(__lshrsi3) */ \
-      SymI_NeedsProto(__lshrdi3) \
-      /* SymI_NeedsProto(__lshrti3) */ \
-      /* These functions return the result of logically shifting a right by b bits. */\
-      /* SymI_NeedsProto(__modsi3) */ \
-      SymI_NeedsProto(__moddi3) \
-      /* SymI_NeedsProto(__modti3) */ \
-      /* These functions return the remainder of the signed division of a and b. */\
-      /* SymI_NeedsProto(__mulsi3) */ \
-      SymI_NeedsProto(__muldi3) \
-      /* SymI_NeedsProto(__multi3) */ \
-      /* These functions return the product of a and b. */\
-      SymI_NeedsProto(__negdi2) \
-      /* SymI_NeedsProto(__negti2) */ \
-      /* These functions return the negation of a. */\
-      /* SymI_NeedsProto(__udivsi3) */ \
-      SymI_NeedsProto(__udivdi3) \
-      /* SymI_NeedsProto(__udivti3) */ \
-      /* These functions return the quotient of the unsigned division of a and b. */\
-      SymI_NeedsProto(__udivmoddi4) \
-      /* SymI_NeedsProto(__udivmodti4) */ \
-      /* These functions calculate both the quotient and remainder of the unsigned division of a and b. The return value is the quotient, and the remainder is placed in variable pointed to by c. */\
-      /* SymI_NeedsProto(__umodsi3) */ \
-      SymI_NeedsProto(__umoddi3) \
-      /* SymI_NeedsProto(__umodti3) */ \
-      /* These functions return the remainder of the unsigned division of a and b. */\
-      /* 4.1.2 Comparison functions */\
-      /* The following functions implement integral comparisons. These functions implement a low-level compare, upon which the higher level comparison operators (such as less than and greater than or equal to) can be constructed. The returned values lie in the range zero to two, to allow the high-level operators to be implemented by testing the returned result using either signed or unsigned comparison. */\
-      SymI_NeedsProto(__cmpdi2) \
-      /* SymI_NeedsProto(__cmpti2) */ \
-      /* These functions perform a signed comparison of a and b. If a is less than b, they return 0; if a is greater than b, they return 2; and if a and b are equal they return 1. */\
-      SymI_NeedsProto(__ucmpdi2) \
-      /* SymI_NeedsProto(__ucmpti2) */ \
-      /* These functions perform an unsigned comparison of a and b. If a is less than b, they return 0; if a is greater than b, they return 2; and if a and b are equal they return 1. */\
-      /* 4.1.3 Trapping arithmetic functions */\
-      /* The following functions implement trapping arithmetic. These functions call the libc function abort upon signed arithmetic overflow. */\
-      SymI_NeedsProto(__absvsi2) \
-      SymI_NeedsProto(__absvdi2) \
-      /* These functions return the absolute value of a. */\
-      /* SymI_NeedsProto(__addvsi3) */ \
-      SymI_NeedsProto(__addvdi3) \
-      /* These functions return the sum of a and b; that is a + b. */\
-      /* SymI_NeedsProto(__mulvsi3) */ \
-      SymI_NeedsProto(__mulvdi3) \
-      /* The functions return the product of a and b; that is a * b. */\
-      SymI_NeedsProto(__negvsi2) \
-      SymI_NeedsProto(__negvdi2) \
-      /* These functions return the negation of a; that is -a. */\
-      /* SymI_NeedsProto(__subvsi3) */ \
-      SymI_NeedsProto(__subvdi3) \
-      /* These functions return the difference between b and a; that is a - b. */\
-      /* 4.1.4 Bit operations */\
-      SymI_NeedsProto(__clzsi2) \
-      SymI_NeedsProto(__clzdi2) \
-      /* SymI_NeedsProto(__clzti2) */ \
-      /* These functions return the number of leading 0-bits in a, starting at the most significant bit position. If a is zero, the result is undefined. */\
-      SymI_NeedsProto(__ctzsi2) \
-      SymI_NeedsProto(__ctzdi2) \
-      /* SymI_NeedsProto(__ctzti2) */ \
-      /* These functions return the number of trailing 0-bits in a, starting at the least significant bit position. If a is zero, the result is undefined. */\
-      SymI_NeedsProto(__ffsdi2) \
-      /* SymI_NeedsProto(__ffsti2) */ \
-      /* These functions return the index of the least significant 1-bit in a, or the value zero if a is zero. The least significant bit is index one. */\
-      SymI_NeedsProto(__paritysi2) \
-      SymI_NeedsProto(__paritydi2) \
-      /* SymI_NeedsProto(__parityti2) */\
-      /* These functions return the value zero if the number of bits set in a is even, and the value one otherwise. */\
-      SymI_NeedsProto(__popcountsi2) \
-      SymI_NeedsProto(__popcountdi2) \
-      /* SymI_NeedsProto(__popcountti2) */ \
-      /* These functions return the number of bits set in a. */\
-      SymI_NeedsProto(__bswapsi2) \
-      SymI_NeedsProto(__bswapdi2)
-#define RTS_LIBGCC_SYMBOLS_aarch32                     \
-      /* armv6l                                      */\
-      /* TODO: should check for __ARM_EABI__         */\
-      SymI_NeedsProto(__aeabi_d2f) \
-      SymI_NeedsProto(__aeabi_d2iz) \
-      SymI_NeedsProto(__aeabi_d2lz) \
-      SymI_NeedsProto(__aeabi_d2uiz) \
-      SymI_NeedsProto(__aeabi_d2ulz) \
-      SymI_NeedsProto(__aeabi_dadd) \
-      SymI_NeedsProto(__aeabi_dcmpeq) \
-      SymI_NeedsProto(__aeabi_dcmpge) \
-      SymI_NeedsProto(__aeabi_dcmpgt) \
-      SymI_NeedsProto(__aeabi_dcmple) \
-      SymI_NeedsProto(__aeabi_dcmplt) \
-      SymI_NeedsProto(__aeabi_dcmpun) \
-      SymI_NeedsProto(__aeabi_ddiv) \
-      SymI_NeedsProto(__aeabi_dmul) \
-      SymI_NeedsProto(__aeabi_dneg) \
-      SymI_NeedsProto(__aeabi_dsub) \
-      SymI_NeedsProto(__aeabi_f2d) \
-      SymI_NeedsProto(__aeabi_f2iz) \
-      SymI_NeedsProto(__aeabi_f2lz) \
-      SymI_NeedsProto(__aeabi_f2uiz) \
-      SymI_NeedsProto(__aeabi_f2ulz) \
-      SymI_NeedsProto(__aeabi_fadd) \
-      SymI_NeedsProto(__aeabi_fcmpeq) \
-      SymI_NeedsProto(__aeabi_fcmpge) \
-      SymI_NeedsProto(__aeabi_fcmpgt) \
-      SymI_NeedsProto(__aeabi_fcmple) \
-      SymI_NeedsProto(__aeabi_fcmplt) \
-      SymI_NeedsProto(__aeabi_fcmpun) \
-      SymI_NeedsProto(__aeabi_fdiv) \
-      SymI_NeedsProto(__aeabi_fmul) \
-      SymI_NeedsProto(__aeabi_fneg) \
-      SymI_NeedsProto(__aeabi_fsub) \
-      SymI_NeedsProto(__aeabi_i2d) \
-      SymI_NeedsProto(__aeabi_i2f) \
-      SymI_NeedsProto(__aeabi_idiv) \
-      SymI_NeedsProto(__aeabi_idivmod) \
-      SymI_NeedsProto(__aeabi_l2d) \
-      SymI_NeedsProto(__aeabi_l2f) \
-      SymI_NeedsProto(__aeabi_lasr) \
-      SymI_NeedsProto(__aeabi_lcmp) \
-      SymI_NeedsProto(__aeabi_ldivmod) \
-      SymI_NeedsProto(__aeabi_llsl) \
-      SymI_NeedsProto(__aeabi_llsr) \
-      SymI_NeedsProto(__aeabi_lmul) \
-      SymI_NeedsProto(__aeabi_ui2d) \
-      SymI_NeedsProto(__aeabi_ui2f) \
-      SymI_NeedsProto(__aeabi_uidiv) \
-      SymI_NeedsProto(__aeabi_uidivmod) \
-      SymI_NeedsProto(__aeabi_ul2d) \
-      SymI_NeedsProto(__aeabi_ul2f) \
-      SymI_NeedsProto(__aeabi_ulcmp) \
-      SymI_NeedsProto(__aeabi_uldivmod)
-#define RTS_LIBGCC_SYMBOLS_64                          \
+#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
+#define RTS_LIBGCC_SYMBOLS                             \
+      SymI_NeedsProto(__divdi3)                        \
+      SymI_NeedsProto(__udivdi3)                       \
+      SymI_NeedsProto(__moddi3)                        \
+      SymI_NeedsProto(__umoddi3)                       \
+      SymI_NeedsProto(__muldi3)                        \
+      SymI_NeedsProto(__ashldi3)                       \
+      SymI_NeedsProto(__ashrdi3)                       \
+      SymI_NeedsProto(__lshrdi3)                       \
+      SymI_NeedsProto(__fixunsdfdi)
+#elif defined(__GNUC__) && SIZEOF_VOID_P == 8
+#define RTS_LIBGCC_SYMBOLS                             \
       SymI_NeedsProto(__udivti3)                       \
       SymI_NeedsProto(__umodti3)
-
-/* for aarch64                                        */
-#define RTS_LIBGCC_SYMBOLS_aarch64                     \
-      SymI_NeedsProto(__netf2)                         \
-      SymI_NeedsProto(__addtf3)                        \
-      SymI_NeedsProto(__subtf3)                        \
-      SymI_NeedsProto(__multf3)                        \
-      SymI_NeedsProto(__extenddftf2)                   \
-      SymI_NeedsProto(__fixtfsi)                       \
-      SymI_NeedsProto(__fixunstfsi)                    \
-      SymI_NeedsProto(__floatsitf)                     \
-      SymI_NeedsProto(__floatunsitf)
-
-#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && defined(arm_HOST_OS)
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_32 RTS_LIBGCC_SYMBOLS_aarch32
-#elif defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_32
-#elif defined(__GNUC__) && SIZEOF_VOID_P == 8 && defined(aarch64_HOST_OS)
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_64 RTS_LIBGCC_SYMBOLS_aarch64
-#elif defined(__GNUC__) && SIZEOF_VOID_P == 8
-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_64
 #else
 #define RTS_LIBGCC_SYMBOLS
 #endif
 
-#if !defined(mingw32_HOST_OS) && !defined(DYNAMIC) && (defined(_FORTIFY_SOURCE) || defined(__SSP__))
-#define RTS_SSP_SYMBOLS                                \
-      SymI_NeedsProto(__stack_chk_guard)               \
-      SymI_NeedsProto(__stack_chk_fail)
-#else
-#define RTS_SSP_SYMBOLS
-#endif
-#if !defined(DYNAMIC) && defined(linux_HOST_OS)
-// we need these for static musl builds. However when
-// linking shared objects (DLLs) this will fail, hence
-// we do not include them when building with -DDYNAMIC
-#define RTS_LINKER_SYMBOLS                             \
-      SymI_NeedsProto(__fini_array_start)              \
-      SymI_NeedsProto(__fini_array_end)
-#else
-#define RTS_LINKER_SYMBOLS
-#endif
-
-#if defined(darwin_HOST_OS) && defined(powerpc_HOST_ARCH)
-      // Symbols that don't have a leading underscore
-      // on Mac OS X. They have to receive special treatment,
-      // see machoInitSymbolsWithoutUnderscore()
-#define RTS_MACHO_NOUNDERLINE_SYMBOLS                   \
-      SymI_NeedsProto(saveFP)                           \
-      SymI_NeedsProto(restFP)
-#endif
-
 /* entirely bogus claims about types of these symbols */
-/* to prevent a bit of define expansion, SymI_NeedsProto is a variadic
- * macro.  And we'll concat vvv with the __VA_ARGS__. This prevents
- * vvv from getting macro expanded.
- */
-#define SymI_NeedsProto(vvv,...) extern void vvv ## __VA_ARGS__ (void);
+#define SymI_NeedsProto(vvv)  extern void vvv(void);
 #define SymI_NeedsDataProto(vvv)  extern StgWord vvv[];
 #if defined(COMPILING_WINDOWS_DLL)
 #define SymE_HasProto(vvv)    SymE_HasProto(vvv);
@@ -1209,8 +1026,6 @@ RTS_DARWIN_ONLY_SYMBOLS
 RTS_OPENBSD_ONLY_SYMBOLS
 RTS_LIBGCC_SYMBOLS
 RTS_LIBFFI_SYMBOLS
-RTS_SSP_SYMBOLS
-RTS_LINKER_SYMBOLS
 #undef SymI_NeedsProto
 #undef SymI_NeedsDataProto
 #undef SymI_HasProto
@@ -1230,7 +1045,7 @@ RTS_LINKER_SYMBOLS
 #define SymE_HasDataProto(vvv) \
                     SymE_HasProto(vvv)
 
-#define SymI_NeedsProto(vvv,...) SymI_HasProto(vvv ## __VA_ARGS__)
+#define SymI_NeedsProto(vvv) SymI_HasProto(vvv)
 #define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv)
 #define SymE_NeedsProto(vvv) SymE_HasProto(vvv)
 #define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv)
@@ -1251,8 +1066,6 @@ RTS_LINKER_SYMBOLS
 #define SymI_HasProto_deprecated(vvv)   \
    { #vvv, (void*)0xBAADF00D, true },
 
-void *RTS_DYNAMIC = NULL;
-
 RtsSymbolVal rtsSyms[] = {
       RTS_SYMBOLS
       RTS_RET_SYMBOLS
@@ -1264,14 +1077,11 @@ RtsSymbolVal rtsSyms[] = {
       RTS_LIBGCC_SYMBOLS
       RTS_LIBFFI_SYMBOLS
       SymI_HasDataProto(nonmoving_write_barrier_enabled)
-      RTS_SSP_SYMBOLS
-      RTS_LINKER_SYMBOLS
 #if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
       // dyld stub code contains references to this,
       // but it should never be called because we treat
       // lazy pointers as nonlazy.
       { "dyld_stub_binding_helper", (void*)0xDEADBEEF, false },
 #endif
-      { "_DYNAMIC", (void*)(&RTS_DYNAMIC), false },
       { 0, 0, false } /* sentinel */
 };
-- 
2.25.4