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