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