Merge non-moving garbage collector
[ghc.git] / rts / RtsSymbols.c
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2000-2015
4 *
5 * RTS Symbols
6 *
7 * ---------------------------------------------------------------------------*/
8
9 #include "ghcplatform.h"
10 #include "RtsSymbols.h"
11
12 #include "Rts.h"
13 #include "TopHandler.h"
14 #include "HsFFI.h"
15
16 #include "sm/Storage.h"
17 #include "sm/NonMovingMark.h"
18 #include <stdbool.h>
19
20 #if !defined(mingw32_HOST_OS)
21 #include "posix/Signals.h"
22 #endif
23
24 #if defined(mingw32_HOST_OS)
25 #include <sys/stat.h>
26 #include <io.h>
27 #include <windows.h>
28 #include <shfolder.h> /* SHGetFolderPathW */
29 #endif
30
31 #if defined(openbsd_HOST_OS)
32 #include <elf.h> /* _DYNAMIC */
33 #endif
34
35 /* -----------------------------------------------------------------------------
36 * Symbols to be inserted into the RTS symbol table.
37 */
38
39 #define Maybe_Stable_Names SymI_HasProto(stg_mkWeakzh) \
40 SymI_HasProto(stg_mkWeakNoFinalizzerzh) \
41 SymI_HasProto(stg_addCFinalizzerToWeakzh) \
42 SymI_HasProto(stg_makeStableNamezh) \
43 SymI_HasProto(stg_finalizzeWeakzh)
44
45 #define RTS_LIBDW_SYMBOLS \
46 SymE_HasProto(backtraceFree) \
47 SymE_HasProto(libdwGetBacktrace) \
48 SymE_HasProto(libdwLookupLocation) \
49 SymE_HasProto(libdwPoolTake) \
50 SymE_HasProto(libdwPoolRelease) \
51 SymE_HasProto(libdwPoolClear)
52
53 #if !defined(mingw32_HOST_OS)
54 #define RTS_POSIX_ONLY_SYMBOLS \
55 SymI_HasProto(__hscore_get_saved_termios) \
56 SymI_HasProto(__hscore_set_saved_termios) \
57 SymI_HasProto(shutdownHaskellAndSignal) \
58 SymI_HasProto(signal_handlers) \
59 SymI_HasProto(stg_sig_install) \
60 SymI_HasProto(rtsTimerSignal) \
61 SymI_HasProto(atexit) \
62 SymI_NeedsDataProto(nocldstop)
63 #endif
64
65 #if defined(mingw32_HOST_OS)
66 #define RTS_POSIX_ONLY_SYMBOLS /**/
67
68 #if defined(i386_HOST_ARCH)
69 #define RTS_WIN32_ONLY(X) X
70 #else
71 #define RTS_WIN32_ONLY(X) /**/
72 #endif
73
74 #if defined(x86_64_HOST_ARCH)
75 #define RTS_WIN64_ONLY(X) X
76 #else
77 #define RTS_WIN64_ONLY(X) /**/
78 #endif
79
80 /*
81 * Note [Symbols for MinGW's printf]
82 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83 *
84 * The printf offered by Microsoft's libc implementation, msvcrt, is quite
85 * incomplete, lacking support for even %ull. Consequently mingw-w64 offers its
86 * own implementation which we enable. However, to be thread-safe the
87 * implementation uses _lock_file. This would be fine except msvcrt.dll doesn't
88 * export _lock_file, only numbered versions do (e.g. msvcrt90.dll).
89 *
90 * To work around this mingw-w64 packages a static archive of msvcrt which
91 * includes their own implementation of _lock_file. However, this means that
92 * the archive contains things which the dynamic library does not; consequently
93 * we need to ensure that the runtime linker provides this symbol.
94 *
95 * It's all just so terrible.
96 *
97 * See also:
98 * https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/
99 * https://sourceforge.net/p/mingw-w64/discussion/723797/thread/55520785/
100 */
101 /* Note [_iob_func symbol]
102 * ~~~~~~~~~~~~~~~~~~~~~~~
103 *
104 * Microsoft in VS2013 to VS2015 transition made a backwards incompatible change
105 * to the stdio function __iob_func.
106 *
107 * They used to be defined as:
108 *
109 * #define stdin (&__iob_func()[0])
110 * #define stdout (&__iob_func()[1])
111 * #define stderr (&__iob_func()[2])
112 *
113 * whereas now they're defined as:
114 *
115 * #define stdin (__acrt_iob_func(0))
116 * #define stdout (__acrt_iob_func(1))
117 * #define stderr (__acrt_iob_func(2))
118 *
119 * Mingw-w64 followed along with the madness and so we have to deal with both
120 * version of these symbols.
121 *
122 * As such when you mix new and old libraries you get a missing symbols error
123 * for __acrt_iob_func. It then links against the PLT for the function but that
124 * no longer exists. Instead we forward the request for the PLT symbol to the
125 * symbol directly which is defined inline since we're using a newer compiler.
126 *
127 * See also:
128 * https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-change-history-2003-2015?view=vs-2017#stdioh-and-conioh
129 */
130 #define RTS_MINGW_ONLY_SYMBOLS \
131 SymI_HasProto(stg_asyncReadzh) \
132 SymI_HasProto(stg_asyncWritezh) \
133 SymI_HasProto(stg_asyncDoProczh) \
134 SymI_HasProto(rts_InstallConsoleEvent) \
135 SymI_HasProto(rts_ConsoleHandlerDone) \
136 SymI_HasProto(atexit) \
137 RTS_WIN32_ONLY(SymI_NeedsProto(__chkstk_ms)) \
138 RTS_WIN64_ONLY(SymI_NeedsProto(___chkstk_ms)) \
139 RTS_WIN32_ONLY(SymI_HasProto(_imp___environ)) \
140 RTS_WIN64_ONLY(SymI_HasProto(__imp__environ)) \
141 RTS_WIN32_ONLY(SymI_HasProto(_imp___iob)) \
142 RTS_WIN64_ONLY(SymI_HasProto(__iob_func)) \
143 /* see Note [Symbols for MinGW's printf] */ \
144 SymI_HasProto(_lock_file) \
145 SymI_HasProto(_unlock_file) \
146 /* See Note [_iob_func symbol] */ \
147 RTS_WIN64_ONLY(SymI_HasProto_redirect( \
148 __imp___acrt_iob_func, __rts_iob_func, true)) \
149 RTS_WIN32_ONLY(SymI_HasProto_redirect( \
150 __imp____acrt_iob_func, __rts_iob_func, true))
151
152 #define RTS_MINGW_COMPAT_SYMBOLS \
153 SymI_HasProto_deprecated(access) \
154 SymI_HasProto_deprecated(cabs) \
155 SymI_HasProto_deprecated(cgets) \
156 SymI_HasProto_deprecated(chdir) \
157 SymI_HasProto_deprecated(chmod) \
158 SymI_HasProto_deprecated(chsize) \
159 SymI_HasProto_deprecated(close) \
160 SymI_HasProto_deprecated(cprintf) \
161 SymI_HasProto_deprecated(cputs) \
162 SymI_HasProto_deprecated(creat) \
163 SymI_HasProto_deprecated(cscanf) \
164 SymI_HasProto_deprecated(cwait) \
165 SymI_HasProto_deprecated(dup) \
166 SymI_HasProto_deprecated(dup2) \
167 SymI_HasProto_deprecated(ecvt) \
168 SymI_HasProto_deprecated(eof) \
169 SymI_HasProto_deprecated(execl) \
170 SymI_HasProto_deprecated(execle) \
171 SymI_HasProto_deprecated(execlp) \
172 SymI_HasProto_deprecated(execlpe) \
173 SymI_HasProto_deprecated(execv) \
174 SymI_HasProto_deprecated(execve) \
175 SymI_HasProto_deprecated(execvp) \
176 SymI_HasProto_deprecated(execvpe) \
177 SymI_HasProto_deprecated(fcloseall) \
178 SymI_HasProto_deprecated(fcvt) \
179 SymI_HasProto_deprecated(fdopen) \
180 SymI_HasProto_deprecated(fgetchar) \
181 SymI_HasProto_deprecated(filelength) \
182 SymI_HasProto_deprecated(fileno) \
183 SymI_HasProto_deprecated(flushall) \
184 SymI_HasProto_deprecated(fputchar) \
185 SymI_HasProto_deprecated(gcvt) \
186 SymI_HasProto_deprecated(getch) \
187 SymI_HasProto_deprecated(getche) \
188 SymI_HasProto_deprecated(getcwd) \
189 SymI_HasProto_deprecated(getpid) \
190 SymI_HasProto_deprecated(getw) \
191 SymI_HasProto_deprecated(hypot) \
192 SymI_HasProto_deprecated(inp) \
193 SymI_HasProto_deprecated(inpw) \
194 SymI_HasProto_deprecated(isascii) \
195 SymI_HasProto_deprecated(isatty) \
196 SymI_HasProto_deprecated(iscsym) \
197 SymI_HasProto_deprecated(iscsymf) \
198 SymI_HasProto_deprecated(itoa) \
199 SymI_HasProto_deprecated(j0) \
200 SymI_HasProto_deprecated(j1) \
201 SymI_HasProto_deprecated(jn) \
202 SymI_HasProto_deprecated(kbhit) \
203 SymI_HasProto_deprecated(lfind) \
204 SymI_HasProto_deprecated(locking) \
205 SymI_HasProto_deprecated(lsearch) \
206 SymI_HasProto_deprecated(lseek) \
207 SymI_HasProto_deprecated(ltoa) \
208 SymI_HasProto_deprecated(memccpy) \
209 SymI_HasProto_deprecated(memicmp) \
210 SymI_HasProto_deprecated(mkdir) \
211 SymI_HasProto_deprecated(mktemp) \
212 SymI_HasProto_deprecated(open) \
213 SymI_HasProto_deprecated(outp) \
214 SymI_HasProto_deprecated(outpw) \
215 SymI_HasProto_deprecated(putch) \
216 SymI_HasProto_deprecated(putenv) \
217 SymI_HasProto_deprecated(putw) \
218 SymI_HasProto_deprecated(read) \
219 SymI_HasProto_deprecated(rmdir) \
220 SymI_HasProto_deprecated(rmtmp) \
221 SymI_HasProto_deprecated(setmode) \
222 SymI_HasProto_deprecated(sopen) \
223 SymI_HasProto_deprecated(spawnl) \
224 SymI_HasProto_deprecated(spawnle) \
225 SymI_HasProto_deprecated(spawnlp) \
226 SymI_HasProto_deprecated(spawnlpe) \
227 SymI_HasProto_deprecated(spawnv) \
228 SymI_HasProto_deprecated(spawnve) \
229 SymI_HasProto_deprecated(spawnvp) \
230 SymI_HasProto_deprecated(spawnvpe) \
231 SymI_HasProto_deprecated(strcmpi) \
232 SymI_HasProto_deprecated(strdup) \
233 SymI_HasProto_deprecated(stricmp) \
234 SymI_HasProto_deprecated(strlwr) \
235 SymI_HasProto_deprecated(strnicmp) \
236 SymI_HasProto_deprecated(strnset) \
237 SymI_HasProto_deprecated(strrev) \
238 SymI_HasProto_deprecated(strset) \
239 SymI_HasProto_deprecated(strupr) \
240 SymI_HasProto_deprecated(swab) \
241 SymI_HasProto_deprecated(tell) \
242 SymI_HasProto_deprecated(tempnam) \
243 SymI_HasProto_deprecated(toascii) \
244 SymI_HasProto_deprecated(tzset) \
245 SymI_HasProto_deprecated(ultoa) \
246 SymI_HasProto_deprecated(umask) \
247 SymI_HasProto_deprecated(ungetch) \
248 SymI_HasProto_deprecated(unlink) \
249 SymI_HasProto_deprecated(wcsdup) \
250 SymI_HasProto_deprecated(wcsicmp) \
251 SymI_HasProto_deprecated(wcsicoll) \
252 SymI_HasProto_deprecated(wcslwr) \
253 SymI_HasProto_deprecated(wcsnicmp) \
254 SymI_HasProto_deprecated(wcsnset) \
255 SymI_HasProto_deprecated(wcsrev) \
256 SymI_HasProto_deprecated(wcsset) \
257 SymI_HasProto_deprecated(wcsupr) \
258 SymI_HasProto_deprecated(write) \
259 SymI_HasProto_deprecated(y0) \
260 SymI_HasProto_deprecated(y1) \
261 SymI_HasProto_deprecated(yn)
262 #else
263 #define RTS_MINGW_ONLY_SYMBOLS /**/
264 #define RTS_MINGW_COMPAT_SYMBOLS /**/
265 #endif
266
267
268 #if defined(darwin_HOST_OS) && HAVE_PRINTF_LDBLSTUB
269 #define RTS_DARWIN_ONLY_SYMBOLS \
270 SymI_NeedsProto(asprintf$LDBLStub) \
271 SymI_NeedsProto(err$LDBLStub) \
272 SymI_NeedsProto(errc$LDBLStub) \
273 SymI_NeedsProto(errx$LDBLStub) \
274 SymI_NeedsProto(fprintf$LDBLStub) \
275 SymI_NeedsProto(fscanf$LDBLStub) \
276 SymI_NeedsProto(fwprintf$LDBLStub) \
277 SymI_NeedsProto(fwscanf$LDBLStub) \
278 SymI_NeedsProto(printf$LDBLStub) \
279 SymI_NeedsProto(scanf$LDBLStub) \
280 SymI_NeedsProto(snprintf$LDBLStub) \
281 SymI_NeedsProto(sprintf$LDBLStub) \
282 SymI_NeedsProto(sscanf$LDBLStub) \
283 SymI_NeedsProto(strtold$LDBLStub) \
284 SymI_NeedsProto(swprintf$LDBLStub) \
285 SymI_NeedsProto(swscanf$LDBLStub) \
286 SymI_NeedsProto(syslog$LDBLStub) \
287 SymI_NeedsProto(vasprintf$LDBLStub) \
288 SymI_NeedsProto(verr$LDBLStub) \
289 SymI_NeedsProto(verrc$LDBLStub) \
290 SymI_NeedsProto(verrx$LDBLStub) \
291 SymI_NeedsProto(vfprintf$LDBLStub) \
292 SymI_NeedsProto(vfscanf$LDBLStub) \
293 SymI_NeedsProto(vfwprintf$LDBLStub) \
294 SymI_NeedsProto(vfwscanf$LDBLStub) \
295 SymI_NeedsProto(vprintf$LDBLStub) \
296 SymI_NeedsProto(vscanf$LDBLStub) \
297 SymI_NeedsProto(vsnprintf$LDBLStub) \
298 SymI_NeedsProto(vsprintf$LDBLStub) \
299 SymI_NeedsProto(vsscanf$LDBLStub) \
300 SymI_NeedsProto(vswprintf$LDBLStub) \
301 SymI_NeedsProto(vswscanf$LDBLStub) \
302 SymI_NeedsProto(vsyslog$LDBLStub) \
303 SymI_NeedsProto(vwarn$LDBLStub) \
304 SymI_NeedsProto(vwarnc$LDBLStub) \
305 SymI_NeedsProto(vwarnx$LDBLStub) \
306 SymI_NeedsProto(vwprintf$LDBLStub) \
307 SymI_NeedsProto(vwscanf$LDBLStub) \
308 SymI_NeedsProto(warn$LDBLStub) \
309 SymI_NeedsProto(warnc$LDBLStub) \
310 SymI_NeedsProto(warnx$LDBLStub) \
311 SymI_NeedsProto(wcstold$LDBLStub) \
312 SymI_NeedsProto(wprintf$LDBLStub) \
313 SymI_NeedsProto(wscanf$LDBLStub)
314 #else
315 #define RTS_DARWIN_ONLY_SYMBOLS
316 #endif
317
318 #if defined(openbsd_HOST_OS)
319 #define RTS_OPENBSD_ONLY_SYMBOLS \
320 SymE_NeedsProto(__guard_local) \
321 SymE_HasProto(_DYNAMIC)
322 #else
323 #define RTS_OPENBSD_ONLY_SYMBOLS
324 #endif
325
326 #if !defined(SMP)
327 # define MAIN_CAP_SYM SymI_HasProto(MainCapability)
328 #else
329 # define MAIN_CAP_SYM
330 #endif
331
332 #if !defined(mingw32_HOST_OS)
333 #define RTS_USER_SIGNALS_SYMBOLS \
334 SymI_HasProto(setIOManagerControlFd) \
335 SymI_HasProto(setTimerManagerControlFd) \
336 SymI_HasProto(setIOManagerWakeupFd) \
337 SymI_HasProto(ioManagerWakeup) \
338 SymI_HasProto(blockUserSignals) \
339 SymI_HasProto(unblockUserSignals)
340 #else
341 #define RTS_USER_SIGNALS_SYMBOLS \
342 SymI_HasProto(ioManagerWakeup) \
343 SymI_HasProto(sendIOManagerEvent) \
344 SymI_HasProto(readIOManagerEvent) \
345 SymI_HasProto(getIOManagerEvent) \
346 SymI_HasProto(console_handler)
347 #endif
348
349 #define RTS_LIBFFI_SYMBOLS \
350 SymE_NeedsProto(ffi_prep_cif) \
351 SymE_NeedsProto(ffi_call) \
352 SymE_NeedsDataProto(ffi_type_void) \
353 SymE_NeedsDataProto(ffi_type_float) \
354 SymE_NeedsDataProto(ffi_type_double) \
355 SymE_NeedsDataProto(ffi_type_sint64) \
356 SymE_NeedsDataProto(ffi_type_uint64) \
357 SymE_NeedsDataProto(ffi_type_sint32) \
358 SymE_NeedsDataProto(ffi_type_uint32) \
359 SymE_NeedsDataProto(ffi_type_sint16) \
360 SymE_NeedsDataProto(ffi_type_uint16) \
361 SymE_NeedsDataProto(ffi_type_sint8) \
362 SymE_NeedsDataProto(ffi_type_uint8) \
363 SymE_NeedsDataProto(ffi_type_pointer)
364
365 #if defined(TABLES_NEXT_TO_CODE)
366 #define RTS_RET_SYMBOLS /* nothing */
367 #else
368 #define RTS_RET_SYMBOLS \
369 SymI_HasProto(stg_enter_ret) \
370 SymI_HasProto(stg_gc_fun_ret) \
371 SymI_HasProto(stg_ap_v_ret) \
372 SymI_HasProto(stg_ap_f_ret) \
373 SymI_HasProto(stg_ap_d_ret) \
374 SymI_HasProto(stg_ap_l_ret) \
375 SymI_HasProto(stg_ap_v16_ret) \
376 SymI_HasProto(stg_ap_v32_ret) \
377 SymI_HasProto(stg_ap_v64_ret) \
378 SymI_HasProto(stg_ap_n_ret) \
379 SymI_HasProto(stg_ap_p_ret) \
380 SymI_HasProto(stg_ap_pv_ret) \
381 SymI_HasProto(stg_ap_pp_ret) \
382 SymI_HasProto(stg_ap_ppv_ret) \
383 SymI_HasProto(stg_ap_ppp_ret) \
384 SymI_HasProto(stg_ap_pppv_ret) \
385 SymI_HasProto(stg_ap_pppp_ret) \
386 SymI_HasProto(stg_ap_ppppp_ret) \
387 SymI_HasProto(stg_ap_pppppp_ret)
388 #endif
389
390 /* Modules compiled with -ticky may mention ticky counters */
391 /* This list should marry up with the one in $(TOP)/includes/stg/Ticky.h */
392 #define RTS_TICKY_SYMBOLS \
393 SymI_NeedsDataProto(ticky_entry_ctrs) \
394 SymI_NeedsDataProto(top_ct) \
395 \
396 SymI_HasProto(ENT_VIA_NODE_ctr) \
397 SymI_HasProto(ENT_STATIC_THK_SINGLE_ctr) \
398 SymI_HasProto(ENT_STATIC_THK_MANY_ctr) \
399 SymI_HasProto(ENT_DYN_THK_SINGLE_ctr) \
400 SymI_HasProto(ENT_DYN_THK_MANY_ctr) \
401 SymI_HasProto(ENT_STATIC_FUN_DIRECT_ctr) \
402 SymI_HasProto(ENT_DYN_FUN_DIRECT_ctr) \
403 SymI_HasProto(ENT_STATIC_CON_ctr) \
404 SymI_HasProto(ENT_DYN_CON_ctr) \
405 SymI_HasProto(ENT_STATIC_IND_ctr) \
406 SymI_HasProto(ENT_DYN_IND_ctr) \
407 SymI_HasProto(ENT_PERM_IND_ctr) \
408 SymI_HasProto(ENT_PAP_ctr) \
409 SymI_HasProto(ENT_AP_ctr) \
410 SymI_HasProto(ENT_AP_STACK_ctr) \
411 SymI_HasProto(ENT_BH_ctr) \
412 SymI_HasProto(ENT_LNE_ctr) \
413 SymI_HasProto(UNKNOWN_CALL_ctr) \
414 SymI_HasProto(SLOW_CALL_fast_v16_ctr) \
415 SymI_HasProto(SLOW_CALL_fast_v_ctr) \
416 SymI_HasProto(SLOW_CALL_fast_f_ctr) \
417 SymI_HasProto(SLOW_CALL_fast_d_ctr) \
418 SymI_HasProto(SLOW_CALL_fast_l_ctr) \
419 SymI_HasProto(SLOW_CALL_fast_n_ctr) \
420 SymI_HasProto(SLOW_CALL_fast_p_ctr) \
421 SymI_HasProto(SLOW_CALL_fast_pv_ctr) \
422 SymI_HasProto(SLOW_CALL_fast_pp_ctr) \
423 SymI_HasProto(SLOW_CALL_fast_ppv_ctr) \
424 SymI_HasProto(SLOW_CALL_fast_ppp_ctr) \
425 SymI_HasProto(SLOW_CALL_fast_pppv_ctr) \
426 SymI_HasProto(SLOW_CALL_fast_pppp_ctr) \
427 SymI_HasProto(SLOW_CALL_fast_ppppp_ctr) \
428 SymI_HasProto(SLOW_CALL_fast_pppppp_ctr) \
429 SymI_HasProto(VERY_SLOW_CALL_ctr) \
430 SymI_HasProto(ticky_slow_call_unevald) \
431 SymI_HasProto(SLOW_CALL_ctr) \
432 SymI_HasProto(MULTI_CHUNK_SLOW_CALL_ctr) \
433 SymI_HasProto(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr) \
434 SymI_HasProto(KNOWN_CALL_ctr) \
435 SymI_HasProto(KNOWN_CALL_TOO_FEW_ARGS_ctr) \
436 SymI_HasProto(KNOWN_CALL_EXTRA_ARGS_ctr) \
437 SymI_HasProto(SLOW_CALL_FUN_TOO_FEW_ctr) \
438 SymI_HasProto(SLOW_CALL_FUN_CORRECT_ctr) \
439 SymI_HasProto(SLOW_CALL_FUN_TOO_MANY_ctr) \
440 SymI_HasProto(SLOW_CALL_PAP_TOO_FEW_ctr) \
441 SymI_HasProto(SLOW_CALL_PAP_CORRECT_ctr) \
442 SymI_HasProto(SLOW_CALL_PAP_TOO_MANY_ctr) \
443 SymI_HasProto(SLOW_CALL_UNEVALD_ctr) \
444 SymI_HasProto(UPDF_OMITTED_ctr) \
445 SymI_HasProto(UPDF_PUSHED_ctr) \
446 SymI_HasProto(CATCHF_PUSHED_ctr) \
447 SymI_HasProto(UPDF_RCC_PUSHED_ctr) \
448 SymI_HasProto(UPDF_RCC_OMITTED_ctr) \
449 SymI_HasProto(UPD_SQUEEZED_ctr) \
450 SymI_HasProto(UPD_CON_IN_NEW_ctr) \
451 SymI_HasProto(UPD_CON_IN_PLACE_ctr) \
452 SymI_HasProto(UPD_PAP_IN_NEW_ctr) \
453 SymI_HasProto(UPD_PAP_IN_PLACE_ctr) \
454 SymI_HasProto(ALLOC_HEAP_ctr) \
455 SymI_HasProto(ALLOC_HEAP_tot) \
456 SymI_HasProto(HEAP_CHK_ctr) \
457 SymI_HasProto(STK_CHK_ctr) \
458 SymI_HasProto(ALLOC_RTS_ctr) \
459 SymI_HasProto(ALLOC_RTS_tot) \
460 SymI_HasProto(ALLOC_FUN_ctr) \
461 SymI_HasProto(ALLOC_FUN_adm) \
462 SymI_HasProto(ALLOC_FUN_gds) \
463 SymI_HasProto(ALLOC_FUN_slp) \
464 SymI_HasProto(UPD_NEW_IND_ctr) \
465 SymI_HasProto(UPD_NEW_PERM_IND_ctr) \
466 SymI_HasProto(UPD_OLD_IND_ctr) \
467 SymI_HasProto(UPD_OLD_PERM_IND_ctr) \
468 SymI_HasProto(UPD_CAF_BH_UPDATABLE_ctr) \
469 SymI_HasProto(UPD_CAF_BH_SINGLE_ENTRY_ctr) \
470 SymI_HasProto(GC_SEL_ABANDONED_ctr) \
471 SymI_HasProto(GC_SEL_MINOR_ctr) \
472 SymI_HasProto(GC_SEL_MAJOR_ctr) \
473 SymI_HasProto(GC_FAILED_PROMOTION_ctr) \
474 SymI_HasProto(ALLOC_UP_THK_ctr) \
475 SymI_HasProto(ALLOC_SE_THK_ctr) \
476 SymI_HasProto(ALLOC_THK_adm) \
477 SymI_HasProto(ALLOC_THK_gds) \
478 SymI_HasProto(ALLOC_THK_slp) \
479 SymI_HasProto(ALLOC_CON_ctr) \
480 SymI_HasProto(ALLOC_CON_adm) \
481 SymI_HasProto(ALLOC_CON_gds) \
482 SymI_HasProto(ALLOC_CON_slp) \
483 SymI_HasProto(ALLOC_TUP_ctr) \
484 SymI_HasProto(ALLOC_TUP_adm) \
485 SymI_HasProto(ALLOC_TUP_gds) \
486 SymI_HasProto(ALLOC_TUP_slp) \
487 SymI_HasProto(ALLOC_BH_ctr) \
488 SymI_HasProto(ALLOC_BH_adm) \
489 SymI_HasProto(ALLOC_BH_gds) \
490 SymI_HasProto(ALLOC_BH_slp) \
491 SymI_HasProto(ALLOC_PRIM_ctr) \
492 SymI_HasProto(ALLOC_PRIM_adm) \
493 SymI_HasProto(ALLOC_PRIM_gds) \
494 SymI_HasProto(ALLOC_PRIM_slp) \
495 SymI_HasProto(ALLOC_PAP_ctr) \
496 SymI_HasProto(ALLOC_PAP_adm) \
497 SymI_HasProto(ALLOC_PAP_gds) \
498 SymI_HasProto(ALLOC_PAP_slp) \
499 SymI_HasProto(ALLOC_TSO_ctr) \
500 SymI_HasProto(ALLOC_TSO_adm) \
501 SymI_HasProto(ALLOC_TSO_gds) \
502 SymI_HasProto(ALLOC_TSO_slp) \
503 SymI_HasProto(RET_NEW_ctr) \
504 SymI_HasProto(RET_OLD_ctr) \
505 SymI_HasProto(RET_UNBOXED_TUP_ctr) \
506 SymI_HasProto(RET_SEMI_loads_avoided) \
507 SymI_HasProto(RET_NEW_hst) \
508 SymI_HasProto(RET_OLD_hst) \
509 SymI_HasProto(RET_UNBOXED_TUP_hst)
510
511
512 // On most platforms, the garbage collector rewrites references
513 // to small integer and char objects to a set of common, shared ones.
514 //
515 // We don't do this when compiling to Windows DLLs at the moment because
516 // it doesn't support cross package data references well.
517 //
518 #if defined(COMPILING_WINDOWS_DLL)
519 #define RTS_INTCHAR_SYMBOLS
520 #else
521 #define RTS_INTCHAR_SYMBOLS \
522 SymI_HasProto(stg_CHARLIKE_closure) \
523 SymI_HasProto(stg_INTLIKE_closure)
524 #endif
525
526 #if defined(PROFILING)
527 #define RTS_PROF_SYMBOLS \
528 SymI_HasProto(CCS_DONT_CARE) \
529 SymI_HasProto(CC_LIST) \
530 SymI_HasProto(stg_restore_cccs_info) \
531 SymI_HasProto(enterFunCCS) \
532 SymI_HasProto(pushCostCentre) \
533 SymI_HasProto(mkCostCentre) \
534 SymI_HasProto(registerCcList) \
535 SymI_HasProto(registerCcsList) \
536 SymI_HasProto(era)
537 #else
538 #define RTS_PROF_SYMBOLS /* empty */
539 #endif
540
541 #define RTS_SYMBOLS \
542 Maybe_Stable_Names \
543 RTS_TICKY_SYMBOLS \
544 RTS_PROF_SYMBOLS \
545 RTS_LIBDW_SYMBOLS \
546 SymI_HasProto(StgReturn) \
547 SymI_HasProto(stg_gc_noregs) \
548 SymI_HasProto(stg_ret_v_info) \
549 SymI_HasProto(stg_ret_p_info) \
550 SymI_HasProto(stg_ret_n_info) \
551 SymI_HasProto(stg_ret_f_info) \
552 SymI_HasProto(stg_ret_d_info) \
553 SymI_HasProto(stg_ret_l_info) \
554 SymI_HasProto(stg_gc_prim_p) \
555 SymI_HasProto(stg_gc_prim_pp) \
556 SymI_HasProto(stg_gc_prim_n) \
557 SymI_HasProto(stg_enter_info) \
558 SymI_HasProto(__stg_gc_enter_1) \
559 SymI_HasProto(stg_gc_unpt_r1) \
560 SymI_HasProto(stg_gc_unbx_r1) \
561 SymI_HasProto(stg_gc_f1) \
562 SymI_HasProto(stg_gc_d1) \
563 SymI_HasProto(stg_gc_l1) \
564 SymI_HasProto(stg_gc_pp) \
565 SymI_HasProto(stg_gc_ppp) \
566 SymI_HasProto(stg_gc_pppp) \
567 SymI_HasProto(__stg_gc_fun) \
568 SymI_HasProto(stg_gc_fun_info) \
569 SymI_HasProto(stg_yield_noregs) \
570 SymI_HasProto(stg_yield_to_interpreter) \
571 SymI_HasProto(stg_block_noregs) \
572 SymI_HasProto(stg_block_takemvar) \
573 SymI_HasProto(stg_block_readmvar) \
574 SymI_HasProto(stg_block_putmvar) \
575 MAIN_CAP_SYM \
576 SymI_HasProto(addDLL) \
577 SymI_HasProto(addLibrarySearchPath) \
578 SymI_HasProto(removeLibrarySearchPath) \
579 SymI_HasProto(findSystemLibrary) \
580 SymI_HasProto(__int_encodeDouble) \
581 SymI_HasProto(__word_encodeDouble) \
582 SymI_HasProto(__int_encodeFloat) \
583 SymI_HasProto(__word_encodeFloat) \
584 SymI_HasProto(stg_atomicallyzh) \
585 SymI_HasProto(barf) \
586 SymI_HasProto(deRefStablePtr) \
587 SymI_HasProto(debugBelch) \
588 SymI_HasProto(errorBelch) \
589 SymI_HasProto(sysErrorBelch) \
590 SymI_HasProto(stg_getMaskingStatezh) \
591 SymI_HasProto(stg_maskAsyncExceptionszh) \
592 SymI_HasProto(stg_maskUninterruptiblezh) \
593 SymI_HasProto(stg_catchzh) \
594 SymI_HasProto(stg_catchRetryzh) \
595 SymI_HasProto(stg_catchSTMzh) \
596 SymI_HasProto(stg_clearCCSzh) \
597 SymI_HasProto(stg_compactAddWithSharingzh) \
598 SymI_HasProto(stg_compactAddzh) \
599 SymI_HasProto(stg_compactNewzh) \
600 SymI_HasProto(stg_compactResizzezh) \
601 SymI_HasProto(stg_compactContainszh) \
602 SymI_HasProto(stg_compactContainsAnyzh) \
603 SymI_HasProto(stg_compactGetFirstBlockzh) \
604 SymI_HasProto(stg_compactGetNextBlockzh) \
605 SymI_HasProto(stg_compactAllocateBlockzh) \
606 SymI_HasProto(stg_compactFixupPointerszh) \
607 SymI_HasProto(stg_compactSizzezh) \
608 SymI_HasProto(closure_flags) \
609 SymI_HasProto(cmp_thread) \
610 SymI_HasProto(createAdjustor) \
611 SymI_HasProto(stg_decodeDoublezu2Intzh) \
612 SymI_HasProto(stg_decodeDoublezuInt64zh) \
613 SymI_HasProto(stg_decodeFloatzuIntzh) \
614 SymI_HasProto(stg_delayzh) \
615 SymI_HasProto(stg_deRefWeakzh) \
616 SymI_HasProto(stg_deRefStablePtrzh) \
617 SymI_HasProto(dirty_MUT_VAR) \
618 SymI_HasProto(dirty_TVAR) \
619 SymI_HasProto(stg_forkzh) \
620 SymI_HasProto(stg_forkOnzh) \
621 SymI_HasProto(forkProcess) \
622 SymI_HasProto(forkOS_createThread) \
623 SymI_HasProto(freeHaskellFunctionPtr) \
624 SymI_HasProto(getOrSetGHCConcSignalSignalHandlerStore) \
625 SymI_HasProto(getOrSetGHCConcWindowsPendingDelaysStore) \
626 SymI_HasProto(getOrSetGHCConcWindowsIOManagerThreadStore) \
627 SymI_HasProto(getOrSetGHCConcWindowsProddingStore) \
628 SymI_HasProto(getOrSetSystemEventThreadEventManagerStore) \
629 SymI_HasProto(getOrSetSystemEventThreadIOManagerThreadStore) \
630 SymI_HasProto(getOrSetSystemTimerThreadEventManagerStore) \
631 SymI_HasProto(getOrSetSystemTimerThreadIOManagerThreadStore) \
632 SymI_HasProto(getOrSetLibHSghcFastStringTable) \
633 SymI_HasProto(getRTSStats) \
634 SymI_HasProto(getRTSStatsEnabled) \
635 SymI_HasProto(getOrSetLibHSghcPersistentLinkerState) \
636 SymI_HasProto(getOrSetLibHSghcInitLinkerDone) \
637 SymI_HasProto(getOrSetLibHSghcGlobalDynFlags) \
638 SymI_HasProto(genericRaise) \
639 SymI_HasProto(getProgArgv) \
640 SymI_HasProto(getFullProgArgv) \
641 SymI_HasProto(setFullProgArgv) \
642 SymI_HasProto(freeFullProgArgv) \
643 SymI_HasProto(getProcessElapsedTime) \
644 SymI_HasProto(getStablePtr) \
645 SymI_HasProto(foreignExportStablePtr) \
646 SymI_HasProto(hs_init) \
647 SymI_HasProto(hs_init_with_rtsopts) \
648 SymI_HasProto(hs_init_ghc) \
649 SymI_HasProto(hs_exit) \
650 SymI_HasProto(hs_exit_nowait) \
651 SymI_HasProto(hs_set_argv) \
652 SymI_HasProto(hs_perform_gc) \
653 SymI_HasProto(hs_lock_stable_ptr_table) \
654 SymI_HasProto(hs_unlock_stable_ptr_table) \
655 SymI_HasProto(hs_lock_stable_tables) \
656 SymI_HasProto(hs_unlock_stable_tables) \
657 SymI_HasProto(hs_free_stable_ptr) \
658 SymI_HasProto(hs_free_stable_ptr_unsafe) \
659 SymI_HasProto(hs_free_fun_ptr) \
660 SymI_HasProto(hs_hpc_rootModule) \
661 SymI_HasProto(hs_hpc_module) \
662 SymI_HasProto(hs_thread_done) \
663 SymI_HasProto(hs_try_putmvar) \
664 SymI_HasProto(defaultRtsConfig) \
665 SymI_HasProto(initLinker) \
666 SymI_HasProto(initLinker_) \
667 SymI_HasProto(stg_unpackClosurezh) \
668 SymI_HasProto(stg_closureSizzezh) \
669 SymI_HasProto(stg_getApStackValzh) \
670 SymI_HasProto(stg_getSparkzh) \
671 SymI_HasProto(stg_numSparkszh) \
672 SymI_HasProto(stg_isCurrentThreadBoundzh) \
673 SymI_HasProto(stg_isEmptyMVarzh) \
674 SymI_HasProto(stg_killThreadzh) \
675 SymI_HasProto(loadArchive) \
676 SymI_HasProto(loadObj) \
677 SymI_HasProto(purgeObj) \
678 SymI_HasProto(insertSymbol) \
679 SymI_HasProto(lookupSymbol) \
680 SymI_HasProto(stg_makeStablePtrzh) \
681 SymI_HasProto(stg_mkApUpd0zh) \
682 SymI_HasProto(stg_labelThreadzh) \
683 SymI_HasProto(stg_newArrayzh) \
684 SymI_HasProto(stg_copyArrayzh) \
685 SymI_HasProto(stg_copyMutableArrayzh) \
686 SymI_HasProto(stg_copyArrayArrayzh) \
687 SymI_HasProto(stg_copyMutableArrayArrayzh) \
688 SymI_HasProto(stg_cloneArrayzh) \
689 SymI_HasProto(stg_cloneMutableArrayzh) \
690 SymI_HasProto(stg_freezzeArrayzh) \
691 SymI_HasProto(stg_thawArrayzh) \
692 SymI_HasProto(stg_newArrayArrayzh) \
693 SymI_HasProto(stg_casArrayzh) \
694 SymI_HasProto(stg_newSmallArrayzh) \
695 SymI_HasProto(stg_unsafeThawSmallArrayzh) \
696 SymI_HasProto(stg_cloneSmallArrayzh) \
697 SymI_HasProto(stg_cloneSmallMutableArrayzh) \
698 SymI_HasProto(stg_freezzeSmallArrayzh) \
699 SymI_HasProto(stg_thawSmallArrayzh) \
700 SymI_HasProto(stg_copySmallArrayzh) \
701 SymI_HasProto(stg_copySmallMutableArrayzh) \
702 SymI_HasProto(stg_casSmallArrayzh) \
703 SymI_HasProto(stg_newBCOzh) \
704 SymI_HasProto(stg_newByteArrayzh) \
705 SymI_HasProto(stg_casIntArrayzh) \
706 SymI_HasProto(stg_newMVarzh) \
707 SymI_HasProto(stg_newMutVarzh) \
708 SymI_HasProto(stg_newTVarzh) \
709 SymI_HasProto(stg_noDuplicatezh) \
710 SymI_HasProto(stg_atomicModifyMutVar2zh) \
711 SymI_HasProto(stg_atomicModifyMutVarzuzh) \
712 SymI_HasProto(stg_casMutVarzh) \
713 SymI_HasProto(stg_newPinnedByteArrayzh) \
714 SymI_HasProto(stg_newAlignedPinnedByteArrayzh) \
715 SymI_HasProto(stg_isByteArrayPinnedzh) \
716 SymI_HasProto(stg_isMutableByteArrayPinnedzh) \
717 SymI_HasProto(stg_shrinkMutableByteArrayzh) \
718 SymI_HasProto(stg_resizzeMutableByteArrayzh) \
719 SymI_HasProto(newSpark) \
720 SymI_HasProto(updateRemembSetPushThunk) \
721 SymI_HasProto(updateRemembSetPushThunk_) \
722 SymI_HasProto(updateRemembSetPushClosure_) \
723 SymI_HasProto(performGC) \
724 SymI_HasProto(performMajorGC) \
725 SymI_HasProto(prog_argc) \
726 SymI_HasProto(prog_argv) \
727 SymI_HasProto(stg_putMVarzh) \
728 SymI_HasProto(stg_raisezh) \
729 SymI_HasProto(stg_raiseIOzh) \
730 SymI_HasProto(stg_readTVarzh) \
731 SymI_HasProto(stg_readTVarIOzh) \
732 SymI_HasProto(resumeThread) \
733 SymI_HasProto(setNumCapabilities) \
734 SymI_HasProto(getNumberOfProcessors) \
735 SymI_HasProto(resolveObjs) \
736 SymI_HasProto(stg_retryzh) \
737 SymI_HasProto(rts_apply) \
738 SymI_HasProto(rts_checkSchedStatus) \
739 SymI_HasProto(rts_eval) \
740 SymI_HasProto(rts_evalIO) \
741 SymI_HasProto(rts_evalLazyIO) \
742 SymI_HasProto(rts_evalStableIOMain) \
743 SymI_HasProto(rts_evalStableIO) \
744 SymI_HasProto(rts_eval_) \
745 SymI_HasProto(rts_getBool) \
746 SymI_HasProto(rts_getChar) \
747 SymI_HasProto(rts_getDouble) \
748 SymI_HasProto(rts_getFloat) \
749 SymI_HasProto(rts_getInt) \
750 SymI_HasProto(rts_getInt8) \
751 SymI_HasProto(rts_getInt16) \
752 SymI_HasProto(rts_getInt32) \
753 SymI_HasProto(rts_getInt64) \
754 SymI_HasProto(rts_getPtr) \
755 SymI_HasProto(rts_getFunPtr) \
756 SymI_HasProto(rts_getStablePtr) \
757 SymI_HasProto(rts_getThreadId) \
758 SymI_HasProto(rts_getWord) \
759 SymI_HasProto(rts_getWord8) \
760 SymI_HasProto(rts_getWord16) \
761 SymI_HasProto(rts_getWord32) \
762 SymI_HasProto(rts_getWord64) \
763 SymI_HasProto(rts_lock) \
764 SymI_HasProto(rts_mkBool) \
765 SymI_HasProto(rts_mkChar) \
766 SymI_HasProto(rts_mkDouble) \
767 SymI_HasProto(rts_mkFloat) \
768 SymI_HasProto(rts_mkInt) \
769 SymI_HasProto(rts_mkInt8) \
770 SymI_HasProto(rts_mkInt16) \
771 SymI_HasProto(rts_mkInt32) \
772 SymI_HasProto(rts_mkInt64) \
773 SymI_HasProto(rts_mkPtr) \
774 SymI_HasProto(rts_mkFunPtr) \
775 SymI_HasProto(rts_mkStablePtr) \
776 SymI_HasProto(rts_mkString) \
777 SymI_HasProto(rts_mkWord) \
778 SymI_HasProto(rts_mkWord8) \
779 SymI_HasProto(rts_mkWord16) \
780 SymI_HasProto(rts_mkWord32) \
781 SymI_HasProto(rts_mkWord64) \
782 SymI_HasProto(rts_unlock) \
783 SymI_HasProto(rts_unsafeGetMyCapability) \
784 SymI_HasProto(rtsSupportsBoundThreads) \
785 SymI_HasProto(rts_isProfiled) \
786 SymI_HasProto(rts_isDynamic) \
787 SymI_HasProto(rts_setInCallCapability) \
788 SymI_HasProto(rts_enableThreadAllocationLimit) \
789 SymI_HasProto(rts_disableThreadAllocationLimit) \
790 SymI_HasProto(rts_setMainThread) \
791 SymI_HasProto(setProgArgv) \
792 SymI_HasProto(startupHaskell) \
793 SymI_HasProto(shutdownHaskell) \
794 SymI_HasProto(shutdownHaskellAndExit) \
795 SymI_HasProto(stable_name_table) \
796 SymI_HasProto(stable_ptr_table) \
797 SymI_HasProto(reportStackOverflow) \
798 SymI_HasProto(reportHeapOverflow) \
799 SymI_HasProto(stg_CAF_BLACKHOLE_info) \
800 SymI_HasProto(stg_BLACKHOLE_info) \
801 SymI_HasProto(__stg_EAGER_BLACKHOLE_info) \
802 SymI_HasProto(stg_BLOCKING_QUEUE_CLEAN_info) \
803 SymI_HasProto(stg_BLOCKING_QUEUE_DIRTY_info) \
804 SymI_HasProto(startTimer) \
805 SymI_HasProto(stg_MVAR_CLEAN_info) \
806 SymI_HasProto(stg_MVAR_DIRTY_info) \
807 SymI_HasProto(stg_TVAR_CLEAN_info) \
808 SymI_HasProto(stg_TVAR_DIRTY_info) \
809 SymI_HasProto(stg_IND_STATIC_info) \
810 SymI_HasProto(stg_ARR_WORDS_info) \
811 SymI_HasProto(stg_MUT_ARR_PTRS_DIRTY_info) \
812 SymI_HasProto(stg_MUT_ARR_PTRS_FROZEN_CLEAN_info) \
813 SymI_HasProto(stg_MUT_ARR_PTRS_FROZEN_DIRTY_info) \
814 SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_DIRTY_info) \
815 SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_FROZEN_CLEAN_info) \
816 SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_FROZEN_DIRTY_info) \
817 SymI_HasProto(stg_MUT_VAR_CLEAN_info) \
818 SymI_HasProto(stg_MUT_VAR_DIRTY_info) \
819 SymI_HasProto(stg_WEAK_info) \
820 SymI_HasProto(stg_SRT_1_info) \
821 SymI_HasProto(stg_SRT_2_info) \
822 SymI_HasProto(stg_SRT_3_info) \
823 SymI_HasProto(stg_SRT_4_info) \
824 SymI_HasProto(stg_SRT_5_info) \
825 SymI_HasProto(stg_SRT_6_info) \
826 SymI_HasProto(stg_SRT_7_info) \
827 SymI_HasProto(stg_SRT_8_info) \
828 SymI_HasProto(stg_SRT_9_info) \
829 SymI_HasProto(stg_SRT_10_info) \
830 SymI_HasProto(stg_SRT_11_info) \
831 SymI_HasProto(stg_SRT_12_info) \
832 SymI_HasProto(stg_SRT_13_info) \
833 SymI_HasProto(stg_SRT_14_info) \
834 SymI_HasProto(stg_SRT_15_info) \
835 SymI_HasProto(stg_SRT_16_info) \
836 SymI_HasProto(stg_ap_v_info) \
837 SymI_HasProto(stg_ap_f_info) \
838 SymI_HasProto(stg_ap_d_info) \
839 SymI_HasProto(stg_ap_l_info) \
840 SymI_HasProto(stg_ap_v16_info) \
841 SymI_HasProto(stg_ap_v32_info) \
842 SymI_HasProto(stg_ap_v64_info) \
843 SymI_HasProto(stg_ap_n_info) \
844 SymI_HasProto(stg_ap_p_info) \
845 SymI_HasProto(stg_ap_pv_info) \
846 SymI_HasProto(stg_ap_pp_info) \
847 SymI_HasProto(stg_ap_ppv_info) \
848 SymI_HasProto(stg_ap_ppp_info) \
849 SymI_HasProto(stg_ap_pppv_info) \
850 SymI_HasProto(stg_ap_pppp_info) \
851 SymI_HasProto(stg_ap_ppppp_info) \
852 SymI_HasProto(stg_ap_pppppp_info) \
853 SymI_HasProto(stg_ap_0_fast) \
854 SymI_HasProto(stg_ap_v_fast) \
855 SymI_HasProto(stg_ap_f_fast) \
856 SymI_HasProto(stg_ap_d_fast) \
857 SymI_HasProto(stg_ap_l_fast) \
858 SymI_HasProto(stg_ap_v16_fast) \
859 SymI_HasProto(stg_ap_v32_fast) \
860 SymI_HasProto(stg_ap_v64_fast) \
861 SymI_HasProto(stg_ap_n_fast) \
862 SymI_HasProto(stg_ap_p_fast) \
863 SymI_HasProto(stg_ap_pv_fast) \
864 SymI_HasProto(stg_ap_pp_fast) \
865 SymI_HasProto(stg_ap_ppv_fast) \
866 SymI_HasProto(stg_ap_ppp_fast) \
867 SymI_HasProto(stg_ap_pppv_fast) \
868 SymI_HasProto(stg_ap_pppp_fast) \
869 SymI_HasProto(stg_ap_ppppp_fast) \
870 SymI_HasProto(stg_ap_pppppp_fast) \
871 SymI_HasProto(stg_ap_1_upd_info) \
872 SymI_HasProto(stg_ap_2_upd_info) \
873 SymI_HasProto(stg_ap_3_upd_info) \
874 SymI_HasProto(stg_ap_4_upd_info) \
875 SymI_HasProto(stg_ap_5_upd_info) \
876 SymI_HasProto(stg_ap_6_upd_info) \
877 SymI_HasProto(stg_ap_7_upd_info) \
878 SymI_HasProto(stg_exit) \
879 SymI_HasProto(stg_sel_0_upd_info) \
880 SymI_HasProto(stg_sel_1_upd_info) \
881 SymI_HasProto(stg_sel_2_upd_info) \
882 SymI_HasProto(stg_sel_3_upd_info) \
883 SymI_HasProto(stg_sel_4_upd_info) \
884 SymI_HasProto(stg_sel_5_upd_info) \
885 SymI_HasProto(stg_sel_6_upd_info) \
886 SymI_HasProto(stg_sel_7_upd_info) \
887 SymI_HasProto(stg_sel_8_upd_info) \
888 SymI_HasProto(stg_sel_9_upd_info) \
889 SymI_HasProto(stg_sel_10_upd_info) \
890 SymI_HasProto(stg_sel_11_upd_info) \
891 SymI_HasProto(stg_sel_12_upd_info) \
892 SymI_HasProto(stg_sel_13_upd_info) \
893 SymI_HasProto(stg_sel_14_upd_info) \
894 SymI_HasProto(stg_sel_15_upd_info) \
895 SymI_HasProto(stg_sel_0_noupd_info) \
896 SymI_HasProto(stg_sel_1_noupd_info) \
897 SymI_HasProto(stg_sel_2_noupd_info) \
898 SymI_HasProto(stg_sel_3_noupd_info) \
899 SymI_HasProto(stg_sel_4_noupd_info) \
900 SymI_HasProto(stg_sel_5_noupd_info) \
901 SymI_HasProto(stg_sel_6_noupd_info) \
902 SymI_HasProto(stg_sel_7_noupd_info) \
903 SymI_HasProto(stg_sel_8_noupd_info) \
904 SymI_HasProto(stg_sel_9_noupd_info) \
905 SymI_HasProto(stg_sel_10_noupd_info) \
906 SymI_HasProto(stg_sel_11_noupd_info) \
907 SymI_HasProto(stg_sel_12_noupd_info) \
908 SymI_HasProto(stg_sel_13_noupd_info) \
909 SymI_HasProto(stg_sel_14_noupd_info) \
910 SymI_HasProto(stg_sel_15_noupd_info) \
911 SymI_HasProto(stg_upd_frame_info) \
912 SymI_HasProto(stg_bh_upd_frame_info) \
913 SymI_HasProto(suspendThread) \
914 SymI_HasProto(stg_takeMVarzh) \
915 SymI_HasProto(stg_readMVarzh) \
916 SymI_HasProto(stg_threadStatuszh) \
917 SymI_HasProto(stg_tryPutMVarzh) \
918 SymI_HasProto(stg_tryTakeMVarzh) \
919 SymI_HasProto(stg_tryReadMVarzh) \
920 SymI_HasProto(stg_unmaskAsyncExceptionszh) \
921 SymI_HasProto(unloadObj) \
922 SymI_HasProto(stg_unsafeThawArrayzh) \
923 SymI_HasProto(stg_waitReadzh) \
924 SymI_HasProto(stg_waitWritezh) \
925 SymI_HasProto(stg_writeTVarzh) \
926 SymI_HasProto(stg_yieldzh) \
927 SymI_NeedsProto(stg_badAlignment_entry) \
928 SymI_NeedsProto(stg_interp_constr1_entry) \
929 SymI_NeedsProto(stg_interp_constr2_entry) \
930 SymI_NeedsProto(stg_interp_constr3_entry) \
931 SymI_NeedsProto(stg_interp_constr4_entry) \
932 SymI_NeedsProto(stg_interp_constr5_entry) \
933 SymI_NeedsProto(stg_interp_constr6_entry) \
934 SymI_NeedsProto(stg_interp_constr7_entry) \
935 SymI_HasProto(stg_arg_bitmaps) \
936 SymI_HasProto(large_alloc_lim) \
937 SymI_HasProto(g0) \
938 SymI_HasProto(allocate) \
939 SymI_HasProto(allocateExec) \
940 SymI_HasProto(flushExec) \
941 SymI_HasProto(freeExec) \
942 SymI_HasProto(getAllocations) \
943 SymI_HasProto(revertCAFs) \
944 SymI_HasProto(RtsFlags) \
945 SymI_NeedsDataProto(rts_breakpoint_io_action) \
946 SymI_NeedsDataProto(rts_stop_next_breakpoint) \
947 SymI_NeedsDataProto(rts_stop_on_exception) \
948 SymI_HasProto(stopTimer) \
949 SymI_HasProto(n_capabilities) \
950 SymI_HasProto(enabled_capabilities) \
951 SymI_HasProto(stg_traceCcszh) \
952 SymI_HasProto(stg_traceEventzh) \
953 SymI_HasProto(stg_traceMarkerzh) \
954 SymI_HasProto(stg_traceBinaryEventzh) \
955 SymI_HasProto(stg_getThreadAllocationCounterzh) \
956 SymI_HasProto(stg_setThreadAllocationCounterzh) \
957 SymI_HasProto(getMonotonicNSec) \
958 SymI_HasProto(lockFile) \
959 SymI_HasProto(unlockFile) \
960 SymI_HasProto(startProfTimer) \
961 SymI_HasProto(stopProfTimer) \
962 SymI_HasProto(atomic_inc) \
963 SymI_HasProto(atomic_dec) \
964 SymI_HasProto(hs_spt_lookup) \
965 SymI_HasProto(hs_spt_insert) \
966 SymI_HasProto(hs_spt_insert_stableptr) \
967 SymI_HasProto(hs_spt_remove) \
968 SymI_HasProto(hs_spt_keys) \
969 SymI_HasProto(hs_spt_key_count) \
970 SymI_HasProto(write_barrier) \
971 SymI_HasProto(store_load_barrier) \
972 SymI_HasProto(load_load_barrier) \
973 SymI_HasProto(cas) \
974 SymI_HasProto(_assertFail) \
975 SymI_HasProto(keepCAFs) \
976 RTS_USER_SIGNALS_SYMBOLS \
977 RTS_INTCHAR_SYMBOLS
978
979
980 // 64-bit support functions in libgcc.a
981 #if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
982 #define RTS_LIBGCC_SYMBOLS \
983 SymI_NeedsProto(__divdi3) \
984 SymI_NeedsProto(__udivdi3) \
985 SymI_NeedsProto(__moddi3) \
986 SymI_NeedsProto(__umoddi3) \
987 SymI_NeedsProto(__muldi3) \
988 SymI_NeedsProto(__ashldi3) \
989 SymI_NeedsProto(__ashrdi3) \
990 SymI_NeedsProto(__lshrdi3) \
991 SymI_NeedsProto(__fixunsdfdi)
992 #elif defined(__GNUC__) && SIZEOF_VOID_P == 8
993 #define RTS_LIBGCC_SYMBOLS \
994 SymI_NeedsProto(__udivti3) \
995 SymI_NeedsProto(__umodti3)
996 #else
997 #define RTS_LIBGCC_SYMBOLS
998 #endif
999
1000 /* entirely bogus claims about types of these symbols */
1001 #define SymI_NeedsProto(vvv) extern void vvv(void);
1002 #define SymI_NeedsDataProto(vvv) extern StgWord vvv[];
1003 #if defined(COMPILING_WINDOWS_DLL)
1004 #define SymE_HasProto(vvv) SymE_HasProto(vvv);
1005 # if defined(x86_64_HOST_ARCH)
1006 # define SymE_NeedsProto(vvv) extern void __imp_ ## vvv (void);
1007 # define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
1008 # else
1009 # define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void);
1010 # define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
1011 # endif
1012 #else
1013 #define SymE_NeedsProto(vvv) SymI_NeedsProto(vvv);
1014 #define SymE_NeedsDataProto(vvv) SymI_NeedsDataProto(vvv);
1015 #define SymE_HasProto(vvv) SymI_HasProto(vvv)
1016 #endif
1017 #define SymI_HasProto(vvv) /**/
1018 #define SymI_HasProto_redirect(vvv,xxx,weak) /**/
1019 #define SymI_HasProto_deprecated(vvv) /**/
1020 RTS_SYMBOLS
1021 RTS_RET_SYMBOLS
1022 RTS_POSIX_ONLY_SYMBOLS
1023 RTS_MINGW_ONLY_SYMBOLS
1024 RTS_DARWIN_ONLY_SYMBOLS
1025 RTS_OPENBSD_ONLY_SYMBOLS
1026 RTS_LIBGCC_SYMBOLS
1027 RTS_LIBFFI_SYMBOLS
1028 #undef SymI_NeedsProto
1029 #undef SymI_NeedsDataProto
1030 #undef SymI_HasProto
1031 #undef SymI_HasProto_redirect
1032 #undef SymI_HasProto_deprecated
1033 #undef SymE_HasProto
1034 #undef SymE_HasDataProto
1035 #undef SymE_NeedsProto
1036 #undef SymE_NeedsDataProto
1037
1038 #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
1039 (void*)(&(vvv)), false },
1040 #define SymI_HasDataProto(vvv) \
1041 SymI_HasProto(vvv)
1042 #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
1043 (void*)DLL_IMPORT_DATA_REF(vvv), false },
1044 #define SymE_HasDataProto(vvv) \
1045 SymE_HasProto(vvv)
1046
1047 #define SymI_NeedsProto(vvv) SymI_HasProto(vvv)
1048 #define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv)
1049 #define SymE_NeedsProto(vvv) SymE_HasProto(vvv)
1050 #define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv)
1051
1052 // SymI_HasProto_redirect allows us to redirect references to one symbol to
1053 // another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example.
1054 #define SymI_HasProto_redirect(vvv,xxx,weak) \
1055 { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
1056 (void*)(&(xxx)), weak },
1057
1058 // SymI_HasProto_deprecated allows us to redirect references from their deprecated
1059 // names to the undeprecated ones. e.g. access -> _access.
1060 // We use the hexspeak for unallocated memory 0xBAADF00D to signal the RTS
1061 // that this needs to be loaded from somewhere else.
1062 // These are inserted as weak symbols to prevent us overriding packages that do
1063 // define them, since on Windows these functions shouldn't be in the top level
1064 // namespace, but we have them for POSIX compatibility.
1065 #define SymI_HasProto_deprecated(vvv) \
1066 { #vvv, (void*)0xBAADF00D, true },
1067
1068 RtsSymbolVal rtsSyms[] = {
1069 RTS_SYMBOLS
1070 RTS_RET_SYMBOLS
1071 RTS_POSIX_ONLY_SYMBOLS
1072 RTS_MINGW_ONLY_SYMBOLS
1073 RTS_MINGW_COMPAT_SYMBOLS
1074 RTS_DARWIN_ONLY_SYMBOLS
1075 RTS_OPENBSD_ONLY_SYMBOLS
1076 RTS_LIBGCC_SYMBOLS
1077 RTS_LIBFFI_SYMBOLS
1078 SymI_HasDataProto(nonmoving_write_barrier_enabled)
1079 #if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
1080 // dyld stub code contains references to this,
1081 // but it should never be called because we treat
1082 // lazy pointers as nonlazy.
1083 { "dyld_stub_binding_helper", (void*)0xDEADBEEF, false },
1084 #endif
1085 { 0, 0, false } /* sentinel */
1086 };