709c5bfca21013029c6ae3db611cc12a2f9e1a3b
[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 "HsFFI.h"
14
15 #include "sm/Storage.h"
16
17 #if !defined(mingw32_HOST_OS)
18 #include "posix/Signals.h"
19 #endif
20
21 #if defined(mingw32_HOST_OS)
22 #include <sys/stat.h>
23 #include <io.h>
24 #include <windows.h>
25 #include <shfolder.h> /* SHGetFolderPathW */
26 #endif
27
28 /* -----------------------------------------------------------------------------
29 * Symbols to be inserted into the RTS symbol table.
30 */
31
32 #define Maybe_Stable_Names SymI_HasProto(stg_mkWeakzh) \
33 SymI_HasProto(stg_mkWeakNoFinalizzerzh) \
34 SymI_HasProto(stg_addCFinalizzerToWeakzh) \
35 SymI_HasProto(stg_makeStableNamezh) \
36 SymI_HasProto(stg_finalizzeWeakzh)
37
38 #if !defined (mingw32_HOST_OS)
39 #define RTS_POSIX_ONLY_SYMBOLS \
40 SymI_HasProto(__hscore_get_saved_termios) \
41 SymI_HasProto(__hscore_set_saved_termios) \
42 SymI_HasProto(shutdownHaskellAndSignal) \
43 SymI_HasProto(signal_handlers) \
44 SymI_HasProto(stg_sig_install) \
45 SymI_HasProto(rtsTimerSignal) \
46 SymI_HasProto(atexit) \
47 SymI_NeedsDataProto(nocldstop)
48 #endif
49
50 #if defined(mingw32_HOST_OS)
51 #define RTS_POSIX_ONLY_SYMBOLS /**/
52
53 #if HAVE_GETTIMEOFDAY
54 #define RTS_MINGW_GETTIMEOFDAY_SYM SymI_NeedsProto(gettimeofday)
55 #else
56 #define RTS_MINGW_GETTIMEOFDAY_SYM /**/
57 #endif
58
59 #if HAVE___MINGW_VFPRINTF
60 #define RTS___MINGW_VFPRINTF_SYM SymI_HasProto(__mingw_vfprintf)
61 #else
62 #define RTS___MINGW_VFPRINTF_SYM /**/
63 #endif
64
65 #if defined(i386_HOST_ARCH)
66 #define RTS_WIN32_ONLY(X) X
67 #else
68 #define RTS_WIN32_ONLY(X) /**/
69 #endif
70
71 #if defined(x86_64_HOST_ARCH)
72 #define RTS_WIN64_ONLY(X) X
73 #else
74 #define RTS_WIN64_ONLY(X) /**/
75 #endif
76
77 /* These are statically linked from the mingw libraries into the ghc
78 executable, so we have to employ this hack. */
79 #define RTS_MINGW_ONLY_SYMBOLS \
80 SymI_HasProto(stg_asyncReadzh) \
81 SymI_HasProto(stg_asyncWritezh) \
82 SymI_HasProto(stg_asyncDoProczh) \
83 SymI_HasProto(getWin32ProgArgv) \
84 SymI_HasProto(setWin32ProgArgv) \
85 SymI_HasProto(memset) \
86 SymI_HasProto(inet_ntoa) \
87 SymI_HasProto(inet_addr) \
88 SymI_HasProto(htonl) \
89 SymI_HasProto(recvfrom) \
90 SymI_HasProto(listen) \
91 SymI_HasProto(bind) \
92 SymI_HasProto(shutdown) \
93 SymI_HasProto(connect) \
94 SymI_HasProto(htons) \
95 SymI_HasProto(ntohs) \
96 SymI_HasProto(getservbyname) \
97 SymI_HasProto(getservbyport) \
98 SymI_HasProto(getprotobynumber) \
99 SymI_HasProto(getprotobyname) \
100 SymI_HasProto(gethostbyname) \
101 SymI_HasProto(gethostbyaddr) \
102 SymI_HasProto(gethostname) \
103 SymI_HasProto(strcpy) \
104 SymI_HasProto(strncpy) \
105 SymI_HasProto(abort) \
106 SymI_HasProto(isxdigit) \
107 SymI_HasProto(isupper) \
108 SymI_HasProto(ispunct) \
109 SymI_HasProto(islower) \
110 SymI_HasProto(isspace) \
111 SymI_HasProto(isprint) \
112 SymI_HasProto(isdigit) \
113 SymI_HasProto(iscntrl) \
114 SymI_HasProto(isalpha) \
115 SymI_HasProto(isalnum) \
116 SymI_HasProto(isascii) \
117 RTS___MINGW_VFPRINTF_SYM \
118 SymI_HasProto(strcmp) \
119 SymI_HasProto(memmove) \
120 SymI_HasProto(realloc) \
121 SymI_HasProto(malloc) \
122 SymI_HasProto(pow) \
123 SymI_HasProto(tanh) \
124 SymI_HasProto(cosh) \
125 SymI_HasProto(sinh) \
126 SymI_HasProto(atan) \
127 SymI_HasProto(acos) \
128 SymI_HasProto(asin) \
129 SymI_HasProto(tan) \
130 SymI_HasProto(cos) \
131 SymI_HasProto(sin) \
132 SymI_HasProto(exp) \
133 SymI_HasProto(log) \
134 SymI_HasProto(sqrt) \
135 SymI_HasProto(powf) \
136 SymI_HasProto(tanhf) \
137 SymI_HasProto(coshf) \
138 SymI_HasProto(sinhf) \
139 SymI_HasProto(atanf) \
140 SymI_HasProto(acosf) \
141 SymI_HasProto(asinf) \
142 SymI_HasProto(tanf) \
143 SymI_HasProto(cosf) \
144 SymI_HasProto(sinf) \
145 SymI_HasProto(expf) \
146 SymI_HasProto(logf) \
147 SymI_HasProto(sqrtf) \
148 SymI_HasProto(erf) \
149 SymI_HasProto(erfc) \
150 SymI_HasProto(erff) \
151 SymI_HasProto(erfcf) \
152 SymI_HasProto(memcpy) \
153 SymI_HasProto(rts_InstallConsoleEvent) \
154 SymI_HasProto(rts_ConsoleHandlerDone) \
155 SymI_NeedsProto(mktime) \
156 SymI_NeedsProto(localtime) \
157 SymI_NeedsProto(gmtime) \
158 SymI_NeedsProto(opendir) \
159 SymI_NeedsProto(readdir) \
160 SymI_NeedsProto(rewinddir) \
161 RTS_WIN32_ONLY(SymI_NeedsProto(__chkstk_ms)) \
162 RTS_WIN64_ONLY(SymI_NeedsProto(___chkstk_ms)) \
163 SymI_NeedsProto(localeconv) \
164 SymI_HasProto(close) \
165 SymI_HasProto(read) \
166 SymI_HasProto(dup) \
167 SymI_HasProto(dup2) \
168 SymI_HasProto(write) \
169 SymI_NeedsProto(getpid) \
170 SymI_HasProto(access) \
171 SymI_HasProto(chmod) \
172 SymI_HasProto(creat) \
173 SymI_HasProto(umask) \
174 SymI_HasProto(unlink) \
175 SymI_HasProto(_errno) \
176 SymI_NeedsProto(ftruncate64) \
177 SymI_HasProto(setmode) \
178 SymI_HasProto(_wstat64) \
179 SymI_HasProto(_fstat64) \
180 SymI_HasProto(_wsopen) \
181 RTS_WIN32_ONLY(SymI_HasProto(_imp___environ)) \
182 RTS_WIN64_ONLY(SymI_HasProto(__imp__environ)) \
183 RTS_WIN32_ONLY(SymI_HasProto(_imp___iob)) \
184 RTS_WIN64_ONLY(SymI_HasProto(__iob_func)) \
185 SymI_HasProto(GetFileAttributesA) \
186 SymI_HasProto(GetFileInformationByHandle) \
187 SymI_HasProto(GetFileType) \
188 SymI_HasProto(GetLastError) \
189 SymI_HasProto(QueryPerformanceFrequency) \
190 SymI_HasProto(QueryPerformanceCounter) \
191 SymI_HasProto(GetTickCount) \
192 SymI_HasProto(WaitForSingleObject) \
193 SymI_HasProto(PeekConsoleInputA) \
194 SymI_HasProto(ReadConsoleInputA) \
195 SymI_HasProto(PeekNamedPipe) \
196 SymI_HasProto(select) \
197 SymI_HasProto(isatty) \
198 SymI_HasProto(_get_osfhandle) \
199 SymI_HasProto(GetConsoleMode) \
200 SymI_HasProto(SetConsoleMode) \
201 SymI_HasProto(FlushConsoleInputBuffer) \
202 SymI_HasProto(free) \
203 SymI_NeedsProto(raise) \
204 SymI_NeedsProto(_getpid) \
205 SymI_HasProto(getc) \
206 SymI_HasProto(ungetc) \
207 SymI_HasProto(puts) \
208 SymI_HasProto(putc) \
209 SymI_HasProto(putchar) \
210 SymI_HasProto(fputc) \
211 SymI_HasProto(fread) \
212 SymI_HasProto(fwrite) \
213 SymI_HasProto(ferror) \
214 SymI_HasProto(printf) \
215 SymI_HasProto(fprintf) \
216 SymI_HasProto(sprintf) \
217 SymI_HasProto(vsprintf) \
218 SymI_HasProto(sscanf) \
219 SymI_HasProto(ldexp) \
220 SymI_HasProto(strlen) \
221 SymI_HasProto(strnlen) \
222 SymI_HasProto(strchr) \
223 SymI_HasProto(strtol) \
224 SymI_HasProto(strerror) \
225 SymI_HasProto(memchr) \
226 SymI_HasProto(memcmp) \
227 SymI_HasProto(wcscpy) \
228 SymI_HasProto(wcslen) \
229 SymI_HasProto(_lseeki64) \
230 SymI_HasProto(_wchmod) \
231 SymI_HasProto(closesocket) \
232 SymI_HasProto(send) \
233 SymI_HasProto(recv) \
234 SymI_HasProto(bsearch) \
235 SymI_HasProto(CommandLineToArgvW) \
236 SymI_HasProto(CreateBitmap) \
237 SymI_HasProto(CreateBitmapIndirect) \
238 SymI_HasProto(CreateCompatibleBitmap) \
239 SymI_HasProto(CreateDIBPatternBrushPt) \
240 SymI_HasProto(CreateDIBitmap) \
241 SymI_HasProto(SetBitmapDimensionEx) \
242 SymI_HasProto(GetBitmapDimensionEx) \
243 SymI_HasProto(GetStockObject) \
244 SymI_HasProto(GetObjectW) \
245 SymI_HasProto(DeleteObject) \
246 SymI_HasProto(SetDIBits) \
247 SymI_HasProto(GetDIBits) \
248 SymI_HasProto(CreateSolidBrush) \
249 SymI_HasProto(CreateHatchBrush) \
250 SymI_HasProto(CreatePatternBrush) \
251 SymI_HasProto(CreateFontW) \
252 SymI_HasProto(AngleArc) \
253 SymI_HasProto(Arc) \
254 SymI_HasProto(ArcTo) \
255 SymI_HasProto(BeginPath) \
256 SymI_HasProto(BitBlt) \
257 SymI_HasProto(CancelDC) \
258 SymI_HasProto(Chord) \
259 SymI_HasProto(CloseFigure) \
260 SymI_HasProto(CombineRgn) \
261 SymI_HasProto(CreateCompatibleDC) \
262 SymI_HasProto(CreateEllipticRgn) \
263 SymI_HasProto(CreateEllipticRgnIndirect) \
264 SymI_HasProto(CreatePen) \
265 SymI_HasProto(CreatePolygonRgn) \
266 SymI_HasProto(CreateRectRgn) \
267 SymI_HasProto(CreateRectRgnIndirect) \
268 SymI_HasProto(CreateRoundRectRgn) \
269 SymI_HasProto(DeleteDC) \
270 SymI_HasProto(Ellipse) \
271 SymI_HasProto(EndPath) \
272 SymI_HasProto(EqualRgn) \
273 SymI_HasProto(ExtSelectClipRgn) \
274 SymI_HasProto(FillPath) \
275 SymI_HasProto(FillRgn) \
276 SymI_HasProto(FlattenPath) \
277 SymI_HasProto(FrameRgn) \
278 SymI_HasProto(GetArcDirection) \
279 SymI_HasProto(GetBkColor) \
280 SymI_HasProto(GetBkMode) \
281 SymI_HasProto(GetBrushOrgEx) \
282 SymI_HasProto(GetCurrentObject) \
283 SymI_HasProto(GetDCOrgEx) \
284 SymI_HasProto(GetGraphicsMode) \
285 SymI_HasProto(GetMiterLimit) \
286 SymI_HasProto(GetPolyFillMode) \
287 SymI_HasProto(GetRgnBox) \
288 SymI_HasProto(GetStretchBltMode) \
289 SymI_HasProto(GetTextAlign) \
290 SymI_HasProto(GetTextCharacterExtra) \
291 SymI_HasProto(GetTextColor) \
292 SymI_HasProto(GetTextExtentPoint32W) \
293 SymI_HasProto(InvertRgn) \
294 SymI_HasProto(LineTo) \
295 SymI_HasProto(MaskBlt) \
296 SymI_HasProto(MoveToEx) \
297 SymI_HasProto(OffsetRgn) \
298 SymI_HasProto(PaintRgn) \
299 SymI_HasProto(PathToRegion) \
300 SymI_HasProto(Pie) \
301 SymI_HasProto(PlgBlt) \
302 SymI_HasProto(PolyBezier) \
303 SymI_HasProto(PolyBezierTo) \
304 SymI_HasProto(Polygon) \
305 SymI_HasProto(Polyline) \
306 SymI_HasProto(PolylineTo) \
307 SymI_HasProto(PtInRegion) \
308 SymI_HasProto(Rectangle) \
309 SymI_HasProto(RectInRegion) \
310 SymI_HasProto(RestoreDC) \
311 SymI_HasProto(RoundRect) \
312 SymI_HasProto(SaveDC) \
313 SymI_HasProto(SelectClipPath) \
314 SymI_HasProto(SelectClipRgn) \
315 SymI_HasProto(SelectObject) \
316 SymI_HasProto(SelectPalette) \
317 SymI_HasProto(SetArcDirection) \
318 SymI_HasProto(SetBkColor) \
319 SymI_HasProto(SetBkMode) \
320 SymI_HasProto(SetBrushOrgEx) \
321 SymI_HasProto(SetGraphicsMode) \
322 SymI_HasProto(SetMiterLimit) \
323 SymI_HasProto(SetPolyFillMode) \
324 SymI_HasProto(SetStretchBltMode) \
325 SymI_HasProto(SetTextAlign) \
326 SymI_HasProto(SetTextCharacterExtra) \
327 SymI_HasProto(SetTextColor) \
328 SymI_HasProto(StretchBlt) \
329 SymI_HasProto(StrokeAndFillPath) \
330 SymI_HasProto(StrokePath) \
331 SymI_HasProto(TextOutW) \
332 SymI_HasProto(timeGetTime) \
333 SymI_HasProto(WidenPath) \
334 SymI_HasProto(GetFileSecurityW) \
335 SymI_HasProto(RegCloseKey) \
336 SymI_HasProto(RegConnectRegistryW) \
337 SymI_HasProto(RegCreateKeyExW) \
338 SymI_HasProto(RegCreateKeyW) \
339 SymI_HasProto(RegDeleteKeyW) \
340 SymI_HasProto(RegDeleteValueW) \
341 SymI_HasProto(RegEnumKeyW) \
342 SymI_HasProto(RegEnumValueW) \
343 SymI_HasProto(RegFlushKey) \
344 SymI_HasProto(RegLoadKeyW) \
345 SymI_HasProto(RegNotifyChangeKeyValue) \
346 SymI_HasProto(RegOpenKeyExW) \
347 SymI_HasProto(RegOpenKeyW) \
348 SymI_HasProto(RegQueryInfoKeyW) \
349 SymI_HasProto(RegQueryValueExW) \
350 SymI_HasProto(RegQueryValueW) \
351 SymI_HasProto(RegReplaceKeyW) \
352 SymI_HasProto(RegRestoreKeyW) \
353 SymI_HasProto(RegSaveKeyW) \
354 SymI_HasProto(RegSetValueExW) \
355 SymI_HasProto(RegSetValueW) \
356 SymI_HasProto(RegUnLoadKeyW) \
357 SymI_HasProto(SHGetFolderPathW) \
358 RTS_WIN32_ONLY(SymI_HasProto(SetWindowLongW)) \
359 RTS_WIN32_ONLY(SymI_HasProto(GetWindowLongW)) \
360 RTS_WIN64_ONLY(SymI_HasProto(SetWindowLongPtrW)) \
361 RTS_WIN64_ONLY(SymI_HasProto(GetWindowLongPtrW)) \
362 SymI_HasProto(MenuItemFromPoint) \
363 SymI_HasProto(ChildWindowFromPoint) \
364 SymI_HasProto(ChildWindowFromPointEx) \
365 SymI_HasProto(UnmapViewOfFile) \
366 SymI_HasProto(CloseHandle) \
367 SymI_HasProto(FreeLibrary) \
368 SymI_HasProto(GetMessageW) \
369 SymI_HasProto(TranslateMessage) \
370 SymI_HasProto(DispatchMessageW) \
371 SymI_HasProto(DefWindowProcW) \
372 SymI_HasProto(GlobalAlloc) \
373 SymI_HasProto(GlobalFree) \
374 SymI_HasProto(CreateFileW) \
375 SymI_HasProto(WriteFile) \
376 SymI_HasProto(FormatMessageW) \
377 SymI_NeedsProto(_localtime64) \
378 SymI_NeedsProto(_tzname) \
379 SymI_NeedsProto(_timezone) \
380 SymI_HasProto(CreatePipe) \
381 SymI_HasProto(SetHandleInformation) \
382 SymI_HasProto(GetStdHandle) \
383 SymI_HasProto(GetCurrentProcess) \
384 SymI_HasProto(DuplicateHandle) \
385 SymI_HasProto(CreateProcessW) \
386 SymI_HasProto(TerminateProcess) \
387 SymI_HasProto(_open_osfhandle) \
388 SymI_HasProto(GetExitCodeProcess) \
389 RTS_MINGW_GETTIMEOFDAY_SYM \
390 SymI_NeedsProto(closedir)
391
392 #else
393 #define RTS_MINGW_ONLY_SYMBOLS /**/
394 #endif
395
396
397 #if defined(darwin_HOST_OS) && HAVE_PRINTF_LDBLSTUB
398 #define RTS_DARWIN_ONLY_SYMBOLS \
399 SymI_NeedsProto(asprintf$LDBLStub) \
400 SymI_NeedsProto(err$LDBLStub) \
401 SymI_NeedsProto(errc$LDBLStub) \
402 SymI_NeedsProto(errx$LDBLStub) \
403 SymI_NeedsProto(fprintf$LDBLStub) \
404 SymI_NeedsProto(fscanf$LDBLStub) \
405 SymI_NeedsProto(fwprintf$LDBLStub) \
406 SymI_NeedsProto(fwscanf$LDBLStub) \
407 SymI_NeedsProto(printf$LDBLStub) \
408 SymI_NeedsProto(scanf$LDBLStub) \
409 SymI_NeedsProto(snprintf$LDBLStub) \
410 SymI_NeedsProto(sprintf$LDBLStub) \
411 SymI_NeedsProto(sscanf$LDBLStub) \
412 SymI_NeedsProto(strtold$LDBLStub) \
413 SymI_NeedsProto(swprintf$LDBLStub) \
414 SymI_NeedsProto(swscanf$LDBLStub) \
415 SymI_NeedsProto(syslog$LDBLStub) \
416 SymI_NeedsProto(vasprintf$LDBLStub) \
417 SymI_NeedsProto(verr$LDBLStub) \
418 SymI_NeedsProto(verrc$LDBLStub) \
419 SymI_NeedsProto(verrx$LDBLStub) \
420 SymI_NeedsProto(vfprintf$LDBLStub) \
421 SymI_NeedsProto(vfscanf$LDBLStub) \
422 SymI_NeedsProto(vfwprintf$LDBLStub) \
423 SymI_NeedsProto(vfwscanf$LDBLStub) \
424 SymI_NeedsProto(vprintf$LDBLStub) \
425 SymI_NeedsProto(vscanf$LDBLStub) \
426 SymI_NeedsProto(vsnprintf$LDBLStub) \
427 SymI_NeedsProto(vsprintf$LDBLStub) \
428 SymI_NeedsProto(vsscanf$LDBLStub) \
429 SymI_NeedsProto(vswprintf$LDBLStub) \
430 SymI_NeedsProto(vswscanf$LDBLStub) \
431 SymI_NeedsProto(vsyslog$LDBLStub) \
432 SymI_NeedsProto(vwarn$LDBLStub) \
433 SymI_NeedsProto(vwarnc$LDBLStub) \
434 SymI_NeedsProto(vwarnx$LDBLStub) \
435 SymI_NeedsProto(vwprintf$LDBLStub) \
436 SymI_NeedsProto(vwscanf$LDBLStub) \
437 SymI_NeedsProto(warn$LDBLStub) \
438 SymI_NeedsProto(warnc$LDBLStub) \
439 SymI_NeedsProto(warnx$LDBLStub) \
440 SymI_NeedsProto(wcstold$LDBLStub) \
441 SymI_NeedsProto(wprintf$LDBLStub) \
442 SymI_NeedsProto(wscanf$LDBLStub)
443 #else
444 #define RTS_DARWIN_ONLY_SYMBOLS
445 #endif
446
447 #if defined(openbsd_HOST_OS)
448 #define RTS_OPENBSD_ONLY_SYMBOLS \
449 SymE_NeedsProto(__guard_local)
450 #else
451 #define RTS_OPENBSD_ONLY_SYMBOLS
452 #endif
453
454 #ifndef SMP
455 # define MAIN_CAP_SYM SymI_HasProto(MainCapability)
456 #else
457 # define MAIN_CAP_SYM
458 #endif
459
460 #if !defined(mingw32_HOST_OS)
461 #define RTS_USER_SIGNALS_SYMBOLS \
462 SymI_HasProto(setIOManagerControlFd) \
463 SymI_HasProto(setTimerManagerControlFd) \
464 SymI_HasProto(setIOManagerWakeupFd) \
465 SymI_HasProto(ioManagerWakeup) \
466 SymI_HasProto(blockUserSignals) \
467 SymI_HasProto(unblockUserSignals)
468 #else
469 #define RTS_USER_SIGNALS_SYMBOLS \
470 SymI_HasProto(ioManagerWakeup) \
471 SymI_HasProto(sendIOManagerEvent) \
472 SymI_HasProto(readIOManagerEvent) \
473 SymI_HasProto(getIOManagerEvent) \
474 SymI_HasProto(console_handler)
475 #endif
476
477 #define RTS_LIBFFI_SYMBOLS \
478 SymE_NeedsProto(ffi_prep_cif) \
479 SymE_NeedsProto(ffi_call) \
480 SymE_NeedsDataProto(ffi_type_void) \
481 SymE_NeedsDataProto(ffi_type_float) \
482 SymE_NeedsDataProto(ffi_type_double) \
483 SymE_NeedsDataProto(ffi_type_sint64) \
484 SymE_NeedsDataProto(ffi_type_uint64) \
485 SymE_NeedsDataProto(ffi_type_sint32) \
486 SymE_NeedsDataProto(ffi_type_uint32) \
487 SymE_NeedsDataProto(ffi_type_sint16) \
488 SymE_NeedsDataProto(ffi_type_uint16) \
489 SymE_NeedsDataProto(ffi_type_sint8) \
490 SymE_NeedsDataProto(ffi_type_uint8) \
491 SymE_NeedsDataProto(ffi_type_pointer)
492
493 #ifdef TABLES_NEXT_TO_CODE
494 #define RTS_RET_SYMBOLS /* nothing */
495 #else
496 #define RTS_RET_SYMBOLS \
497 SymI_HasProto(stg_enter_ret) \
498 SymI_HasProto(stg_gc_fun_ret) \
499 SymI_HasProto(stg_ap_v_ret) \
500 SymI_HasProto(stg_ap_f_ret) \
501 SymI_HasProto(stg_ap_d_ret) \
502 SymI_HasProto(stg_ap_l_ret) \
503 SymI_HasProto(stg_ap_v16_ret) \
504 SymI_HasProto(stg_ap_v32_ret) \
505 SymI_HasProto(stg_ap_v64_ret) \
506 SymI_HasProto(stg_ap_n_ret) \
507 SymI_HasProto(stg_ap_p_ret) \
508 SymI_HasProto(stg_ap_pv_ret) \
509 SymI_HasProto(stg_ap_pp_ret) \
510 SymI_HasProto(stg_ap_ppv_ret) \
511 SymI_HasProto(stg_ap_ppp_ret) \
512 SymI_HasProto(stg_ap_pppv_ret) \
513 SymI_HasProto(stg_ap_pppp_ret) \
514 SymI_HasProto(stg_ap_ppppp_ret) \
515 SymI_HasProto(stg_ap_pppppp_ret)
516 #endif
517
518 /* Modules compiled with -ticky may mention ticky counters */
519 /* This list should marry up with the one in $(TOP)/includes/stg/Ticky.h */
520 #define RTS_TICKY_SYMBOLS \
521 SymI_NeedsDataProto(ticky_entry_ctrs) \
522 SymI_NeedsDataProto(top_ct) \
523 \
524 SymI_HasProto(ENT_VIA_NODE_ctr) \
525 SymI_HasProto(ENT_STATIC_THK_SINGLE_ctr) \
526 SymI_HasProto(ENT_STATIC_THK_MANY_ctr) \
527 SymI_HasProto(ENT_DYN_THK_SINGLE_ctr) \
528 SymI_HasProto(ENT_DYN_THK_MANY_ctr) \
529 SymI_HasProto(ENT_STATIC_FUN_DIRECT_ctr) \
530 SymI_HasProto(ENT_DYN_FUN_DIRECT_ctr) \
531 SymI_HasProto(ENT_STATIC_CON_ctr) \
532 SymI_HasProto(ENT_DYN_CON_ctr) \
533 SymI_HasProto(ENT_STATIC_IND_ctr) \
534 SymI_HasProto(ENT_DYN_IND_ctr) \
535 SymI_HasProto(ENT_PERM_IND_ctr) \
536 SymI_HasProto(ENT_PAP_ctr) \
537 SymI_HasProto(ENT_AP_ctr) \
538 SymI_HasProto(ENT_AP_STACK_ctr) \
539 SymI_HasProto(ENT_BH_ctr) \
540 SymI_HasProto(ENT_LNE_ctr) \
541 SymI_HasProto(UNKNOWN_CALL_ctr) \
542 SymI_HasProto(SLOW_CALL_fast_v16_ctr) \
543 SymI_HasProto(SLOW_CALL_fast_v_ctr) \
544 SymI_HasProto(SLOW_CALL_fast_f_ctr) \
545 SymI_HasProto(SLOW_CALL_fast_d_ctr) \
546 SymI_HasProto(SLOW_CALL_fast_l_ctr) \
547 SymI_HasProto(SLOW_CALL_fast_n_ctr) \
548 SymI_HasProto(SLOW_CALL_fast_p_ctr) \
549 SymI_HasProto(SLOW_CALL_fast_pv_ctr) \
550 SymI_HasProto(SLOW_CALL_fast_pp_ctr) \
551 SymI_HasProto(SLOW_CALL_fast_ppv_ctr) \
552 SymI_HasProto(SLOW_CALL_fast_ppp_ctr) \
553 SymI_HasProto(SLOW_CALL_fast_pppv_ctr) \
554 SymI_HasProto(SLOW_CALL_fast_pppp_ctr) \
555 SymI_HasProto(SLOW_CALL_fast_ppppp_ctr) \
556 SymI_HasProto(SLOW_CALL_fast_pppppp_ctr) \
557 SymI_HasProto(VERY_SLOW_CALL_ctr) \
558 SymI_HasProto(ticky_slow_call_unevald) \
559 SymI_HasProto(SLOW_CALL_ctr) \
560 SymI_HasProto(MULTI_CHUNK_SLOW_CALL_ctr) \
561 SymI_HasProto(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr) \
562 SymI_HasProto(KNOWN_CALL_ctr) \
563 SymI_HasProto(KNOWN_CALL_TOO_FEW_ARGS_ctr) \
564 SymI_HasProto(KNOWN_CALL_EXTRA_ARGS_ctr) \
565 SymI_HasProto(SLOW_CALL_FUN_TOO_FEW_ctr) \
566 SymI_HasProto(SLOW_CALL_FUN_CORRECT_ctr) \
567 SymI_HasProto(SLOW_CALL_FUN_TOO_MANY_ctr) \
568 SymI_HasProto(SLOW_CALL_PAP_TOO_FEW_ctr) \
569 SymI_HasProto(SLOW_CALL_PAP_CORRECT_ctr) \
570 SymI_HasProto(SLOW_CALL_PAP_TOO_MANY_ctr) \
571 SymI_HasProto(SLOW_CALL_UNEVALD_ctr) \
572 SymI_HasProto(UPDF_OMITTED_ctr) \
573 SymI_HasProto(UPDF_PUSHED_ctr) \
574 SymI_HasProto(CATCHF_PUSHED_ctr) \
575 SymI_HasProto(UPDF_RCC_PUSHED_ctr) \
576 SymI_HasProto(UPDF_RCC_OMITTED_ctr) \
577 SymI_HasProto(UPD_SQUEEZED_ctr) \
578 SymI_HasProto(UPD_CON_IN_NEW_ctr) \
579 SymI_HasProto(UPD_CON_IN_PLACE_ctr) \
580 SymI_HasProto(UPD_PAP_IN_NEW_ctr) \
581 SymI_HasProto(UPD_PAP_IN_PLACE_ctr) \
582 SymI_HasProto(ALLOC_HEAP_ctr) \
583 SymI_HasProto(ALLOC_HEAP_tot) \
584 SymI_HasProto(HEAP_CHK_ctr) \
585 SymI_HasProto(STK_CHK_ctr) \
586 SymI_HasProto(ALLOC_RTS_ctr) \
587 SymI_HasProto(ALLOC_RTS_tot) \
588 SymI_HasProto(ALLOC_FUN_ctr) \
589 SymI_HasProto(ALLOC_FUN_adm) \
590 SymI_HasProto(ALLOC_FUN_gds) \
591 SymI_HasProto(ALLOC_FUN_slp) \
592 SymI_HasProto(UPD_NEW_IND_ctr) \
593 SymI_HasProto(UPD_NEW_PERM_IND_ctr) \
594 SymI_HasProto(UPD_OLD_IND_ctr) \
595 SymI_HasProto(UPD_OLD_PERM_IND_ctr) \
596 SymI_HasProto(UPD_CAF_BH_UPDATABLE_ctr) \
597 SymI_HasProto(UPD_CAF_BH_SINGLE_ENTRY_ctr) \
598 SymI_HasProto(GC_SEL_ABANDONED_ctr) \
599 SymI_HasProto(GC_SEL_MINOR_ctr) \
600 SymI_HasProto(GC_SEL_MAJOR_ctr) \
601 SymI_HasProto(GC_FAILED_PROMOTION_ctr) \
602 SymI_HasProto(ALLOC_UP_THK_ctr) \
603 SymI_HasProto(ALLOC_SE_THK_ctr) \
604 SymI_HasProto(ALLOC_THK_adm) \
605 SymI_HasProto(ALLOC_THK_gds) \
606 SymI_HasProto(ALLOC_THK_slp) \
607 SymI_HasProto(ALLOC_CON_ctr) \
608 SymI_HasProto(ALLOC_CON_adm) \
609 SymI_HasProto(ALLOC_CON_gds) \
610 SymI_HasProto(ALLOC_CON_slp) \
611 SymI_HasProto(ALLOC_TUP_ctr) \
612 SymI_HasProto(ALLOC_TUP_adm) \
613 SymI_HasProto(ALLOC_TUP_gds) \
614 SymI_HasProto(ALLOC_TUP_slp) \
615 SymI_HasProto(ALLOC_BH_ctr) \
616 SymI_HasProto(ALLOC_BH_adm) \
617 SymI_HasProto(ALLOC_BH_gds) \
618 SymI_HasProto(ALLOC_BH_slp) \
619 SymI_HasProto(ALLOC_PRIM_ctr) \
620 SymI_HasProto(ALLOC_PRIM_adm) \
621 SymI_HasProto(ALLOC_PRIM_gds) \
622 SymI_HasProto(ALLOC_PRIM_slp) \
623 SymI_HasProto(ALLOC_PAP_ctr) \
624 SymI_HasProto(ALLOC_PAP_adm) \
625 SymI_HasProto(ALLOC_PAP_gds) \
626 SymI_HasProto(ALLOC_PAP_slp) \
627 SymI_HasProto(ALLOC_TSO_ctr) \
628 SymI_HasProto(ALLOC_TSO_adm) \
629 SymI_HasProto(ALLOC_TSO_gds) \
630 SymI_HasProto(ALLOC_TSO_slp) \
631 SymI_HasProto(RET_NEW_ctr) \
632 SymI_HasProto(RET_OLD_ctr) \
633 SymI_HasProto(RET_UNBOXED_TUP_ctr) \
634 SymI_HasProto(RET_SEMI_loads_avoided)
635
636
637 // On most platforms, the garbage collector rewrites references
638 // to small integer and char objects to a set of common, shared ones.
639 //
640 // We don't do this when compiling to Windows DLLs at the moment because
641 // it doesn't support cross package data references well.
642 //
643 #if defined(COMPILING_WINDOWS_DLL)
644 #define RTS_INTCHAR_SYMBOLS
645 #else
646 #define RTS_INTCHAR_SYMBOLS \
647 SymI_HasProto(stg_CHARLIKE_closure) \
648 SymI_HasProto(stg_INTLIKE_closure)
649 #endif
650
651 #if defined(PROFILING)
652 #define RTS_PROF_SYMBOLS \
653 SymI_HasProto(CCS_DONT_CARE) \
654 SymI_HasProto(CC_LIST) \
655 SymI_HasProto(CC_ID) \
656 SymI_HasProto(CCS_LIST) \
657 SymI_HasProto(CCS_ID) \
658 SymI_HasProto(stg_restore_cccs_info) \
659 SymI_HasProto(enterFunCCS) \
660 SymI_HasProto(pushCostCentre) \
661 SymI_HasProto(era)
662 #else
663 #define RTS_PROF_SYMBOLS /* empty */
664 #endif
665
666 #define RTS_SYMBOLS \
667 Maybe_Stable_Names \
668 RTS_TICKY_SYMBOLS \
669 RTS_PROF_SYMBOLS \
670 SymI_HasProto(StgReturn) \
671 SymI_HasProto(stg_gc_noregs) \
672 SymI_HasProto(stg_ret_v_info) \
673 SymI_HasProto(stg_ret_p_info) \
674 SymI_HasProto(stg_ret_n_info) \
675 SymI_HasProto(stg_ret_f_info) \
676 SymI_HasProto(stg_ret_d_info) \
677 SymI_HasProto(stg_ret_l_info) \
678 SymI_HasProto(stg_gc_prim_p) \
679 SymI_HasProto(stg_gc_prim_pp) \
680 SymI_HasProto(stg_gc_prim_n) \
681 SymI_HasProto(stg_enter_info) \
682 SymI_HasProto(__stg_gc_enter_1) \
683 SymI_HasProto(stg_gc_unpt_r1) \
684 SymI_HasProto(stg_gc_unbx_r1) \
685 SymI_HasProto(stg_gc_f1) \
686 SymI_HasProto(stg_gc_d1) \
687 SymI_HasProto(stg_gc_l1) \
688 SymI_HasProto(stg_gc_pp) \
689 SymI_HasProto(stg_gc_ppp) \
690 SymI_HasProto(stg_gc_pppp) \
691 SymI_HasProto(__stg_gc_fun) \
692 SymI_HasProto(stg_gc_fun_info) \
693 SymI_HasProto(stg_yield_noregs) \
694 SymI_HasProto(stg_yield_to_interpreter) \
695 SymI_HasProto(stg_block_noregs) \
696 SymI_HasProto(stg_block_takemvar) \
697 SymI_HasProto(stg_block_readmvar) \
698 SymI_HasProto(stg_block_putmvar) \
699 MAIN_CAP_SYM \
700 SymI_HasProto(addDLL) \
701 SymI_HasProto(addLibrarySearchPath) \
702 SymI_HasProto(removeLibrarySearchPath) \
703 SymI_HasProto(__int_encodeDouble) \
704 SymI_HasProto(__word_encodeDouble) \
705 SymI_HasProto(__int_encodeFloat) \
706 SymI_HasProto(__word_encodeFloat) \
707 SymI_HasProto(stg_atomicallyzh) \
708 SymI_HasProto(barf) \
709 SymI_HasProto(deRefStablePtr) \
710 SymI_HasProto(debugBelch) \
711 SymI_HasProto(errorBelch) \
712 SymI_HasProto(sysErrorBelch) \
713 SymI_HasProto(stg_getMaskingStatezh) \
714 SymI_HasProto(stg_maskAsyncExceptionszh) \
715 SymI_HasProto(stg_maskUninterruptiblezh) \
716 SymI_HasProto(stg_catchzh) \
717 SymI_HasProto(stg_catchRetryzh) \
718 SymI_HasProto(stg_catchSTMzh) \
719 SymI_HasProto(stg_checkzh) \
720 SymI_HasProto(closure_flags) \
721 SymI_HasProto(cmp_thread) \
722 SymI_HasProto(createAdjustor) \
723 SymI_HasProto(stg_decodeDoublezu2Intzh) \
724 SymI_HasProto(stg_decodeDoublezuInt64zh) \
725 SymI_HasProto(stg_decodeFloatzuIntzh) \
726 SymI_HasProto(stg_delayzh) \
727 SymI_HasProto(stg_deRefWeakzh) \
728 SymI_HasProto(stg_deRefStablePtrzh) \
729 SymI_HasProto(dirty_MUT_VAR) \
730 SymI_HasProto(dirty_TVAR) \
731 SymI_HasProto(stg_forkzh) \
732 SymI_HasProto(stg_forkOnzh) \
733 SymI_HasProto(forkProcess) \
734 SymI_HasProto(forkOS_createThread) \
735 SymI_HasProto(freeHaskellFunctionPtr) \
736 SymI_HasProto(getOrSetGHCConcSignalSignalHandlerStore) \
737 SymI_HasProto(getOrSetGHCConcWindowsPendingDelaysStore) \
738 SymI_HasProto(getOrSetGHCConcWindowsIOManagerThreadStore) \
739 SymI_HasProto(getOrSetGHCConcWindowsProddingStore) \
740 SymI_HasProto(getOrSetSystemEventThreadEventManagerStore) \
741 SymI_HasProto(getOrSetSystemEventThreadIOManagerThreadStore) \
742 SymI_HasProto(getOrSetSystemTimerThreadEventManagerStore) \
743 SymI_HasProto(getOrSetSystemTimerThreadIOManagerThreadStore) \
744 SymI_HasProto(getOrSetLibHSghcFastStringTable) \
745 SymI_HasProto(getGCStats) \
746 SymI_HasProto(getGCStatsEnabled) \
747 SymI_HasProto(genericRaise) \
748 SymI_HasProto(getProgArgv) \
749 SymI_HasProto(getFullProgArgv) \
750 SymI_HasProto(getStablePtr) \
751 SymI_HasProto(foreignExportStablePtr) \
752 SymI_HasProto(hs_init) \
753 SymI_HasProto(hs_exit) \
754 SymI_HasProto(hs_set_argv) \
755 SymI_HasProto(hs_add_root) \
756 SymI_HasProto(hs_perform_gc) \
757 SymI_HasProto(hs_lock_stable_tables) \
758 SymI_HasProto(hs_unlock_stable_tables) \
759 SymI_HasProto(hs_free_stable_ptr) \
760 SymI_HasProto(hs_free_stable_ptr_unsafe) \
761 SymI_HasProto(hs_free_fun_ptr) \
762 SymI_HasProto(hs_hpc_rootModule) \
763 SymI_HasProto(hs_hpc_module) \
764 SymI_HasProto(initLinker) \
765 SymI_HasProto(initLinker_) \
766 SymI_HasProto(stg_unpackClosurezh) \
767 SymI_HasProto(stg_getApStackValzh) \
768 SymI_HasProto(stg_getSparkzh) \
769 SymI_HasProto(stg_numSparkszh) \
770 SymI_HasProto(stg_isCurrentThreadBoundzh) \
771 SymI_HasProto(stg_isEmptyMVarzh) \
772 SymI_HasProto(stg_killThreadzh) \
773 SymI_HasProto(loadArchive) \
774 SymI_HasProto(loadObj) \
775 SymI_HasProto(insertSymbol) \
776 SymI_HasProto(lookupSymbol) \
777 SymI_HasProto(stg_makeStablePtrzh) \
778 SymI_HasProto(stg_mkApUpd0zh) \
779 SymI_HasProto(stg_myThreadIdzh) \
780 SymI_HasProto(stg_labelThreadzh) \
781 SymI_HasProto(stg_newArrayzh) \
782 SymI_HasProto(stg_copyArrayzh) \
783 SymI_HasProto(stg_copyMutableArrayzh) \
784 SymI_HasProto(stg_copyArrayArrayzh) \
785 SymI_HasProto(stg_copyMutableArrayArrayzh) \
786 SymI_HasProto(stg_cloneArrayzh) \
787 SymI_HasProto(stg_cloneMutableArrayzh) \
788 SymI_HasProto(stg_freezzeArrayzh) \
789 SymI_HasProto(stg_thawArrayzh) \
790 SymI_HasProto(stg_newArrayArrayzh) \
791 SymI_HasProto(stg_casArrayzh) \
792 SymI_HasProto(stg_newSmallArrayzh) \
793 SymI_HasProto(stg_unsafeThawSmallArrayzh) \
794 SymI_HasProto(stg_cloneSmallArrayzh) \
795 SymI_HasProto(stg_cloneSmallMutableArrayzh) \
796 SymI_HasProto(stg_freezzeSmallArrayzh) \
797 SymI_HasProto(stg_thawSmallArrayzh) \
798 SymI_HasProto(stg_copySmallArrayzh) \
799 SymI_HasProto(stg_copySmallMutableArrayzh) \
800 SymI_HasProto(stg_casSmallArrayzh) \
801 SymI_HasProto(stg_newBCOzh) \
802 SymI_HasProto(stg_newByteArrayzh) \
803 SymI_HasProto(stg_casIntArrayzh) \
804 SymI_HasProto(stg_newMVarzh) \
805 SymI_HasProto(stg_newMutVarzh) \
806 SymI_HasProto(stg_newTVarzh) \
807 SymI_HasProto(stg_noDuplicatezh) \
808 SymI_HasProto(stg_atomicModifyMutVarzh) \
809 SymI_HasProto(stg_casMutVarzh) \
810 SymI_HasProto(stg_newPinnedByteArrayzh) \
811 SymI_HasProto(stg_newAlignedPinnedByteArrayzh) \
812 SymI_HasProto(stg_shrinkMutableByteArrayzh) \
813 SymI_HasProto(stg_resizzeMutableByteArrayzh) \
814 SymI_HasProto(newSpark) \
815 SymI_HasProto(performGC) \
816 SymI_HasProto(performMajorGC) \
817 SymI_HasProto(prog_argc) \
818 SymI_HasProto(prog_argv) \
819 SymI_HasProto(stg_putMVarzh) \
820 SymI_HasProto(stg_raisezh) \
821 SymI_HasProto(stg_raiseIOzh) \
822 SymI_HasProto(stg_readTVarzh) \
823 SymI_HasProto(stg_readTVarIOzh) \
824 SymI_HasProto(resumeThread) \
825 SymI_HasProto(setNumCapabilities) \
826 SymI_HasProto(getNumberOfProcessors) \
827 SymI_HasProto(resolveObjs) \
828 SymI_HasProto(stg_retryzh) \
829 SymI_HasProto(rts_apply) \
830 SymI_HasProto(rts_checkSchedStatus) \
831 SymI_HasProto(rts_eval) \
832 SymI_HasProto(rts_evalIO) \
833 SymI_HasProto(rts_evalLazyIO) \
834 SymI_HasProto(rts_evalStableIO) \
835 SymI_HasProto(rts_eval_) \
836 SymI_HasProto(rts_getBool) \
837 SymI_HasProto(rts_getChar) \
838 SymI_HasProto(rts_getDouble) \
839 SymI_HasProto(rts_getFloat) \
840 SymI_HasProto(rts_getInt) \
841 SymI_HasProto(rts_getInt8) \
842 SymI_HasProto(rts_getInt16) \
843 SymI_HasProto(rts_getInt32) \
844 SymI_HasProto(rts_getInt64) \
845 SymI_HasProto(rts_getPtr) \
846 SymI_HasProto(rts_getFunPtr) \
847 SymI_HasProto(rts_getStablePtr) \
848 SymI_HasProto(rts_getThreadId) \
849 SymI_HasProto(rts_getWord) \
850 SymI_HasProto(rts_getWord8) \
851 SymI_HasProto(rts_getWord16) \
852 SymI_HasProto(rts_getWord32) \
853 SymI_HasProto(rts_getWord64) \
854 SymI_HasProto(rts_lock) \
855 SymI_HasProto(rts_mkBool) \
856 SymI_HasProto(rts_mkChar) \
857 SymI_HasProto(rts_mkDouble) \
858 SymI_HasProto(rts_mkFloat) \
859 SymI_HasProto(rts_mkInt) \
860 SymI_HasProto(rts_mkInt8) \
861 SymI_HasProto(rts_mkInt16) \
862 SymI_HasProto(rts_mkInt32) \
863 SymI_HasProto(rts_mkInt64) \
864 SymI_HasProto(rts_mkPtr) \
865 SymI_HasProto(rts_mkFunPtr) \
866 SymI_HasProto(rts_mkStablePtr) \
867 SymI_HasProto(rts_mkString) \
868 SymI_HasProto(rts_mkWord) \
869 SymI_HasProto(rts_mkWord8) \
870 SymI_HasProto(rts_mkWord16) \
871 SymI_HasProto(rts_mkWord32) \
872 SymI_HasProto(rts_mkWord64) \
873 SymI_HasProto(rts_unlock) \
874 SymI_HasProto(rts_unsafeGetMyCapability) \
875 SymI_HasProto(rtsSupportsBoundThreads) \
876 SymI_HasProto(rts_isProfiled) \
877 SymI_HasProto(rts_isDynamic) \
878 SymI_HasProto(rts_getThreadAllocationCounter) \
879 SymI_HasProto(rts_setThreadAllocationCounter) \
880 SymI_HasProto(rts_enableThreadAllocationLimit) \
881 SymI_HasProto(rts_disableThreadAllocationLimit) \
882 SymI_HasProto(setProgArgv) \
883 SymI_HasProto(startupHaskell) \
884 SymI_HasProto(shutdownHaskell) \
885 SymI_HasProto(shutdownHaskellAndExit) \
886 SymI_HasProto(stable_name_table) \
887 SymI_HasProto(stable_ptr_table) \
888 SymI_HasProto(stackOverflow) \
889 SymI_HasProto(stg_CAF_BLACKHOLE_info) \
890 SymI_HasProto(stg_BLACKHOLE_info) \
891 SymI_HasProto(__stg_EAGER_BLACKHOLE_info) \
892 SymI_HasProto(stg_BLOCKING_QUEUE_CLEAN_info) \
893 SymI_HasProto(stg_BLOCKING_QUEUE_DIRTY_info) \
894 SymI_HasProto(startTimer) \
895 SymI_HasProto(stg_MVAR_CLEAN_info) \
896 SymI_HasProto(stg_MVAR_DIRTY_info) \
897 SymI_HasProto(stg_TVAR_CLEAN_info) \
898 SymI_HasProto(stg_TVAR_DIRTY_info) \
899 SymI_HasProto(stg_IND_STATIC_info) \
900 SymI_HasProto(stg_ARR_WORDS_info) \
901 SymI_HasProto(stg_MUT_ARR_PTRS_DIRTY_info) \
902 SymI_HasProto(stg_MUT_ARR_PTRS_FROZEN_info) \
903 SymI_HasProto(stg_MUT_ARR_PTRS_FROZEN0_info) \
904 SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_DIRTY_info) \
905 SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_FROZEN_info) \
906 SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_FROZEN0_info) \
907 SymI_HasProto(stg_MUT_VAR_CLEAN_info) \
908 SymI_HasProto(stg_MUT_VAR_DIRTY_info) \
909 SymI_HasProto(stg_WEAK_info) \
910 SymI_HasProto(stg_ap_v_info) \
911 SymI_HasProto(stg_ap_f_info) \
912 SymI_HasProto(stg_ap_d_info) \
913 SymI_HasProto(stg_ap_l_info) \
914 SymI_HasProto(stg_ap_v16_info) \
915 SymI_HasProto(stg_ap_v32_info) \
916 SymI_HasProto(stg_ap_v64_info) \
917 SymI_HasProto(stg_ap_n_info) \
918 SymI_HasProto(stg_ap_p_info) \
919 SymI_HasProto(stg_ap_pv_info) \
920 SymI_HasProto(stg_ap_pp_info) \
921 SymI_HasProto(stg_ap_ppv_info) \
922 SymI_HasProto(stg_ap_ppp_info) \
923 SymI_HasProto(stg_ap_pppv_info) \
924 SymI_HasProto(stg_ap_pppp_info) \
925 SymI_HasProto(stg_ap_ppppp_info) \
926 SymI_HasProto(stg_ap_pppppp_info) \
927 SymI_HasProto(stg_ap_0_fast) \
928 SymI_HasProto(stg_ap_v_fast) \
929 SymI_HasProto(stg_ap_f_fast) \
930 SymI_HasProto(stg_ap_d_fast) \
931 SymI_HasProto(stg_ap_l_fast) \
932 SymI_HasProto(stg_ap_v16_fast) \
933 SymI_HasProto(stg_ap_v32_fast) \
934 SymI_HasProto(stg_ap_v64_fast) \
935 SymI_HasProto(stg_ap_n_fast) \
936 SymI_HasProto(stg_ap_p_fast) \
937 SymI_HasProto(stg_ap_pv_fast) \
938 SymI_HasProto(stg_ap_pp_fast) \
939 SymI_HasProto(stg_ap_ppv_fast) \
940 SymI_HasProto(stg_ap_ppp_fast) \
941 SymI_HasProto(stg_ap_pppv_fast) \
942 SymI_HasProto(stg_ap_pppp_fast) \
943 SymI_HasProto(stg_ap_ppppp_fast) \
944 SymI_HasProto(stg_ap_pppppp_fast) \
945 SymI_HasProto(stg_ap_1_upd_info) \
946 SymI_HasProto(stg_ap_2_upd_info) \
947 SymI_HasProto(stg_ap_3_upd_info) \
948 SymI_HasProto(stg_ap_4_upd_info) \
949 SymI_HasProto(stg_ap_5_upd_info) \
950 SymI_HasProto(stg_ap_6_upd_info) \
951 SymI_HasProto(stg_ap_7_upd_info) \
952 SymI_HasProto(stg_exit) \
953 SymI_HasProto(stg_sel_0_upd_info) \
954 SymI_HasProto(stg_sel_1_upd_info) \
955 SymI_HasProto(stg_sel_2_upd_info) \
956 SymI_HasProto(stg_sel_3_upd_info) \
957 SymI_HasProto(stg_sel_4_upd_info) \
958 SymI_HasProto(stg_sel_5_upd_info) \
959 SymI_HasProto(stg_sel_6_upd_info) \
960 SymI_HasProto(stg_sel_7_upd_info) \
961 SymI_HasProto(stg_sel_8_upd_info) \
962 SymI_HasProto(stg_sel_9_upd_info) \
963 SymI_HasProto(stg_sel_10_upd_info) \
964 SymI_HasProto(stg_sel_11_upd_info) \
965 SymI_HasProto(stg_sel_12_upd_info) \
966 SymI_HasProto(stg_sel_13_upd_info) \
967 SymI_HasProto(stg_sel_14_upd_info) \
968 SymI_HasProto(stg_sel_15_upd_info) \
969 SymI_HasProto(stg_sel_0_noupd_info) \
970 SymI_HasProto(stg_sel_1_noupd_info) \
971 SymI_HasProto(stg_sel_2_noupd_info) \
972 SymI_HasProto(stg_sel_3_noupd_info) \
973 SymI_HasProto(stg_sel_4_noupd_info) \
974 SymI_HasProto(stg_sel_5_noupd_info) \
975 SymI_HasProto(stg_sel_6_noupd_info) \
976 SymI_HasProto(stg_sel_7_noupd_info) \
977 SymI_HasProto(stg_sel_8_noupd_info) \
978 SymI_HasProto(stg_sel_9_noupd_info) \
979 SymI_HasProto(stg_sel_10_noupd_info) \
980 SymI_HasProto(stg_sel_11_noupd_info) \
981 SymI_HasProto(stg_sel_12_noupd_info) \
982 SymI_HasProto(stg_sel_13_noupd_info) \
983 SymI_HasProto(stg_sel_14_noupd_info) \
984 SymI_HasProto(stg_sel_15_noupd_info) \
985 SymI_HasProto(stg_upd_frame_info) \
986 SymI_HasProto(stg_bh_upd_frame_info) \
987 SymI_HasProto(suspendThread) \
988 SymI_HasProto(stg_takeMVarzh) \
989 SymI_HasProto(stg_readMVarzh) \
990 SymI_HasProto(stg_threadStatuszh) \
991 SymI_HasProto(stg_tryPutMVarzh) \
992 SymI_HasProto(stg_tryTakeMVarzh) \
993 SymI_HasProto(stg_tryReadMVarzh) \
994 SymI_HasProto(stg_unmaskAsyncExceptionszh) \
995 SymI_HasProto(unloadObj) \
996 SymI_HasProto(stg_unsafeThawArrayzh) \
997 SymI_HasProto(stg_waitReadzh) \
998 SymI_HasProto(stg_waitWritezh) \
999 SymI_HasProto(stg_writeTVarzh) \
1000 SymI_HasProto(stg_yieldzh) \
1001 SymI_NeedsProto(stg_interp_constr_entry) \
1002 SymI_HasProto(stg_arg_bitmaps) \
1003 SymI_HasProto(large_alloc_lim) \
1004 SymI_HasProto(g0) \
1005 SymI_HasProto(allocate) \
1006 SymI_HasProto(allocateExec) \
1007 SymI_HasProto(flushExec) \
1008 SymI_HasProto(freeExec) \
1009 SymI_HasProto(getAllocations) \
1010 SymI_HasProto(revertCAFs) \
1011 SymI_HasProto(RtsFlags) \
1012 SymI_NeedsDataProto(rts_breakpoint_io_action) \
1013 SymI_NeedsDataProto(rts_stop_next_breakpoint) \
1014 SymI_NeedsDataProto(rts_stop_on_exception) \
1015 SymI_HasProto(stopTimer) \
1016 SymI_HasProto(n_capabilities) \
1017 SymI_HasProto(enabled_capabilities) \
1018 SymI_HasProto(stg_traceCcszh) \
1019 SymI_HasProto(stg_traceEventzh) \
1020 SymI_HasProto(stg_traceMarkerzh) \
1021 SymI_HasProto(getMonotonicNSec) \
1022 SymI_HasProto(lockFile) \
1023 SymI_HasProto(unlockFile) \
1024 SymI_HasProto(startProfTimer) \
1025 SymI_HasProto(stopProfTimer) \
1026 SymI_HasProto(atomic_inc) \
1027 SymI_HasProto(atomic_dec) \
1028 SymI_HasProto(hs_spt_lookup) \
1029 SymI_HasProto(hs_spt_insert) \
1030 SymI_HasProto(hs_spt_remove) \
1031 SymI_HasProto(hs_spt_keys) \
1032 SymI_HasProto(hs_spt_key_count) \
1033 RTS_USER_SIGNALS_SYMBOLS \
1034 RTS_INTCHAR_SYMBOLS
1035
1036
1037 // 64-bit support functions in libgcc.a
1038 #if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)
1039 #define RTS_LIBGCC_SYMBOLS \
1040 SymI_NeedsProto(__divdi3) \
1041 SymI_NeedsProto(__udivdi3) \
1042 SymI_NeedsProto(__moddi3) \
1043 SymI_NeedsProto(__umoddi3) \
1044 SymI_NeedsProto(__muldi3) \
1045 SymI_NeedsProto(__ashldi3) \
1046 SymI_NeedsProto(__ashrdi3) \
1047 SymI_NeedsProto(__lshrdi3) \
1048 SymI_NeedsProto(__fixunsdfdi)
1049 #else
1050 #define RTS_LIBGCC_SYMBOLS
1051 #endif
1052
1053 #if defined(darwin_HOST_OS) && defined(powerpc_HOST_ARCH)
1054 // Symbols that don't have a leading underscore
1055 // on Mac OS X. They have to receive special treatment,
1056 // see machoInitSymbolsWithoutUnderscore()
1057 #define RTS_MACHO_NOUNDERLINE_SYMBOLS \
1058 SymI_NeedsProto(saveFP) \
1059 SymI_NeedsProto(restFP)
1060 #endif
1061
1062 /* entirely bogus claims about types of these symbols */
1063 #define SymI_NeedsProto(vvv) extern void vvv(void);
1064 #define SymI_NeedsDataProto(vvv) extern StgWord vvv[];
1065 #if defined(COMPILING_WINDOWS_DLL)
1066 #define SymE_HasProto(vvv) SymE_HasProto(vvv);
1067 # if defined(x86_64_HOST_ARCH)
1068 # define SymE_NeedsProto(vvv) extern void __imp_ ## vvv (void);
1069 # define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
1070 # else
1071 # define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void);
1072 # define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv)
1073 # endif
1074 #else
1075 #define SymE_NeedsProto(vvv) SymI_NeedsProto(vvv);
1076 #define SymE_NeedsDataProto(vvv) SymI_NeedsDataProto(vvv);
1077 #define SymE_HasProto(vvv) SymI_HasProto(vvv)
1078 #endif
1079 #define SymI_HasProto(vvv) /**/
1080 #define SymI_HasProto_redirect(vvv,xxx) /**/
1081 RTS_SYMBOLS
1082 RTS_RET_SYMBOLS
1083 RTS_POSIX_ONLY_SYMBOLS
1084 RTS_MINGW_ONLY_SYMBOLS
1085 RTS_DARWIN_ONLY_SYMBOLS
1086 RTS_OPENBSD_ONLY_SYMBOLS
1087 RTS_LIBGCC_SYMBOLS
1088 RTS_LIBFFI_SYMBOLS
1089 #undef SymI_NeedsProto
1090 #undef SymI_NeedsDataProto
1091 #undef SymI_HasProto
1092 #undef SymI_HasProto_redirect
1093 #undef SymE_HasProto
1094 #undef SymE_HasDataProto
1095 #undef SymE_NeedsProto
1096 #undef SymE_NeedsDataProto
1097
1098 #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
1099 (void*)(&(vvv)) },
1100 #define SymI_HasDataProto(vvv) \
1101 SymI_HasProto(vvv)
1102 #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
1103 (void*)DLL_IMPORT_DATA_REF(vvv) },
1104 #define SymE_HasDataProto(vvv) \
1105 SymE_HasProto(vvv)
1106
1107 #define SymI_NeedsProto(vvv) SymI_HasProto(vvv)
1108 #define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv)
1109 #define SymE_NeedsProto(vvv) SymE_HasProto(vvv)
1110 #define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv)
1111
1112 // SymI_HasProto_redirect allows us to redirect references to one symbol to
1113 // another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example.
1114 #define SymI_HasProto_redirect(vvv,xxx) \
1115 { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
1116 (void*)(&(xxx)) },
1117
1118 RtsSymbolVal rtsSyms[] = {
1119 RTS_SYMBOLS
1120 RTS_RET_SYMBOLS
1121 RTS_POSIX_ONLY_SYMBOLS
1122 RTS_MINGW_ONLY_SYMBOLS
1123 RTS_DARWIN_ONLY_SYMBOLS
1124 RTS_OPENBSD_ONLY_SYMBOLS
1125 RTS_LIBGCC_SYMBOLS
1126 RTS_LIBFFI_SYMBOLS
1127 #if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
1128 // dyld stub code contains references to this,
1129 // but it should never be called because we treat
1130 // lazy pointers as nonlazy.
1131 { "dyld_stub_binding_helper", (void*)0xDEADBEEF },
1132 #endif
1133 { 0, 0 } /* sentinel */
1134 };