lol
1From fac083e7ac8a37b61a4082bbbca2848e52fd1bb2 Mon Sep 17 00:00:00 2001
2From: Ben Gamari <ben@smart-cactus.org>
3Date: Sun, 9 Aug 2020 09:15:16 -0400
4Subject: [PATCH] Revert "[linker/rtsSymbols] More linker symbols"
5
6This reverts commit aa2e5863699306920513b216f337de09e29b5bb8.
7---
8 rts/RtsSymbols.c | 224 ++++-------------------------------------------
9 1 file changed, 17 insertions(+), 207 deletions(-)
10
11diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
12index d10a6900db..b2f90a892d 100644
13--- a/rts/RtsSymbols.c
14+++ b/rts/RtsSymbols.c
15@@ -58,6 +58,7 @@
16 SymI_HasProto(signal_handlers) \
17 SymI_HasProto(stg_sig_install) \
18 SymI_HasProto(rtsTimerSignal) \
19+ SymI_HasProto(atexit) \
20 SymI_NeedsDataProto(nocldstop)
21 #endif
22
23@@ -976,213 +977,29 @@
24 RTS_USER_SIGNALS_SYMBOLS \
25 RTS_INTCHAR_SYMBOLS
26
27+
28 // 64-bit support functions in libgcc.a
29-// See https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc
30-#define RTS_LIBGCC_SYMBOLS_32 \
31- SymI_NeedsProto(__fixunsdfdi) \
32- /* 4 The GCC low-level runtime library */\
33- /* 4.1.1 Arithmetic functions */\
34- /* SymI_NeedsProto(__ashlsi3) */\
35- SymI_NeedsProto(__ashldi3) \
36- /* SymI_NeedsProto(__ashlti3) */\
37- /* These functions return the result of shifting a left by b bits. */\
38- /* SymI_NeedsProto(__ashrsi3) */\
39- SymI_NeedsProto(__ashrdi3) \
40- /* SymI_NeedsProto(__ashrti3) */\
41- /* These functions return the result of arithmetically shifting a right by b bits. */\
42- /* SymI_NeedsProto(__divsi3) */\
43- SymI_NeedsProto(__divdi3) \
44- /* SymI_NeedsProto(__divti3) */\
45- /* These functions return the quotient of the signed division of a and b. */\
46- /* SymI_NeedsProto(__lshrsi3) */ \
47- SymI_NeedsProto(__lshrdi3) \
48- /* SymI_NeedsProto(__lshrti3) */ \
49- /* These functions return the result of logically shifting a right by b bits. */\
50- /* SymI_NeedsProto(__modsi3) */ \
51- SymI_NeedsProto(__moddi3) \
52- /* SymI_NeedsProto(__modti3) */ \
53- /* These functions return the remainder of the signed division of a and b. */\
54- /* SymI_NeedsProto(__mulsi3) */ \
55- SymI_NeedsProto(__muldi3) \
56- /* SymI_NeedsProto(__multi3) */ \
57- /* These functions return the product of a and b. */\
58- SymI_NeedsProto(__negdi2) \
59- /* SymI_NeedsProto(__negti2) */ \
60- /* These functions return the negation of a. */\
61- /* SymI_NeedsProto(__udivsi3) */ \
62- SymI_NeedsProto(__udivdi3) \
63- /* SymI_NeedsProto(__udivti3) */ \
64- /* These functions return the quotient of the unsigned division of a and b. */\
65- SymI_NeedsProto(__udivmoddi4) \
66- /* SymI_NeedsProto(__udivmodti4) */ \
67- /* 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. */\
68- /* SymI_NeedsProto(__umodsi3) */ \
69- SymI_NeedsProto(__umoddi3) \
70- /* SymI_NeedsProto(__umodti3) */ \
71- /* These functions return the remainder of the unsigned division of a and b. */\
72- /* 4.1.2 Comparison functions */\
73- /* 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. */\
74- SymI_NeedsProto(__cmpdi2) \
75- /* SymI_NeedsProto(__cmpti2) */ \
76- /* 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. */\
77- SymI_NeedsProto(__ucmpdi2) \
78- /* SymI_NeedsProto(__ucmpti2) */ \
79- /* 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. */\
80- /* 4.1.3 Trapping arithmetic functions */\
81- /* The following functions implement trapping arithmetic. These functions call the libc function abort upon signed arithmetic overflow. */\
82- SymI_NeedsProto(__absvsi2) \
83- SymI_NeedsProto(__absvdi2) \
84- /* These functions return the absolute value of a. */\
85- /* SymI_NeedsProto(__addvsi3) */ \
86- SymI_NeedsProto(__addvdi3) \
87- /* These functions return the sum of a and b; that is a + b. */\
88- /* SymI_NeedsProto(__mulvsi3) */ \
89- SymI_NeedsProto(__mulvdi3) \
90- /* The functions return the product of a and b; that is a * b. */\
91- SymI_NeedsProto(__negvsi2) \
92- SymI_NeedsProto(__negvdi2) \
93- /* These functions return the negation of a; that is -a. */\
94- /* SymI_NeedsProto(__subvsi3) */ \
95- SymI_NeedsProto(__subvdi3) \
96- /* These functions return the difference between b and a; that is a - b. */\
97- /* 4.1.4 Bit operations */\
98- SymI_NeedsProto(__clzsi2) \
99- SymI_NeedsProto(__clzdi2) \
100- /* SymI_NeedsProto(__clzti2) */ \
101- /* 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. */\
102- SymI_NeedsProto(__ctzsi2) \
103- SymI_NeedsProto(__ctzdi2) \
104- /* SymI_NeedsProto(__ctzti2) */ \
105- /* 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. */\
106- SymI_NeedsProto(__ffsdi2) \
107- /* SymI_NeedsProto(__ffsti2) */ \
108- /* 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. */\
109- SymI_NeedsProto(__paritysi2) \
110- SymI_NeedsProto(__paritydi2) \
111- /* SymI_NeedsProto(__parityti2) */\
112- /* These functions return the value zero if the number of bits set in a is even, and the value one otherwise. */\
113- SymI_NeedsProto(__popcountsi2) \
114- SymI_NeedsProto(__popcountdi2) \
115- /* SymI_NeedsProto(__popcountti2) */ \
116- /* These functions return the number of bits set in a. */\
117- SymI_NeedsProto(__bswapsi2) \
118- SymI_NeedsProto(__bswapdi2)
119-#define RTS_LIBGCC_SYMBOLS_aarch32 \
120- /* armv6l */\
121- /* TODO: should check for __ARM_EABI__ */\
122- SymI_NeedsProto(__aeabi_d2f) \
123- SymI_NeedsProto(__aeabi_d2iz) \
124- SymI_NeedsProto(__aeabi_d2lz) \
125- SymI_NeedsProto(__aeabi_d2uiz) \
126- SymI_NeedsProto(__aeabi_d2ulz) \
127- SymI_NeedsProto(__aeabi_dadd) \
128- SymI_NeedsProto(__aeabi_dcmpeq) \
129- SymI_NeedsProto(__aeabi_dcmpge) \
130- SymI_NeedsProto(__aeabi_dcmpgt) \
131- SymI_NeedsProto(__aeabi_dcmple) \
132- SymI_NeedsProto(__aeabi_dcmplt) \
133- SymI_NeedsProto(__aeabi_dcmpun) \
134- SymI_NeedsProto(__aeabi_ddiv) \
135- SymI_NeedsProto(__aeabi_dmul) \
136- SymI_NeedsProto(__aeabi_dneg) \
137- SymI_NeedsProto(__aeabi_dsub) \
138- SymI_NeedsProto(__aeabi_f2d) \
139- SymI_NeedsProto(__aeabi_f2iz) \
140- SymI_NeedsProto(__aeabi_f2lz) \
141- SymI_NeedsProto(__aeabi_f2uiz) \
142- SymI_NeedsProto(__aeabi_f2ulz) \
143- SymI_NeedsProto(__aeabi_fadd) \
144- SymI_NeedsProto(__aeabi_fcmpeq) \
145- SymI_NeedsProto(__aeabi_fcmpge) \
146- SymI_NeedsProto(__aeabi_fcmpgt) \
147- SymI_NeedsProto(__aeabi_fcmple) \
148- SymI_NeedsProto(__aeabi_fcmplt) \
149- SymI_NeedsProto(__aeabi_fcmpun) \
150- SymI_NeedsProto(__aeabi_fdiv) \
151- SymI_NeedsProto(__aeabi_fmul) \
152- SymI_NeedsProto(__aeabi_fneg) \
153- SymI_NeedsProto(__aeabi_fsub) \
154- SymI_NeedsProto(__aeabi_i2d) \
155- SymI_NeedsProto(__aeabi_i2f) \
156- SymI_NeedsProto(__aeabi_idiv) \
157- SymI_NeedsProto(__aeabi_idivmod) \
158- SymI_NeedsProto(__aeabi_l2d) \
159- SymI_NeedsProto(__aeabi_l2f) \
160- SymI_NeedsProto(__aeabi_lasr) \
161- SymI_NeedsProto(__aeabi_lcmp) \
162- SymI_NeedsProto(__aeabi_ldivmod) \
163- SymI_NeedsProto(__aeabi_llsl) \
164- SymI_NeedsProto(__aeabi_llsr) \
165- SymI_NeedsProto(__aeabi_lmul) \
166- SymI_NeedsProto(__aeabi_ui2d) \
167- SymI_NeedsProto(__aeabi_ui2f) \
168- SymI_NeedsProto(__aeabi_uidiv) \
169- SymI_NeedsProto(__aeabi_uidivmod) \
170- SymI_NeedsProto(__aeabi_ul2d) \
171- SymI_NeedsProto(__aeabi_ul2f) \
172- SymI_NeedsProto(__aeabi_ulcmp) \
173- SymI_NeedsProto(__aeabi_uldivmod)
174-#define RTS_LIBGCC_SYMBOLS_64 \
175+#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
176+#define RTS_LIBGCC_SYMBOLS \
177+ SymI_NeedsProto(__divdi3) \
178+ SymI_NeedsProto(__udivdi3) \
179+ SymI_NeedsProto(__moddi3) \
180+ SymI_NeedsProto(__umoddi3) \
181+ SymI_NeedsProto(__muldi3) \
182+ SymI_NeedsProto(__ashldi3) \
183+ SymI_NeedsProto(__ashrdi3) \
184+ SymI_NeedsProto(__lshrdi3) \
185+ SymI_NeedsProto(__fixunsdfdi)
186+#elif defined(__GNUC__) && SIZEOF_VOID_P == 8
187+#define RTS_LIBGCC_SYMBOLS \
188 SymI_NeedsProto(__udivti3) \
189 SymI_NeedsProto(__umodti3)
190-
191-/* for aarch64 */
192-#define RTS_LIBGCC_SYMBOLS_aarch64 \
193- SymI_NeedsProto(__netf2) \
194- SymI_NeedsProto(__addtf3) \
195- SymI_NeedsProto(__subtf3) \
196- SymI_NeedsProto(__multf3) \
197- SymI_NeedsProto(__extenddftf2) \
198- SymI_NeedsProto(__fixtfsi) \
199- SymI_NeedsProto(__fixunstfsi) \
200- SymI_NeedsProto(__floatsitf) \
201- SymI_NeedsProto(__floatunsitf)
202-
203-#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && defined(arm_HOST_OS)
204-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_32 RTS_LIBGCC_SYMBOLS_aarch32
205-#elif defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
206-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_32
207-#elif defined(__GNUC__) && SIZEOF_VOID_P == 8 && defined(aarch64_HOST_OS)
208-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_64 RTS_LIBGCC_SYMBOLS_aarch64
209-#elif defined(__GNUC__) && SIZEOF_VOID_P == 8
210-#define RTS_LIBGCC_SYMBOLS RTS_LIBGCC_SYMBOLS_64
211 #else
212 #define RTS_LIBGCC_SYMBOLS
213 #endif
214
215-#if !defined(mingw32_HOST_OS) && !defined(DYNAMIC) && (defined(_FORTIFY_SOURCE) || defined(__SSP__))
216-#define RTS_SSP_SYMBOLS \
217- SymI_NeedsProto(__stack_chk_guard) \
218- SymI_NeedsProto(__stack_chk_fail)
219-#else
220-#define RTS_SSP_SYMBOLS
221-#endif
222-#if !defined(DYNAMIC) && defined(linux_HOST_OS)
223-// we need these for static musl builds. However when
224-// linking shared objects (DLLs) this will fail, hence
225-// we do not include them when building with -DDYNAMIC
226-#define RTS_LINKER_SYMBOLS \
227- SymI_NeedsProto(__fini_array_start) \
228- SymI_NeedsProto(__fini_array_end)
229-#else
230-#define RTS_LINKER_SYMBOLS
231-#endif
232-
233-#if defined(darwin_HOST_OS) && defined(powerpc_HOST_ARCH)
234- // Symbols that don't have a leading underscore
235- // on Mac OS X. They have to receive special treatment,
236- // see machoInitSymbolsWithoutUnderscore()
237-#define RTS_MACHO_NOUNDERLINE_SYMBOLS \
238- SymI_NeedsProto(saveFP) \
239- SymI_NeedsProto(restFP)
240-#endif
241-
242 /* entirely bogus claims about types of these symbols */
243-/* to prevent a bit of define expansion, SymI_NeedsProto is a variadic
244- * macro. And we'll concat vvv with the __VA_ARGS__. This prevents
245- * vvv from getting macro expanded.
246- */
247-#define SymI_NeedsProto(vvv,...) extern void vvv ## __VA_ARGS__ (void);
248+#define SymI_NeedsProto(vvv) extern void vvv(void);
249 #define SymI_NeedsDataProto(vvv) extern StgWord vvv[];
250 #if defined(COMPILING_WINDOWS_DLL)
251 #define SymE_HasProto(vvv) SymE_HasProto(vvv);
252@@ -1209,8 +1026,6 @@ RTS_DARWIN_ONLY_SYMBOLS
253 RTS_OPENBSD_ONLY_SYMBOLS
254 RTS_LIBGCC_SYMBOLS
255 RTS_LIBFFI_SYMBOLS
256-RTS_SSP_SYMBOLS
257-RTS_LINKER_SYMBOLS
258 #undef SymI_NeedsProto
259 #undef SymI_NeedsDataProto
260 #undef SymI_HasProto
261@@ -1230,7 +1045,7 @@ RTS_LINKER_SYMBOLS
262 #define SymE_HasDataProto(vvv) \
263 SymE_HasProto(vvv)
264
265-#define SymI_NeedsProto(vvv,...) SymI_HasProto(vvv ## __VA_ARGS__)
266+#define SymI_NeedsProto(vvv) SymI_HasProto(vvv)
267 #define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv)
268 #define SymE_NeedsProto(vvv) SymE_HasProto(vvv)
269 #define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv)
270@@ -1251,8 +1066,6 @@ RTS_LINKER_SYMBOLS
271 #define SymI_HasProto_deprecated(vvv) \
272 { #vvv, (void*)0xBAADF00D, true },
273
274-void *RTS_DYNAMIC = NULL;
275-
276 RtsSymbolVal rtsSyms[] = {
277 RTS_SYMBOLS
278 RTS_RET_SYMBOLS
279@@ -1264,14 +1077,11 @@ RtsSymbolVal rtsSyms[] = {
280 RTS_LIBGCC_SYMBOLS
281 RTS_LIBFFI_SYMBOLS
282 SymI_HasDataProto(nonmoving_write_barrier_enabled)
283- RTS_SSP_SYMBOLS
284- RTS_LINKER_SYMBOLS
285 #if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
286 // dyld stub code contains references to this,
287 // but it should never be called because we treat
288 // lazy pointers as nonlazy.
289 { "dyld_stub_binding_helper", (void*)0xDEADBEEF, false },
290 #endif
291- { "_DYNAMIC", (void*)(&RTS_DYNAMIC), false },
292 { 0, 0, false } /* sentinel */
293 };
294--
2952.25.4
296