Linker.c 273 KB
Newer Older
1 2
/* -----------------------------------------------------------------------------
 *
Gabor Greif's avatar
typo  
Gabor Greif committed
3
 * (c) The GHC Team, 2000-2012
4 5 6 7 8
 *
 * RTS Object Linker
 *
 * ---------------------------------------------------------------------------*/

sof's avatar
sof committed
9
#if 0
10
#include "PosixSource.h"
sof's avatar
sof committed
11
#endif
12

13
/* Linux needs _GNU_SOURCE to get RTLD_DEFAULT from <dlfcn.h> and
14 15
   MREMAP_MAYMOVE from <sys/mman.h>.
 */
16 17
#if defined(__linux__)  || defined(__GLIBC__)
#define _GNU_SOURCE 1
18 19
#endif

20 21
#include "Rts.h"
#include "HsFFI.h"
Simon Marlow's avatar
Simon Marlow committed
22 23

#include "sm/Storage.h"
Simon Marlow's avatar
Simon Marlow committed
24
#include "Stats.h"
25
#include "Hash.h"
26
#include "LinkerInternals.h"
27
#include "RtsUtils.h"
28
#include "Trace.h"
Simon Marlow's avatar
Simon Marlow committed
29
#include "StgPrimFloat.h" // for __int_encodeFloat etc.
30
#include "Proftimer.h"
31
#include "GetEnv.h"
32
#include "Stable.h"
Simon Marlow's avatar
Simon Marlow committed
33 34 35 36

#if !defined(mingw32_HOST_OS)
#include "posix/Signals.h"
#endif
37

Simon Marlow's avatar
Simon Marlow committed
38 39 40
// get protos for is*()
#include <ctype.h>

41
#ifdef HAVE_SYS_TYPES_H
42
#include <sys/types.h>
43 44
#endif

Ian Lynagh's avatar
Ian Lynagh committed
45
#include <inttypes.h>
46 47
#include <stdlib.h>
#include <string.h>
48 49
#include <stdio.h>
#include <assert.h>
Simon Marlow's avatar
Simon Marlow committed
50
#include <libgen.h>
51

52
#ifdef HAVE_SYS_STAT_H
53
#include <sys/stat.h>
54
#endif
55

56
#if defined(HAVE_DLFCN_H)
57
#include <dlfcn.h>
58
#endif
59

60
#if defined(cygwin32_HOST_OS)
sof's avatar
sof committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif

#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <regex.h>
#include <sys/fcntl.h>
#include <sys/termios.h>
#include <sys/utime.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#endif

76 77 78
#if (defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) \
 || (!defined(powerpc_HOST_ARCH) && \
    (   defined(linux_HOST_OS)     || defined(freebsd_HOST_OS) || \
79 80
        defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \
        defined(openbsd_HOST_OS  ) || defined(darwin_HOST_OS ) || \
81
        defined(kfreebsdgnu_HOST_OS) || defined(gnu_HOST_OS)))
82
/* Don't use mmap on powerpc_HOST_ARCH as mmap doesn't support
83 84 85 86
 * reallocating but we need to allocate jump islands just after each
 * object images. Otherwise relative branches to jump islands can fail
 * due to 24-bits displacement overflow.
 */
87 88 89
#define USE_MMAP
#include <fcntl.h>
#include <sys/mman.h>
dons's avatar
dons committed
90 91 92 93 94

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

95 96
#endif

97 98 99 100 101 102 103 104 105 106

/* PowerPC has relative branch instructions with only 24 bit displacements
 * and therefore needs jump islands contiguous with each object code module.
 */
#if (defined(USE_MMAP) && defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS))
#define USE_CONTIGUOUS_MMAP 1
#else
#define USE_CONTIGUOUS_MMAP 0
#endif

pcapriotti's avatar
pcapriotti committed
107
#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS)
108
#  define OBJFORMAT_ELF
Ian Lynagh's avatar
Ian Lynagh committed
109 110
#  include <regex.h>    // regex is already used by dlopen() so this is OK
                        // to use here without requiring an additional lib
111
#elif defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
112
#  define OBJFORMAT_PEi386
113
#  include <windows.h>
114
#  include <shfolder.h> /* SHGetFolderPathW */
sof's avatar
sof committed
115
#  include <math.h>
116
#elif defined(darwin_HOST_OS)
117
#  define OBJFORMAT_MACHO
118
#  include <regex.h>
Ian Lynagh's avatar
Ian Lynagh committed
119 120
#  include <mach/machine.h>
#  include <mach-o/fat.h>
121 122 123
#  include <mach-o/loader.h>
#  include <mach-o/nlist.h>
#  include <mach-o/reloc.h>
124
#if !defined(HAVE_DLFCN_H)
125
#  include <mach-o/dyld.h>
126
#endif
127 128 129
#if defined(powerpc_HOST_ARCH)
#  include <mach-o/ppc/reloc.h>
#endif
130 131 132
#if defined(x86_64_HOST_ARCH)
#  include <mach-o/x86_64/reloc.h>
#endif
133 134
#endif

135 136 137 138
#if defined(x86_64_HOST_ARCH) && defined(darwin_HOST_OS)
#define ALWAYS_PIC
#endif

139 140 141 142
#if defined(dragonfly_HOST_OS)
#include <sys/tls.h>
#endif

143 144 145 146 147 148 149
typedef struct _RtsSymbolInfo {
    void *value;
    const ObjectCode *owner;
    HsBool weak;
} RtsSymbolInfo;

/* Hash table mapping symbol names to RtsSymbolInfo */
150
static /*Str*/HashTable *symhash;
151

152
/* List of currently loaded objects */
Ian Lynagh's avatar
Ian Lynagh committed
153
ObjectCode *objects = NULL;     /* initially empty */
154

155 156 157 158
/* List of objects that have been unloaded via unloadObj(), but are waiting
   to be actually freed via checkUnload() */
ObjectCode *unloaded_objects = NULL; /* initially empty */

159
#ifdef THREADED_RTS
160
/* This protects all the Linker's global state except unloaded_objects */
161
Mutex linker_mutex;
162 163 164 165
/*
 * This protects unloaded_objects.  We have a separate mutex for this, because
 * the GC needs to access unloaded_objects in checkUnload, while the linker only
 * needs to access unloaded_objects in unloadObj(), so this allows most linker
166
 * operations proceed concurrently with the GC.
167 168
 */
Mutex linker_unloaded_mutex;
169 170
#endif

171 172 173
/* Type of the initializer */
typedef void (*init_t) (int argc, char **argv, char **env);

174
static HsInt isAlreadyLoaded( pathchar *path );
175
static HsInt loadOc( ObjectCode* oc );
176
static ObjectCode* mkOc( pathchar *path, char *image, int imageSize,
177
                         char *archiveMemberName
178 179 180 181 182 183 184
#ifndef USE_MMAP
#ifdef darwin_HOST_OS
                       , int misalignment
#endif
#endif
                       );

185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
// Use wchar_t for pathnames on Windows (#5697)
#if defined(mingw32_HOST_OS)
#define pathcmp wcscmp
#define pathlen wcslen
#define pathopen _wfopen
#define pathstat _wstat
#define struct_stat struct _stat
#define open wopen
#define WSTR(s) L##s
#else
#define pathcmp strcmp
#define pathlen strlen
#define pathopen fopen
#define pathstat stat
#define struct_stat struct stat
#define WSTR(s) s
#endif

static pathchar* pathdup(pathchar *path)
{
    pathchar *ret;
#if defined(mingw32_HOST_OS)
    ret = wcsdup(path);
#else
    /* sigh, strdup() isn't a POSIX function, so do it the long way */
    ret = stgMallocBytes( strlen(path)+1, "loadObj" );
    strcpy(ret, path);
#endif
    return ret;
}


217
#if defined(OBJFORMAT_ELF)
218 219 220
static int ocVerifyImage_ELF    ( ObjectCode* oc );
static int ocGetNames_ELF       ( ObjectCode* oc );
static int ocResolve_ELF        ( ObjectCode* oc );
221
static int ocRunInit_ELF        ( ObjectCode* oc );
Ben Gamari's avatar
Ben Gamari committed
222
#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) || defined(arm_HOST_ARCH)
223
static int ocAllocateSymbolExtras_ELF ( ObjectCode* oc );
224
#endif
225
#elif defined(OBJFORMAT_PEi386)
226 227 228
static int ocVerifyImage_PEi386 ( ObjectCode* oc );
static int ocGetNames_PEi386    ( ObjectCode* oc );
static int ocResolve_PEi386     ( ObjectCode* oc );
229
static int ocRunInit_PEi386     ( ObjectCode* oc );
230
static void *lookupSymbolInDLLs ( unsigned char *lbl );
231 232 233 234
/* See Note [mingw-w64 name decoration scheme] */
#ifndef x86_64_HOST_ARCH
 static void zapTrailingAtSign   ( unsigned char *sym );
#endif
235
static char *allocateImageAndTrampolines (
Austin Seipp's avatar
Austin Seipp committed
236
   pathchar* arch_name, char* member_name,
237
#if defined(x86_64_HOST_ARCH)
Austin Seipp's avatar
Austin Seipp committed
238
   FILE* f,
239 240 241 242 243 244 245 246 247
#endif
   int size );
#if defined(x86_64_HOST_ARCH)
static int ocAllocateSymbolExtras_PEi386 ( ObjectCode* oc );
static size_t makeSymbolExtra_PEi386( ObjectCode* oc, size_t, char* symbol );
#define PEi386_IMAGE_OFFSET 4
#else
#define PEi386_IMAGE_OFFSET 0
#endif
248 249 250 251
#elif defined(OBJFORMAT_MACHO)
static int ocVerifyImage_MachO    ( ObjectCode* oc );
static int ocGetNames_MachO       ( ObjectCode* oc );
static int ocResolve_MachO        ( ObjectCode* oc );
252
static int ocRunInit_MachO        ( ObjectCode* oc );
253

Ian Lynagh's avatar
Ian Lynagh committed
254
#ifndef USE_MMAP
255
static int machoGetMisalignment( FILE * );
Ian Lynagh's avatar
Ian Lynagh committed
256
#endif
257 258 259
#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
static int ocAllocateSymbolExtras_MachO ( ObjectCode* oc );
#endif
260
#ifdef powerpc_HOST_ARCH
261
static void machoInitSymbolsWithoutUnderscore( void );
262
#endif
263
#endif
264

265 266
static void freeProddableBlocks (ObjectCode *oc);

267 268 269 270 271 272 273 274 275 276 277 278 279
/* on x86_64 we have a problem with relocating symbol references in
 * code that was compiled without -fPIC.  By default, the small memory
 * model is used, which assumes that symbol references can fit in a
 * 32-bit slot.  The system dynamic linker makes this work for
 * references to shared libraries by either (a) allocating a jump
 * table slot for code references, or (b) moving the symbol at load
 * time (and copying its contents, if necessary) for data references.
 *
 * We unfortunately can't tell whether symbol references are to code
 * or data.  So for now we assume they are code (the vast majority
 * are), and allocate jump-table slots.  Unfortunately this will
 * SILENTLY generate crashing code for data references.  This hack is
 * enabled by X86_64_ELF_NONPIC_HACK.
Ian Lynagh's avatar
Ian Lynagh committed
280
 *
281 282 283 284 285 286 287 288
 * One workaround is to use shared Haskell libraries.  This is
 * coming.  Another workaround is to keep the static libraries but
 * compile them with -fPIC, because that will generate PIC references
 * to data which can be relocated.  The PIC code is still too green to
 * do this systematically, though.
 *
 * See bug #781
 * See thread http://www.haskell.org/pipermail/cvs-ghc/2007-September/038458.html
289 290 291 292 293 294 295 296 297 298 299 300
 *
 * Naming Scheme for Symbol Macros
 *
 * SymI_*: symbol is internal to the RTS. It resides in an object
 *         file/library that is statically.
 * SymE_*: symbol is external to the RTS library. It might be linked
 *         dynamically.
 *
 * Sym*_HasProto  : the symbol prototype is imported in an include file
 *                  or defined explicitly
 * Sym*_NeedsProto: the symbol is undefined and we add a dummy
 *                  default proto extern void sym(void);
301 302
 */
#define X86_64_ELF_NONPIC_HACK 1
303

304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
/* Link objects into the lower 2Gb on x86_64.  GHC assumes the
 * small memory model on this architecture (see gcc docs,
 * -mcmodel=small).
 *
 * MAP_32BIT not available on OpenBSD/amd64
 */
#if defined(x86_64_HOST_ARCH) && defined(MAP_32BIT)
#define TRY_MAP_32BIT MAP_32BIT
#else
#define TRY_MAP_32BIT 0
#endif

/*
 * Due to the small memory model (see above), on x86_64 we have to map
 * all our non-PIC object files into the low 2Gb of the address space
 * (why 2Gb and not 4Gb?  Because all addresses must be reachable
 * using a 32-bit signed PC-relative offset). On Linux we can do this
 * using the MAP_32BIT flag to mmap(), however on other OSs
 * (e.g. *BSD, see #2063, and also on Linux inside Xen, see #2512), we
 * can't do this.  So on these systems, we have to pick a base address
 * in the low 2Gb of the address space and try to allocate memory from
 * there.
 *
 * We pick a default address based on the OS, but also make this
 * configurable via an RTS flag (+RTS -xm)
 */
330
#if !defined(ALWAYS_PIC) && defined(x86_64_HOST_ARCH)
331 332 333 334 335 336 337 338 339

#if defined(MAP_32BIT)
// Try to use MAP_32BIT
#define MMAP_32BIT_BASE_DEFAULT 0
#else
// A guess: 1Gb.
#define MMAP_32BIT_BASE_DEFAULT 0x40000000
#endif

Ian Lynagh's avatar
Ian Lynagh committed
340
static void *mmap_32bit_base = (void *)MMAP_32BIT_BASE_DEFAULT;
341 342 343 344 345 346 347
#endif

/* MAP_ANONYMOUS is MAP_ANON on some systems, e.g. OpenBSD */
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif

348 349 350 351
/* -----------------------------------------------------------------------------
 * Built-in symbols from the RTS
 */

352 353 354 355 356
typedef struct _RtsSymbolVal {
    char   *lbl;
    void   *addr;
} RtsSymbolVal;

Ian Lynagh's avatar
Ian Lynagh committed
357
#define Maybe_Stable_Names      SymI_HasProto(stg_mkWeakzh)                     \
358
                                SymI_HasProto(stg_mkWeakNoFinalizzerzh)         \
359
                                SymI_HasProto(stg_addCFinalizzerToWeakzh)       \
Ian Lynagh's avatar
Ian Lynagh committed
360 361
                                SymI_HasProto(stg_makeStableNamezh)             \
                                SymI_HasProto(stg_finalizzeWeakzh)
362

363
#if !defined (mingw32_HOST_OS)
364
#define RTS_POSIX_ONLY_SYMBOLS                  \
Ian Lynagh's avatar
Ian Lynagh committed
365 366 367 368 369
      SymI_HasProto(__hscore_get_saved_termios) \
      SymI_HasProto(__hscore_set_saved_termios) \
      SymI_HasProto(shutdownHaskellAndSignal)   \
      SymI_HasProto(signal_handlers)            \
      SymI_HasProto(stg_sig_install)            \
370
      SymI_HasProto(rtsTimerSignal)             \
Simon Marlow's avatar
Simon Marlow committed
371
      SymI_HasProto(atexit)                     \
372
      SymI_NeedsDataProto(nocldstop)
sof's avatar
sof committed
373
#endif
374

375
#if defined (cygwin32_HOST_OS)
sof's avatar
sof committed
376 377 378
#define RTS_MINGW_ONLY_SYMBOLS /**/
/* Don't have the ability to read import libs / archives, so
 * we have to stupidly list a lot of what libcygwin.a
379
 * exports; sigh.
sof's avatar
sof committed
380
 */
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
#define RTS_CYGWIN_ONLY_SYMBOLS                          \
      SymI_HasProto(regfree)                             \
      SymI_HasProto(regexec)                             \
      SymI_HasProto(regerror)                            \
      SymI_HasProto(regcomp)                             \
      SymI_HasProto(__errno)                             \
      SymI_HasProto(access)                              \
      SymI_HasProto(chmod)                               \
      SymI_HasProto(chdir)                               \
      SymI_HasProto(close)                               \
      SymI_HasProto(creat)                               \
      SymI_HasProto(dup)                                 \
      SymI_HasProto(dup2)                                \
      SymI_HasProto(fstat)                               \
      SymI_HasProto(fcntl)                               \
      SymI_HasProto(getcwd)                              \
      SymI_HasProto(getenv)                              \
      SymI_HasProto(lseek)                               \
      SymI_HasProto(open)                                \
      SymI_HasProto(fpathconf)                           \
      SymI_HasProto(pathconf)                            \
      SymI_HasProto(stat)                                \
      SymI_HasProto(pow)                                 \
      SymI_HasProto(tanh)                                \
      SymI_HasProto(cosh)                                \
      SymI_HasProto(sinh)                                \
      SymI_HasProto(atan)                                \
      SymI_HasProto(acos)                                \
      SymI_HasProto(asin)                                \
      SymI_HasProto(tan)                                 \
      SymI_HasProto(cos)                                 \
      SymI_HasProto(sin)                                 \
      SymI_HasProto(exp)                                 \
      SymI_HasProto(log)                                 \
      SymI_HasProto(sqrt)                                \
      SymI_HasProto(localtime_r)                         \
      SymI_HasProto(gmtime_r)                            \
      SymI_HasProto(mktime)                              \
      SymI_NeedsProto(_imp___tzname)                     \
      SymI_HasProto(gettimeofday)                        \
      SymI_HasProto(timezone)                            \
      SymI_HasProto(tcgetattr)                           \
      SymI_HasProto(tcsetattr)                           \
      SymI_HasProto(memcpy)                              \
      SymI_HasProto(memmove)                             \
      SymI_HasProto(realloc)                             \
      SymI_HasProto(malloc)                              \
      SymI_HasProto(free)                                \
      SymI_HasProto(fork)                                \
      SymI_HasProto(lstat)                               \
      SymI_HasProto(isatty)                              \
      SymI_HasProto(mkdir)                               \
      SymI_HasProto(opendir)                             \
      SymI_HasProto(readdir)                             \
      SymI_HasProto(rewinddir)                           \
      SymI_HasProto(closedir)                            \
      SymI_HasProto(link)                                \
      SymI_HasProto(mkfifo)                              \
      SymI_HasProto(pipe)                                \
      SymI_HasProto(read)                                \
      SymI_HasProto(rename)                              \
      SymI_HasProto(rmdir)                               \
      SymI_HasProto(select)                              \
      SymI_HasProto(system)                              \
      SymI_HasProto(write)                               \
      SymI_HasProto(strcmp)                              \
      SymI_HasProto(strcpy)                              \
      SymI_HasProto(strncpy)                             \
      SymI_HasProto(strerror)                            \
      SymI_HasProto(sigaddset)                           \
      SymI_HasProto(sigemptyset)                         \
      SymI_HasProto(sigprocmask)                         \
      SymI_HasProto(umask)                               \
      SymI_HasProto(uname)                               \
      SymI_HasProto(unlink)                              \
      SymI_HasProto(utime)                               \
      SymI_HasProto(waitpid)
458

Ian Lynagh's avatar
Ian Lynagh committed
459
#elif defined(mingw32_HOST_OS)
sof's avatar
sof committed
460 461
#define RTS_POSIX_ONLY_SYMBOLS  /**/
#define RTS_CYGWIN_ONLY_SYMBOLS /**/
462

463
#if HAVE_GETTIMEOFDAY
464
#define RTS_MINGW_GETTIMEOFDAY_SYM SymI_NeedsProto(gettimeofday)
465 466 467 468
#else
#define RTS_MINGW_GETTIMEOFDAY_SYM /**/
#endif

469 470 471 472 473 474
#if HAVE___MINGW_VFPRINTF
#define RTS___MINGW_VFPRINTF_SYM SymI_HasProto(__mingw_vfprintf)
#else
#define RTS___MINGW_VFPRINTF_SYM /**/
#endif

Ian Lynagh's avatar
Ian Lynagh committed
475
#if defined(i386_HOST_ARCH)
476
#define RTS_WIN32_ONLY(X) X
Ian Lynagh's avatar
Ian Lynagh committed
477
#else
478 479 480 481 482 483 484
#define RTS_WIN32_ONLY(X) /**/
#endif

#if defined(x86_64_HOST_ARCH)
#define RTS_WIN64_ONLY(X) X
#else
#define RTS_WIN64_ONLY(X) /**/
Ian Lynagh's avatar
Ian Lynagh committed
485 486
#endif

487 488
/* These are statically linked from the mingw libraries into the ghc
   executable, so we have to employ this hack. */
489
#define RTS_MINGW_ONLY_SYMBOLS                           \
Ian Lynagh's avatar
Ian Lynagh committed
490 491 492
      SymI_HasProto(stg_asyncReadzh)                     \
      SymI_HasProto(stg_asyncWritezh)                    \
      SymI_HasProto(stg_asyncDoProczh)                   \
493 494
      SymI_HasProto(getWin32ProgArgv)                    \
      SymI_HasProto(setWin32ProgArgv)                    \
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
      SymI_HasProto(memset)                              \
      SymI_HasProto(inet_ntoa)                           \
      SymI_HasProto(inet_addr)                           \
      SymI_HasProto(htonl)                               \
      SymI_HasProto(recvfrom)                            \
      SymI_HasProto(listen)                              \
      SymI_HasProto(bind)                                \
      SymI_HasProto(shutdown)                            \
      SymI_HasProto(connect)                             \
      SymI_HasProto(htons)                               \
      SymI_HasProto(ntohs)                               \
      SymI_HasProto(getservbyname)                       \
      SymI_HasProto(getservbyport)                       \
      SymI_HasProto(getprotobynumber)                    \
      SymI_HasProto(getprotobyname)                      \
      SymI_HasProto(gethostbyname)                       \
      SymI_HasProto(gethostbyaddr)                       \
      SymI_HasProto(gethostname)                         \
      SymI_HasProto(strcpy)                              \
      SymI_HasProto(strncpy)                             \
      SymI_HasProto(abort)                               \
Ian Lynagh's avatar
Ian Lynagh committed
516 517 518 519 520 521 522 523 524 525 526
      SymI_HasProto(isxdigit)                            \
      SymI_HasProto(isupper)                             \
      SymI_HasProto(ispunct)                             \
      SymI_HasProto(islower)                             \
      SymI_HasProto(isspace)                             \
      SymI_HasProto(isprint)                             \
      SymI_HasProto(isdigit)                             \
      SymI_HasProto(iscntrl)                             \
      SymI_HasProto(isalpha)                             \
      SymI_HasProto(isalnum)                             \
      SymI_HasProto(isascii)                             \
527
      RTS___MINGW_VFPRINTF_SYM                           \
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
      SymI_HasProto(strcmp)                              \
      SymI_HasProto(memmove)                             \
      SymI_HasProto(realloc)                             \
      SymI_HasProto(malloc)                              \
      SymI_HasProto(pow)                                 \
      SymI_HasProto(tanh)                                \
      SymI_HasProto(cosh)                                \
      SymI_HasProto(sinh)                                \
      SymI_HasProto(atan)                                \
      SymI_HasProto(acos)                                \
      SymI_HasProto(asin)                                \
      SymI_HasProto(tan)                                 \
      SymI_HasProto(cos)                                 \
      SymI_HasProto(sin)                                 \
      SymI_HasProto(exp)                                 \
      SymI_HasProto(log)                                 \
      SymI_HasProto(sqrt)                                \
      SymI_HasProto(powf)                                \
      SymI_HasProto(tanhf)                               \
      SymI_HasProto(coshf)                               \
      SymI_HasProto(sinhf)                               \
      SymI_HasProto(atanf)                               \
      SymI_HasProto(acosf)                               \
      SymI_HasProto(asinf)                               \
      SymI_HasProto(tanf)                                \
      SymI_HasProto(cosf)                                \
      SymI_HasProto(sinf)                                \
      SymI_HasProto(expf)                                \
      SymI_HasProto(logf)                                \
      SymI_HasProto(sqrtf)                               \
Ian Lynagh's avatar
Ian Lynagh committed
558
      SymI_HasProto(erf)                                 \
559 560 561
      SymI_HasProto(erfc)                                \
      SymI_HasProto(erff)                                \
      SymI_HasProto(erfcf)                               \
562 563 564 565 566 567 568 569 570
      SymI_HasProto(memcpy)                              \
      SymI_HasProto(rts_InstallConsoleEvent)             \
      SymI_HasProto(rts_ConsoleHandlerDone)              \
      SymI_NeedsProto(mktime)                            \
      SymI_NeedsProto(localtime)                         \
      SymI_NeedsProto(gmtime)                            \
      SymI_NeedsProto(opendir)                           \
      SymI_NeedsProto(readdir)                           \
      SymI_NeedsProto(rewinddir)                         \
571
      RTS_WIN32_ONLY(SymI_NeedsProto(__chkstk_ms))       \
572
      RTS_WIN64_ONLY(SymI_NeedsProto(___chkstk_ms))      \
573 574 575 576 577 578
      SymI_NeedsProto(localeconv)                        \
      SymI_HasProto(close)                               \
      SymI_HasProto(read)                                \
      SymI_HasProto(dup)                                 \
      SymI_HasProto(dup2)                                \
      SymI_HasProto(write)                               \
579
      SymI_NeedsProto(getpid)                            \
580
      SymI_HasProto(access)                              \
581
      SymI_HasProto(chmod)                               \
582 583
      SymI_HasProto(creat)                               \
      SymI_HasProto(umask)                               \
584
      SymI_HasProto(unlink)                              \
585 586 587 588 589 590 591
      SymI_HasProto(_errno)                              \
      SymI_NeedsProto(ftruncate64)                       \
      SymI_HasProto(setmode)                             \
      SymI_HasProto(_wstat64)                            \
      SymI_HasProto(_fstat64)                            \
      SymI_HasProto(_wsopen)                             \
      RTS_WIN32_ONLY(SymI_HasProto(_imp___environ))      \
592
      RTS_WIN64_ONLY(SymI_HasProto(__imp__environ))      \
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798
      RTS_WIN32_ONLY(SymI_HasProto(_imp___iob))          \
      RTS_WIN64_ONLY(SymI_HasProto(__iob_func))          \
      SymI_HasProto(GetFileAttributesA)                  \
      SymI_HasProto(GetFileInformationByHandle)          \
      SymI_HasProto(GetFileType)                         \
      SymI_HasProto(GetLastError)                        \
      SymI_HasProto(QueryPerformanceFrequency)           \
      SymI_HasProto(QueryPerformanceCounter)             \
      SymI_HasProto(GetTickCount)                        \
      SymI_HasProto(WaitForSingleObject)                 \
      SymI_HasProto(PeekConsoleInputA)                   \
      SymI_HasProto(ReadConsoleInputA)                   \
      SymI_HasProto(PeekNamedPipe)                       \
      SymI_HasProto(select)                              \
      SymI_HasProto(isatty)                              \
      SymI_HasProto(_get_osfhandle)                      \
      SymI_HasProto(GetConsoleMode)                      \
      SymI_HasProto(SetConsoleMode)                      \
      SymI_HasProto(FlushConsoleInputBuffer)             \
      SymI_HasProto(free)                                \
      SymI_NeedsProto(raise)                             \
      SymI_NeedsProto(_getpid)                           \
      SymI_HasProto(getc)                                \
      SymI_HasProto(ungetc)                              \
      SymI_HasProto(puts)                                \
      SymI_HasProto(putc)                                \
      SymI_HasProto(putchar)                             \
      SymI_HasProto(fputc)                               \
      SymI_HasProto(fread)                               \
      SymI_HasProto(fwrite)                              \
      SymI_HasProto(ferror)                              \
      SymI_HasProto(printf)                              \
      SymI_HasProto(fprintf)                             \
      SymI_HasProto(sprintf)                             \
      SymI_HasProto(vsprintf)                            \
      SymI_HasProto(sscanf)                              \
      SymI_HasProto(ldexp)                               \
      SymI_HasProto(strlen)                              \
      SymI_HasProto(strnlen)                             \
      SymI_HasProto(strchr)                              \
      SymI_HasProto(strtol)                              \
      SymI_HasProto(strerror)                            \
      SymI_HasProto(memchr)                              \
      SymI_HasProto(memcmp)                              \
      SymI_HasProto(wcscpy)                              \
      SymI_HasProto(wcslen)                              \
      SymI_HasProto(_lseeki64)                           \
      SymI_HasProto(_wchmod)                             \
      SymI_HasProto(closesocket)                         \
      SymI_HasProto(send)                                \
      SymI_HasProto(recv)                                \
      SymI_HasProto(bsearch)                             \
      SymI_HasProto(CommandLineToArgvW)                  \
      SymI_HasProto(CreateBitmap)                        \
      SymI_HasProto(CreateBitmapIndirect)                \
      SymI_HasProto(CreateCompatibleBitmap)              \
      SymI_HasProto(CreateDIBPatternBrushPt)             \
      SymI_HasProto(CreateDIBitmap)                      \
      SymI_HasProto(SetBitmapDimensionEx)                \
      SymI_HasProto(GetBitmapDimensionEx)                \
      SymI_HasProto(GetStockObject)                      \
      SymI_HasProto(GetObjectW)                          \
      SymI_HasProto(DeleteObject)                        \
      SymI_HasProto(SetDIBits)                           \
      SymI_HasProto(GetDIBits)                           \
      SymI_HasProto(CreateSolidBrush)                    \
      SymI_HasProto(CreateHatchBrush)                    \
      SymI_HasProto(CreatePatternBrush)                  \
      SymI_HasProto(CreateFontW)                         \
      SymI_HasProto(AngleArc)                            \
      SymI_HasProto(Arc)                                 \
      SymI_HasProto(ArcTo)                               \
      SymI_HasProto(BeginPath)                           \
      SymI_HasProto(BitBlt)                              \
      SymI_HasProto(CancelDC)                            \
      SymI_HasProto(Chord)                               \
      SymI_HasProto(CloseFigure)                         \
      SymI_HasProto(CombineRgn)                          \
      SymI_HasProto(CreateCompatibleDC)                  \
      SymI_HasProto(CreateEllipticRgn)                   \
      SymI_HasProto(CreateEllipticRgnIndirect)           \
      SymI_HasProto(CreatePen)                           \
      SymI_HasProto(CreatePolygonRgn)                    \
      SymI_HasProto(CreateRectRgn)                       \
      SymI_HasProto(CreateRectRgnIndirect)               \
      SymI_HasProto(CreateRoundRectRgn)                  \
      SymI_HasProto(DeleteDC)                            \
      SymI_HasProto(Ellipse)                             \
      SymI_HasProto(EndPath)                             \
      SymI_HasProto(EqualRgn)                            \
      SymI_HasProto(ExtSelectClipRgn)                    \
      SymI_HasProto(FillPath)                            \
      SymI_HasProto(FillRgn)                             \
      SymI_HasProto(FlattenPath)                         \
      SymI_HasProto(FrameRgn)                            \
      SymI_HasProto(GetArcDirection)                     \
      SymI_HasProto(GetBkColor)                          \
      SymI_HasProto(GetBkMode)                           \
      SymI_HasProto(GetBrushOrgEx)                       \
      SymI_HasProto(GetCurrentObject)                    \
      SymI_HasProto(GetDCOrgEx)                          \
      SymI_HasProto(GetGraphicsMode)                     \
      SymI_HasProto(GetMiterLimit)                       \
      SymI_HasProto(GetPolyFillMode)                     \
      SymI_HasProto(GetRgnBox)                           \
      SymI_HasProto(GetStretchBltMode)                   \
      SymI_HasProto(GetTextAlign)                        \
      SymI_HasProto(GetTextCharacterExtra)               \
      SymI_HasProto(GetTextColor)                        \
      SymI_HasProto(GetTextExtentPoint32W)               \
      SymI_HasProto(InvertRgn)                           \
      SymI_HasProto(LineTo)                              \
      SymI_HasProto(MaskBlt)                             \
      SymI_HasProto(MoveToEx)                            \
      SymI_HasProto(OffsetRgn)                           \
      SymI_HasProto(PaintRgn)                            \
      SymI_HasProto(PathToRegion)                        \
      SymI_HasProto(Pie)                                 \
      SymI_HasProto(PlgBlt)                              \
      SymI_HasProto(PolyBezier)                          \
      SymI_HasProto(PolyBezierTo)                        \
      SymI_HasProto(Polygon)                             \
      SymI_HasProto(Polyline)                            \
      SymI_HasProto(PolylineTo)                          \
      SymI_HasProto(PtInRegion)                          \
      SymI_HasProto(Rectangle)                           \
      SymI_HasProto(RectInRegion)                        \
      SymI_HasProto(RestoreDC)                           \
      SymI_HasProto(RoundRect)                           \
      SymI_HasProto(SaveDC)                              \
      SymI_HasProto(SelectClipPath)                      \
      SymI_HasProto(SelectClipRgn)                       \
      SymI_HasProto(SelectObject)                        \
      SymI_HasProto(SelectPalette)                       \
      SymI_HasProto(SetArcDirection)                     \
      SymI_HasProto(SetBkColor)                          \
      SymI_HasProto(SetBkMode)                           \
      SymI_HasProto(SetBrushOrgEx)                       \
      SymI_HasProto(SetGraphicsMode)                     \
      SymI_HasProto(SetMiterLimit)                       \
      SymI_HasProto(SetPolyFillMode)                     \
      SymI_HasProto(SetStretchBltMode)                   \
      SymI_HasProto(SetTextAlign)                        \
      SymI_HasProto(SetTextCharacterExtra)               \
      SymI_HasProto(SetTextColor)                        \
      SymI_HasProto(StretchBlt)                          \
      SymI_HasProto(StrokeAndFillPath)                   \
      SymI_HasProto(StrokePath)                          \
      SymI_HasProto(TextOutW)                            \
      SymI_HasProto(timeGetTime)                         \
      SymI_HasProto(WidenPath)                           \
      SymI_HasProto(GetFileSecurityW)                    \
      SymI_HasProto(RegCloseKey)                         \
      SymI_HasProto(RegConnectRegistryW)                 \
      SymI_HasProto(RegCreateKeyExW)                     \
      SymI_HasProto(RegCreateKeyW)                       \
      SymI_HasProto(RegDeleteKeyW)                       \
      SymI_HasProto(RegDeleteValueW)                     \
      SymI_HasProto(RegEnumKeyW)                         \
      SymI_HasProto(RegEnumValueW)                       \
      SymI_HasProto(RegFlushKey)                         \
      SymI_HasProto(RegLoadKeyW)                         \
      SymI_HasProto(RegNotifyChangeKeyValue)             \
      SymI_HasProto(RegOpenKeyExW)                       \
      SymI_HasProto(RegOpenKeyW)                         \
      SymI_HasProto(RegQueryInfoKeyW)                    \
      SymI_HasProto(RegQueryValueExW)                    \
      SymI_HasProto(RegQueryValueW)                      \
      SymI_HasProto(RegReplaceKeyW)                      \
      SymI_HasProto(RegRestoreKeyW)                      \
      SymI_HasProto(RegSaveKeyW)                         \
      SymI_HasProto(RegSetValueExW)                      \
      SymI_HasProto(RegSetValueW)                        \
      SymI_HasProto(RegUnLoadKeyW)                       \
      SymI_HasProto(SHGetFolderPathW)                    \
      RTS_WIN32_ONLY(SymI_HasProto(SetWindowLongW))      \
      RTS_WIN32_ONLY(SymI_HasProto(GetWindowLongW))      \
      RTS_WIN64_ONLY(SymI_HasProto(SetWindowLongPtrW))   \
      RTS_WIN64_ONLY(SymI_HasProto(GetWindowLongPtrW))   \
      SymI_HasProto(MenuItemFromPoint)                   \
      SymI_HasProto(ChildWindowFromPoint)                \
      SymI_HasProto(ChildWindowFromPointEx)              \
      SymI_HasProto(UnmapViewOfFile)                     \
      SymI_HasProto(CloseHandle)                         \
      SymI_HasProto(FreeLibrary)                         \
      SymI_HasProto(GetMessageW)                         \
      SymI_HasProto(TranslateMessage)                    \
      SymI_HasProto(DispatchMessageW)                    \
      SymI_HasProto(DefWindowProcW)                      \
      SymI_HasProto(GlobalAlloc)                         \
      SymI_HasProto(GlobalFree)                          \
      SymI_HasProto(CreateFileW)                         \
      SymI_HasProto(WriteFile)                           \
      SymI_HasProto(FormatMessageW)                      \
      SymI_NeedsProto(_localtime64)                      \
      SymI_NeedsProto(_tzname)                           \
      SymI_NeedsProto(_timezone)                         \
      SymI_HasProto(CreatePipe)                          \
      SymI_HasProto(SetHandleInformation)                \
      SymI_HasProto(GetStdHandle)                        \
      SymI_HasProto(GetCurrentProcess)                   \
      SymI_HasProto(DuplicateHandle)                     \
      SymI_HasProto(CreateProcessW)                      \
      SymI_HasProto(TerminateProcess)                    \
      SymI_HasProto(_open_osfhandle)                     \
      SymI_HasProto(GetExitCodeProcess)                  \
Ian Lynagh's avatar
Ian Lynagh committed
799
      RTS_MINGW_GETTIMEOFDAY_SYM                         \
800
      SymI_NeedsProto(closedir)
Ian Lynagh's avatar
Ian Lynagh committed
801 802 803 804

#else
#define RTS_MINGW_ONLY_SYMBOLS /**/
#define RTS_CYGWIN_ONLY_SYMBOLS /**/
805
#endif
806

807

808
#if defined(darwin_HOST_OS) && HAVE_PRINTF_LDBLSTUB
Ian Lynagh's avatar
Ian Lynagh committed
809
#define RTS_DARWIN_ONLY_SYMBOLS                             \
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853
     SymI_NeedsProto(asprintf$LDBLStub)                     \
     SymI_NeedsProto(err$LDBLStub)                          \
     SymI_NeedsProto(errc$LDBLStub)                         \
     SymI_NeedsProto(errx$LDBLStub)                         \
     SymI_NeedsProto(fprintf$LDBLStub)                      \
     SymI_NeedsProto(fscanf$LDBLStub)                       \
     SymI_NeedsProto(fwprintf$LDBLStub)                     \
     SymI_NeedsProto(fwscanf$LDBLStub)                      \
     SymI_NeedsProto(printf$LDBLStub)                       \
     SymI_NeedsProto(scanf$LDBLStub)                        \
     SymI_NeedsProto(snprintf$LDBLStub)                     \
     SymI_NeedsProto(sprintf$LDBLStub)                      \
     SymI_NeedsProto(sscanf$LDBLStub)                       \
     SymI_NeedsProto(strtold$LDBLStub)                      \
     SymI_NeedsProto(swprintf$LDBLStub)                     \
     SymI_NeedsProto(swscanf$LDBLStub)                      \
     SymI_NeedsProto(syslog$LDBLStub)                       \
     SymI_NeedsProto(vasprintf$LDBLStub)                    \
     SymI_NeedsProto(verr$LDBLStub)                         \
     SymI_NeedsProto(verrc$LDBLStub)                        \
     SymI_NeedsProto(verrx$LDBLStub)                        \
     SymI_NeedsProto(vfprintf$LDBLStub)                     \
     SymI_NeedsProto(vfscanf$LDBLStub)                      \
     SymI_NeedsProto(vfwprintf$LDBLStub)                    \
     SymI_NeedsProto(vfwscanf$LDBLStub)                     \
     SymI_NeedsProto(vprintf$LDBLStub)                      \
     SymI_NeedsProto(vscanf$LDBLStub)                       \
     SymI_NeedsProto(vsnprintf$LDBLStub)                    \
     SymI_NeedsProto(vsprintf$LDBLStub)                     \
     SymI_NeedsProto(vsscanf$LDBLStub)                      \
     SymI_NeedsProto(vswprintf$LDBLStub)                    \
     SymI_NeedsProto(vswscanf$LDBLStub)                     \
     SymI_NeedsProto(vsyslog$LDBLStub)                      \
     SymI_NeedsProto(vwarn$LDBLStub)                        \
     SymI_NeedsProto(vwarnc$LDBLStub)                       \
     SymI_NeedsProto(vwarnx$LDBLStub)                       \
     SymI_NeedsProto(vwprintf$LDBLStub)                     \
     SymI_NeedsProto(vwscanf$LDBLStub)                      \
     SymI_NeedsProto(warn$LDBLStub)                         \
     SymI_NeedsProto(warnc$LDBLStub)                        \
     SymI_NeedsProto(warnx$LDBLStub)                        \
     SymI_NeedsProto(wcstold$LDBLStub)                      \
     SymI_NeedsProto(wprintf$LDBLStub)                      \
     SymI_NeedsProto(wscanf$LDBLStub)
854 855 856 857
#else
#define RTS_DARWIN_ONLY_SYMBOLS
#endif

sof's avatar
sof committed
858
#ifndef SMP
859
# define MAIN_CAP_SYM SymI_HasProto(MainCapability)
sof's avatar
sof committed
860 861 862
#else
# define MAIN_CAP_SYM
#endif
863

sof's avatar
sof committed
864
#if !defined(mingw32_HOST_OS)
Ian Lynagh's avatar
Ian Lynagh committed
865
#define RTS_USER_SIGNALS_SYMBOLS        \
866
   SymI_HasProto(setIOManagerControlFd) \
867
   SymI_HasProto(setTimerManagerControlFd) \
Ian Lynagh's avatar
Ian Lynagh committed
868 869 870
   SymI_HasProto(setIOManagerWakeupFd)  \
   SymI_HasProto(ioManagerWakeup)       \
   SymI_HasProto(blockUserSignals)      \
871
   SymI_HasProto(unblockUserSignals)
sof's avatar
sof committed
872
#else
Ian Lynagh's avatar
Ian Lynagh committed
873 874 875 876 877
#define RTS_USER_SIGNALS_SYMBOLS        \
   SymI_HasProto(ioManagerWakeup)       \
   SymI_HasProto(sendIOManagerEvent)    \
   SymI_HasProto(readIOManagerEvent)    \
   SymI_HasProto(getIOManagerEvent)     \
878
   SymI_HasProto(console_handler)
sof's avatar
sof committed
879 880
#endif

881 882 883
#define RTS_LIBFFI_SYMBOLS                                  \
     SymE_NeedsProto(ffi_prep_cif)                          \
     SymE_NeedsProto(ffi_call)                              \
884 885 886 887 888 889 890 891 892 893 894 895
     SymE_NeedsDataProto(ffi_type_void)                     \
     SymE_NeedsDataProto(ffi_type_float)                    \
     SymE_NeedsDataProto(ffi_type_double)                   \
     SymE_NeedsDataProto(ffi_type_sint64)                   \
     SymE_NeedsDataProto(ffi_type_uint64)                   \
     SymE_NeedsDataProto(ffi_type_sint32)                   \
     SymE_NeedsDataProto(ffi_type_uint32)                   \
     SymE_NeedsDataProto(ffi_type_sint16)                   \
     SymE_NeedsDataProto(ffi_type_uint16)                   \
     SymE_NeedsDataProto(ffi_type_sint8)                    \
     SymE_NeedsDataProto(ffi_type_uint8)                    \
     SymE_NeedsDataProto(ffi_type_pointer)
896

897 898 899
#ifdef TABLES_NEXT_TO_CODE
#define RTS_RET_SYMBOLS /* nothing */
#else
Ian Lynagh's avatar
Ian Lynagh committed
900 901 902 903 904 905 906
#define RTS_RET_SYMBOLS                                 \
      SymI_HasProto(stg_enter_ret)                      \
      SymI_HasProto(stg_gc_fun_ret)                     \
      SymI_HasProto(stg_ap_v_ret)                       \
      SymI_HasProto(stg_ap_f_ret)                       \
      SymI_HasProto(stg_ap_d_ret)                       \
      SymI_HasProto(stg_ap_l_ret)                       \
907
      SymI_HasProto(stg_ap_v16_ret)                     \
908
      SymI_HasProto(stg_ap_v32_ret)                     \
909
      SymI_HasProto(stg_ap_v64_ret)                     \
Ian Lynagh's avatar
Ian Lynagh committed
910 911 912 913 914 915 916 917 918
      SymI_HasProto(stg_ap_n_ret)                       \
      SymI_HasProto(stg_ap_p_ret)                       \
      SymI_HasProto(stg_ap_pv_ret)                      \
      SymI_HasProto(stg_ap_pp_ret)                      \
      SymI_HasProto(stg_ap_ppv_ret)                     \
      SymI_HasProto(stg_ap_ppp_ret)                     \
      SymI_HasProto(stg_ap_pppv_ret)                    \
      SymI_HasProto(stg_ap_pppp_ret)                    \
      SymI_HasProto(stg_ap_ppppp_ret)                   \
919
      SymI_HasProto(stg_ap_pppppp_ret)
920 921
#endif

922 923
/* Modules compiled with -ticky may mention ticky counters */
/* This list should marry up with the one in $(TOP)/includes/stg/Ticky.h */
Ian Lynagh's avatar
Ian Lynagh committed
924
#define RTS_TICKY_SYMBOLS                               \
925 926
      SymI_NeedsDataProto(ticky_entry_ctrs)             \
      SymI_NeedsDataProto(top_ct)                       \
Ian Lynagh's avatar
Ian Lynagh committed
927 928
                                                        \
      SymI_HasProto(ENT_VIA_NODE_ctr)                   \
929 930 931 932
      SymI_HasProto(ENT_STATIC_THK_SINGLE_ctr)          \
      SymI_HasProto(ENT_STATIC_THK_MANY_ctr)            \
      SymI_HasProto(ENT_DYN_THK_SINGLE_ctr)             \
      SymI_HasProto(ENT_DYN_THK_MANY_ctr)               \
Ian Lynagh's avatar
Ian Lynagh committed
933 934 935 936 937 938 939 940 941 942 943
      SymI_HasProto(ENT_STATIC_FUN_DIRECT_ctr)          \
      SymI_HasProto(ENT_DYN_FUN_DIRECT_ctr)             \
      SymI_HasProto(ENT_STATIC_CON_ctr)                 \
      SymI_HasProto(ENT_DYN_CON_ctr)                    \
      SymI_HasProto(ENT_STATIC_IND_ctr)                 \
      SymI_HasProto(ENT_DYN_IND_ctr)                    \
      SymI_HasProto(ENT_PERM_IND_ctr)                   \
      SymI_HasProto(ENT_PAP_ctr)                        \
      SymI_HasProto(ENT_AP_ctr)                         \
      SymI_HasProto(ENT_AP_STACK_ctr)                   \
      SymI_HasProto(ENT_BH_ctr)                         \
nfrisby's avatar
nfrisby committed
944
      SymI_HasProto(ENT_LNE_ctr)                        \
Ian Lynagh's avatar
Ian Lynagh committed
945
      SymI_HasProto(UNKNOWN_CALL_ctr)                   \
nfrisby's avatar
nfrisby committed
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961
      SymI_HasProto(SLOW_CALL_fast_v16_ctr)                  \
      SymI_HasProto(SLOW_CALL_fast_v_ctr)                    \
      SymI_HasProto(SLOW_CALL_fast_f_ctr)                    \
      SymI_HasProto(SLOW_CALL_fast_d_ctr)                    \
      SymI_HasProto(SLOW_CALL_fast_l_ctr)                    \
      SymI_HasProto(SLOW_CALL_fast_n_ctr)                    \
      SymI_HasProto(SLOW_CALL_fast_p_ctr)                    \
      SymI_HasProto(SLOW_CALL_fast_pv_ctr)                   \
      SymI_HasProto(SLOW_CALL_fast_pp_ctr)                   \
      SymI_HasProto(SLOW_CALL_fast_ppv_ctr)                  \
      SymI_HasProto(SLOW_CALL_fast_ppp_ctr)                  \
      SymI_HasProto(SLOW_CALL_fast_pppv_ctr)                 \
      SymI_HasProto(SLOW_CALL_fast_pppp_ctr)                 \
      SymI_HasProto(SLOW_CALL_fast_ppppp_ctr)                \
      SymI_HasProto(SLOW_CALL_fast_pppppp_ctr)               \
      SymI_HasProto(VERY_SLOW_CALL_ctr)                \
962
      SymI_HasProto(ticky_slow_call_unevald)            \
Ian Lynagh's avatar
Ian Lynagh committed
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987
      SymI_HasProto(SLOW_CALL_ctr)                      \
      SymI_HasProto(MULTI_CHUNK_SLOW_CALL_ctr)          \
      SymI_HasProto(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr)   \
      SymI_HasProto(KNOWN_CALL_ctr)                     \
      SymI_HasProto(KNOWN_CALL_TOO_FEW_ARGS_ctr)        \
      SymI_HasProto(KNOWN_CALL_EXTRA_ARGS_ctr)          \
      SymI_HasProto(SLOW_CALL_FUN_TOO_FEW_ctr)          \
      SymI_HasProto(SLOW_CALL_FUN_CORRECT_ctr)          \
      SymI_HasProto(SLOW_CALL_FUN_TOO_MANY_ctr)         \
      SymI_HasProto(SLOW_CALL_PAP_TOO_FEW_ctr)          \
      SymI_HasProto(SLOW_CALL_PAP_CORRECT_ctr)          \
      SymI_HasProto(SLOW_CALL_PAP_TOO_MANY_ctr)         \
      SymI_HasProto(SLOW_CALL_UNEVALD_ctr)              \
      SymI_HasProto(UPDF_OMITTED_ctr)                   \
      SymI_HasProto(UPDF_PUSHED_ctr)                    \
      SymI_HasProto(CATCHF_PUSHED_ctr)                  \
      SymI_HasProto(UPDF_RCC_PUSHED_ctr)                \
      SymI_HasProto(UPDF_RCC_OMITTED_ctr)               \
      SymI_HasProto(UPD_SQUEEZED_ctr)                   \
      SymI_HasProto(UPD_CON_IN_NEW_ctr)                 \
      SymI_HasProto(UPD_CON_IN_PLACE_ctr)               \
      SymI_HasProto(UPD_PAP_IN_NEW_ctr)                 \
      SymI_HasProto(UPD_PAP_IN_PLACE_ctr)               \
      SymI_HasProto(ALLOC_HEAP_ctr)                     \
      SymI_HasProto(ALLOC_HEAP_tot)                     \
Austin Seipp's avatar
Austin Seipp committed
988
      SymI_HasProto(HEAP_CHK_ctr)                       \
989
      SymI_HasProto(STK_CHK_ctr)                        \
nfrisby's avatar
nfrisby committed
990 991
      SymI_HasProto(ALLOC_RTS_ctr)                      \
      SymI_HasProto(ALLOC_RTS_tot)                      \
Ian Lynagh's avatar
Ian Lynagh committed
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037
      SymI_HasProto(ALLOC_FUN_ctr)                      \
      SymI_HasProto(ALLOC_FUN_adm)                      \
      SymI_HasProto(ALLOC_FUN_gds)                      \
      SymI_HasProto(ALLOC_FUN_slp)                      \
      SymI_HasProto(UPD_NEW_IND_ctr)                    \
      SymI_HasProto(UPD_NEW_PERM_IND_ctr)               \
      SymI_HasProto(UPD_OLD_IND_ctr)                    \
      SymI_HasProto(UPD_OLD_PERM_IND_ctr)               \
      SymI_HasProto(UPD_CAF_BH_UPDATABLE_ctr)           \
      SymI_HasProto(UPD_CAF_BH_SINGLE_ENTRY_ctr)        \
      SymI_HasProto(GC_SEL_ABANDONED_ctr)               \
      SymI_HasProto(GC_SEL_MINOR_ctr)                   \
      SymI_HasProto(GC_SEL_MAJOR_ctr)                   \
      SymI_HasProto(GC_FAILED_PROMOTION_ctr)            \
      SymI_HasProto(ALLOC_UP_THK_ctr)                   \
      SymI_HasProto(ALLOC_SE_THK_ctr)                   \
      SymI_HasProto(ALLOC_THK_adm)                      \
      SymI_HasProto(ALLOC_THK_gds)                      \
      SymI_HasProto(ALLOC_THK_slp)                      \
      SymI_HasProto(ALLOC_CON_ctr)                      \
      SymI_HasProto(ALLOC_CON_adm)                      \
      SymI_HasProto(ALLOC_CON_gds)                      \
      SymI_HasProto(ALLOC_CON_slp)                      \
      SymI_HasProto(ALLOC_TUP_ctr)                      \
      SymI_HasProto(ALLOC_TUP_adm)                      \
      SymI_HasProto(ALLOC_TUP_gds)                      \
      SymI_HasProto(ALLOC_TUP_slp)                      \
      SymI_HasProto(ALLOC_BH_ctr)                       \
      SymI_HasProto(ALLOC_BH_adm)                       \
      SymI_HasProto(ALLOC_BH_gds)                       \
      SymI_HasProto(ALLOC_BH_slp)                       \
      SymI_HasProto(ALLOC_PRIM_ctr)                     \
      SymI_HasProto(ALLOC_PRIM_adm)                     \
      SymI_HasProto(ALLOC_PRIM_gds)                     \
      SymI_HasProto(ALLOC_PRIM_slp)                     \
      SymI_HasProto(ALLOC_PAP_ctr)                      \
      SymI_HasProto(ALLOC_PAP_adm)                      \
      SymI_HasProto(ALLOC_PAP_gds)                      \
      SymI_HasProto(ALLOC_PAP_slp)                      \
      SymI_HasProto(ALLOC_TSO_ctr)                      \
      SymI_HasProto(ALLOC_TSO_adm)                      \
      SymI_HasProto(ALLOC_TSO_gds)                      \
      SymI_HasProto(ALLOC_TSO_slp)                      \
      SymI_HasProto(RET_NEW_ctr)                        \
      SymI_HasProto(RET_OLD_ctr)                        \
      SymI_HasProto(RET_UNBOXED_TUP_ctr)                \
1038 1039 1040
      SymI_HasProto(RET_SEMI_loads_avoided)


1041
// On most platforms, the garbage collector rewrites references
Ian Lynagh's avatar
Ian Lynagh committed
1042
//      to small integer and char objects to a set of common, shared ones.
1043 1044
//
// We don't do this when compiling to Windows DLLs at the moment because
Ian Lynagh's avatar
Ian Lynagh committed
1045
//      it doesn't support cross package data references well.
1046
//
1047
#if defined(COMPILING_WINDOWS_DLL)
1048 1049
#define RTS_INTCHAR_SYMBOLS
#else
Ian Lynagh's avatar
Ian Lynagh committed
1050
#define RTS_INTCHAR_SYMBOLS                             \
1051 1052
      SymI_HasProto(stg_CHARLIKE_closure)               \
      SymI_HasProto(stg_INTLIKE_closure)
1053 1054 1055
#endif


1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
#define RTS_SYMBOLS                                                     \
      Maybe_Stable_Names                                                \
      RTS_TICKY_SYMBOLS                                                 \
      SymI_HasProto(StgReturn)                                          \
      SymI_HasProto(stg_gc_noregs)                                      \
      SymI_HasProto(stg_ret_v_info)                                     \
      SymI_HasProto(stg_ret_p_info)                                     \
      SymI_HasProto(stg_ret_n_info)                                     \
      SymI_HasProto(stg_ret_f_info)                                     \
      SymI_HasProto(stg_ret_d_info)                                     \
      SymI_HasProto(stg_ret_l_info)                                     \
      SymI_HasProto(stg_gc_prim_p)                                      \
      SymI_HasProto(stg_gc_prim_pp)                                     \
      SymI_HasProto(stg_gc_prim_n)                                      \
      SymI_HasProto(stg_enter_info)                                     \
      SymI_HasProto(__stg_gc_enter_1)                                   \
      SymI_HasProto(stg_gc_unpt_r1)                                     \
      SymI_HasProto(stg_gc_unbx_r1)                                     \
      SymI_HasProto(stg_gc_f1)                                          \
      SymI_HasProto(stg_gc_d1)                                          \
      SymI_HasProto(stg_gc_l1)                                          \
      SymI_HasProto(stg_gc_pp)                                          \
      SymI_HasProto(stg_gc_ppp)                                         \
      SymI_HasProto(stg_gc_pppp)                                        \
      SymI_HasProto(__stg_gc_fun)                                       \
      SymI_HasProto(stg_gc_fun_info)                                    \
      SymI_HasProto(stg_yield_noregs)                                   \
      SymI_HasProto(stg_yield_to_interpreter)                           \
      SymI_HasProto(stg_block_noregs)                                   \
      SymI_HasProto(stg_block_takemvar)                                 \
1086
      SymI_HasProto(stg_block_readmvar)                           \
1087 1088 1089 1090 1091 1092 1093 1094 1095
      SymI_HasProto(stg_block_putmvar)                                  \
      MAIN_CAP_SYM                                                      \
      SymI_HasProto(addDLL)                                             \
      SymI_HasProto(__int_encodeDouble)                                 \
      SymI_HasProto(__word_encodeDouble)                                \
      SymI_HasProto(__int_encodeFloat)                                  \
      SymI_HasProto(__word_encodeFloat)                                 \
      SymI_HasProto(stg_atomicallyzh)                                   \
      SymI_HasProto(barf)                                               \
1096
      SymI_HasProto(deRefStablePtr)                                     \
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110
      SymI_HasProto(debugBelch)                                         \
      SymI_HasProto(errorBelch)                                         \
      SymI_HasProto(sysErrorBelch)                                      \
      SymI_HasProto(stg_getMaskingStatezh)                              \
      SymI_HasProto(stg_maskAsyncExceptionszh)                          \
      SymI_HasProto(stg_maskUninterruptiblezh)                          \
      SymI_HasProto(stg_catchzh)                                        \
      SymI_HasProto(stg_catchRetryzh)                                   \
      SymI_HasProto(stg_catchSTMzh)                                     \
      SymI_HasProto(stg_checkzh)                                        \
      SymI_HasProto(closure_flags)                                      \
      SymI_HasProto(cmp_thread)                                         \
      SymI_HasProto(createAdjustor)                                     \
      SymI_HasProto(stg_decodeDoublezu2Intzh)                           \
1111
      SymI_HasProto(stg_decodeDoublezuInt64zh)                          \
1112 1113 1114 1115 1116
      SymI_HasProto(stg_decodeFloatzuIntzh)                             \
      SymI_HasProto(stg_delayzh)                                        \
      SymI_HasProto(stg_deRefWeakzh)                                    \
      SymI_HasProto(stg_deRefStablePtrzh)                               \
      SymI_HasProto(dirty_MUT_VAR)                                      \
1117
      SymI_HasProto(dirty_TVAR)                                         \
1118 1119 1120 1121 1122
      SymI_HasProto(stg_forkzh)                                         \
      SymI_HasProto(stg_forkOnzh)                                       \
      SymI_HasProto(forkProcess)                                        \
      SymI_HasProto(forkOS_createThread)                                \
      SymI_HasProto(freeHaskellFunctionPtr)                             \
Ian Lynagh's avatar
Ian Lynagh committed
1123 1124 1125 1126 1127 1128
      SymI_HasProto(getOrSetGHCConcSignalSignalHandlerStore)            \
      SymI_HasProto(getOrSetGHCConcWindowsPendingDelaysStore)           \
      SymI_HasProto(getOrSetGHCConcWindowsIOManagerThreadStore)         \
      SymI_HasProto(getOrSetGHCConcWindowsProddingStore)                \
      SymI_HasProto(getOrSetSystemEventThreadEventManagerStore)         \
      SymI_HasProto(getOrSetSystemEventThreadIOManagerThreadStore)      \
1129 1130
      SymI_HasProto(getOrSetSystemTimerThreadEventManagerStore)         \
      SymI_HasProto(getOrSetSystemTimerThreadIOManagerThreadStore)      \
1131
      SymI_HasProto(getOrSetLibHSghcFastStringTable)                    \
1132 1133 1134 1135 1136 1137
      SymI_HasProto(getGCStats)                                         \
      SymI_HasProto(getGCStatsEnabled)                                  \
      SymI_HasProto(genericRaise)                                       \
      SymI_HasProto(getProgArgv)                                        \
      SymI_HasProto(getFullProgArgv)                                    \
      SymI_HasProto(getStablePtr)                                       \
1138
      SymI_HasProto(foreignExportStablePtr)                             \
1139 1140 1141 1142 1143
      SymI_HasProto(hs_init)                                            \
      SymI_HasProto(hs_exit)                                            \
      SymI_HasProto(hs_set_argv)                                        \
      SymI_HasProto(hs_add_root)                                        \
      SymI_HasProto(hs_perform_gc)                                      \
1144 1145
      SymI_HasProto(hs_lock_stable_tables)                              \
      SymI_HasProto(hs_unlock_stable_tables)                            \
1146
      SymI_HasProto(hs_free_stable_ptr)                                 \
1147
      SymI_HasProto(hs_free_stable_ptr_unsafe)                          \
1148 1149 1150 1151
      SymI_HasProto(hs_free_fun_ptr)                                    \
      SymI_HasProto(hs_hpc_rootModule)                                  \
      SymI_HasProto(hs_hpc_module)                                      \
      SymI_HasProto(initLinker)                                         \
1152
      SymI_HasProto(initLinker_)                                        \
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168
      SymI_HasProto(stg_unpackClosurezh)                                \
      SymI_HasProto(stg_getApStackValzh)                                \
      SymI_HasProto(stg_getSparkzh)                                     \
      SymI_HasProto(stg_numSparkszh)                                    \
      SymI_HasProto(stg_isCurrentThreadBoundzh)                         \
      SymI_HasProto(stg_isEmptyMVarzh)                                  \
      SymI_HasProto(stg_killThreadzh)                                   \
      SymI_HasProto(loadArchive)                                        \
      SymI_HasProto(loadObj)                                            \
      SymI_HasProto(insertSymbol)                                       \
      SymI_HasProto(lookupSymbol)                                       \
      SymI_HasProto(stg_makeStablePtrzh)                                \
      SymI_HasProto(stg_mkApUpd0zh)                                     \
      SymI_HasProto(stg_myThreadIdzh)                                   \
      SymI_HasProto(stg_labelThreadzh)                                  \
      SymI_HasProto(stg_newArrayzh)                                     \
tibbe's avatar
tibbe committed
1169 1170 1171 1172
      SymI_HasProto(stg_copyArrayzh)                                    \
      SymI_HasProto(stg_copyMutableArrayzh)                             \
      SymI_HasProto(stg_copyArrayArrayzh)                               \
      SymI_HasProto(stg_copyMutableArrayArrayzh)                        \
1173 1174
      SymI_HasProto(stg_cloneArrayzh)                                   \
      SymI_HasProto(stg_cloneMutableArrayzh)                            \
tibbe's avatar
tibbe committed
1175
      SymI_HasProto(stg_freezzeArrayzh)                                 \
1176
      SymI_HasProto(stg_thawArrayzh)                                    \
1177
      SymI_HasProto(stg_newArrayArrayzh)                                \
1178
      SymI_HasProto(stg_casArrayzh)                                     \
1179 1180 1181 1182 1183 1184 1185 1186 1187
      SymI_HasProto(stg_newSmallArrayzh)                                \
      SymI_HasProto(stg_unsafeThawSmallArrayzh)                         \
      SymI_HasProto(stg_cloneSmallArrayzh)                              \
      SymI_HasProto(stg_cloneSmallMutableArrayzh)                       \
      SymI_HasProto(stg_freezzeSmallArrayzh)                            \
      SymI_HasProto(stg_thawSmallArrayzh)                               \
      SymI_HasProto(stg_copySmallArrayzh)                               \
      SymI_HasProto(stg_copySmallMutableArrayzh)                        \
      SymI_HasProto(stg_casSmallArrayzh)                                \
1188 1189
      SymI_HasProto(stg_newBCOzh)                                       \
      SymI_HasProto(stg_newByteArrayzh)                                 \
1190
      SymI_HasProto(stg_casIntArrayzh)                                  \
1191 1192 1193 1194 1195 1196 1197 1198
      SymI_HasProto(stg_newMVarzh)                                      \
      SymI_HasProto(stg_newMutVarzh)                                    \
      SymI_HasProto(stg_newTVarzh)                                      \
      SymI_HasProto(stg_noDuplicatezh)                                  \
      SymI_HasProto(stg_atomicModifyMutVarzh)                           \
      SymI_HasProto(stg_casMutVarzh)                                    \
      SymI_HasProto(stg_newPinnedByteArrayzh)                           \
      SymI_HasProto(stg_newAlignedPinnedByteArrayzh)                    \
1199
      SymI_HasProto(stg_shrinkMutableByteArrayzh)                       \
Gabor Greif's avatar
Gabor Greif committed
1200
      SymI_HasProto(stg_resizzeMutableByteArrayzh)                      \
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
      SymI_HasProto(newSpark)                                           \
      SymI_HasProto(performGC)                                          \
      SymI_HasProto(performMajorGC)                                     \
      SymI_HasProto(prog_argc)                                          \
      SymI_HasProto(prog_argv)                                          \
      SymI_HasProto(stg_putMVarzh)                                      \
      SymI_HasProto(stg_raisezh)                                        \
      SymI_HasProto(stg_raiseIOzh)                                      \
      SymI_HasProto(stg_readTVarzh)                                     \
      SymI_HasProto(stg_readTVarIOzh)                                   \
      SymI_HasProto(resumeThread)                                       \
      SymI_HasProto(setNumCapabilities)                                 \
      SymI_HasProto(getNumberOfProcessors)                              \
      SymI_HasProto(resolveObjs)                                        \
      SymI_HasProto(stg_retryzh)                                        \
      SymI_HasProto(rts_apply)                                          \
      SymI_HasProto(rts_checkSchedStatus)                               \
      SymI_HasProto(rts_eval)                                           \
      SymI_HasProto(rts_evalIO)                                         \
      SymI_HasProto(rts_evalLazyIO)                                     \
      SymI_HasProto(rts_evalStableIO)                                   \
      SymI_HasProto(rts_eval_)                                          \
      SymI_HasProto(rts_getBool)                                        \
      SymI_HasProto(rts_getChar)                                        \
      SymI_HasProto(rts_getDouble)                                      \
      SymI_HasProto(rts_getFloat)                                       \
      SymI_HasProto(rts_getInt)                                         \
      SymI_HasProto(rts_getInt8)                                        \
      SymI_HasProto(rts_getInt16)                                       \
      SymI_HasProto(rts_getInt32)                                       \
      SymI_HasProto(rts_getInt64)                                       \
      SymI_HasProto(rts_getPtr)                                         \
      SymI_HasProto(rts_getFunPtr)                                      \
      SymI_HasProto(rts_getStablePtr)                                   \
      SymI_HasProto(rts_getThreadId)                                    \
      SymI_HasProto(rts_getWord)                                        \
      SymI_HasProto(rts_getWord8)                                       \
      SymI_HasProto(rts_getWord16)                                      \
      SymI_HasProto(rts_getWord32)                                      \
      SymI_HasProto(rts_getWord64)                                      \
      SymI_HasProto(rts_lock)                                           \
      SymI_HasProto(rts_mkBool)                                         \
      SymI_HasProto(rts_mkChar)                                         \
      SymI_HasProto(rts_mkDouble)                                       \
      SymI_HasProto(rts_mkFloat)                                        \
      SymI_HasProto(rts_mkInt)                                          \
      SymI_HasProto(rts_mkInt8)                                         \
      SymI_HasProto(rts_mkInt16)                                        \
      SymI_HasProto(rts_mkInt32)                                        \
      SymI_HasProto(rts_mkInt64)                                        \
      SymI_HasProto(rts_mkPtr)                                          \
      SymI_HasProto(rts_mkFunPtr)                                       \
      SymI_HasProto(rts_mkStablePtr)                                    \
      SymI_HasProto(rts_mkString)                                       \
      SymI_HasProto(rts_mkWord)                                         \
      SymI_HasProto(rts_mkWord8)                                        \
      SymI_HasProto(rts_mkWord16)                                       \
      SymI_HasProto(rts_mkWord32)                                       \
      SymI_HasProto(rts_mkWord64)                                       \
      SymI_HasProto(rts_unlock)                                         \
      SymI_HasProto(rts_unsafeGetMyCapability)                          \
      SymI_HasProto(rtsSupportsBoundThreads)                            \
      SymI_HasProto(rts_isProfiled)                                     \
1264
      SymI_HasProto(rts_isDynamic)                                      \
1265 1266 1267 1268
      SymI_HasProto(rts_getThreadAllocationCounter)                     \
      SymI_HasProto(rts_setThreadAllocationCounter)                     \
      SymI_HasProto(rts_enableThreadAllocationLimit)                    \
      SymI_HasProto(rts_disableThreadAllocationLimit)                   \
1269 1270 1271 1272
      SymI_HasProto(setProgArgv)                                        \
      SymI_HasProto(startupHaskell)                                     \
      SymI_HasProto(shutdownHaskell)                                    \
      SymI_HasProto(shutdownHaskellAndExit)                             \
1273
      SymI_HasProto(stable_name_table)                                  \
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283
      SymI_HasProto(stable_ptr_table)                                   \
      SymI_HasProto(stackOverflow)                                      \
      SymI_HasProto(stg_CAF_BLACKHOLE_info)                             \
      SymI_HasProto(stg_BLACKHOLE_info)                                 \
      SymI_HasProto(__stg_EAGER_BLACKHOLE_info)                         \
      SymI_HasProto(stg_BLOCKING_QUEUE_CLEAN_info)                      \
      SymI_HasProto(stg_BLOCKING_QUEUE_DIRTY_info)                      \
      SymI_HasProto(startTimer)                                         \
      SymI_HasProto(stg_MVAR_CLEAN_info)                                \
      SymI_HasProto(stg_MVAR_DIRTY_info)                                \
1284 1285
      SymI_HasProto(stg_TVAR_CLEAN_info)                                \
      SymI_HasProto(stg_TVAR_DIRTY_info)                                \
1286 1287 1288 1289 1290
      SymI_HasProto(stg_IND_STATIC_info)                                \
      SymI_HasProto(stg_ARR_WORDS_info)                                 \
      SymI_HasProto(stg_MUT_ARR_PTRS_DIRTY_info)                        \
      SymI_HasProto(stg_MUT_ARR_PTRS_FROZEN_info)                       \
      SymI_HasProto(stg_MUT_ARR_PTRS_FROZEN0_info)                      \
tibbe's avatar
tibbe committed
1291 1292 1293
      SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_DIRTY_info)                  \
      SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_FROZEN_info)                 \
      SymI_HasProto(stg_SMALL_MUT_ARR_PTRS_FROZEN0_info)                \
1294 1295
      SymI_HasProto(stg_MUT_VAR_CLEAN_info)                             \
      SymI_HasProto(stg_MUT_VAR_DIRTY_info)                             \
1296 1297 1298 1299 1300
      SymI_HasProto(stg_WEAK_info)                                      \
      SymI_HasProto(stg_ap_v_info)                                      \
      SymI_HasProto(stg_ap_f_info)                                      \
      SymI_HasProto(stg_ap_d_info)                                      \
      SymI_HasProto(stg_ap_l_info)                                      \
1301
      SymI_HasProto(stg_ap_v16_info)                                    \
1302
      SymI_HasProto(stg_ap_v32_info)                                    \
1303
      SymI_HasProto(stg_ap_v64_info)                                    \
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318
      SymI_HasProto(stg_ap_n_info)                                      \
      SymI_HasProto(stg_ap_p_info)                                      \
      SymI_HasProto(stg_ap_pv_info)                                     \
      SymI_HasProto(stg_ap_pp_info)                                     \
      SymI_HasProto(stg_ap_ppv_info)                                    \
      SymI_HasProto(stg_ap_ppp_info)                                    \
      SymI_HasProto(stg_ap_pppv_info)                                   \
      SymI_HasProto(stg_ap_pppp_info)                                   \
      SymI_HasProto(stg_ap_ppppp_info)                                  \
      SymI_HasProto(stg_ap_pppppp_info)                                 \
      SymI_HasProto(stg_ap_0_fast)                                      \
      SymI_HasProto(stg_ap_v_fast)                                      \
      SymI_HasProto(stg_ap_f_fast)                                      \
      SymI_HasProto(stg_ap_d_fast)                                      \
      SymI_HasProto(stg_ap_l_fast)                                      \
1319
      SymI_HasProto(stg_ap_v16_fast)                                    \
1320
      SymI_HasProto(stg_ap_v32_fast)                                    \
1321
      SymI_HasProto(stg_ap_v64_fast)                                    \
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349
      SymI_HasProto(stg_ap_n_fast)                                      \
      SymI_HasProto(stg_ap_p_fast)                                      \
      SymI_HasProto(stg_ap_pv_fast)                                     \
      SymI_HasProto(stg_ap_pp_fast)                                     \
      SymI_HasProto(stg_ap_ppv_fast)                                    \
      SymI_HasProto(stg_ap_ppp_fast)                                    \
      SymI_HasProto(stg_ap_pppv_fast)                                   \
      SymI_HasProto(stg_ap_pppp_fast)                                   \
      SymI_HasProto(stg_ap_ppppp_fast)                                  \
      SymI_HasProto(stg_ap_pppppp_fast)                                 \
      SymI_HasProto(stg_ap_1_upd_info)                                  \
      SymI_HasProto(stg_ap_2_upd_info)                                  \
      SymI_HasProto(stg_ap_3_upd_info)                                  \
      SymI_HasProto(stg_ap_4_upd_info)                                  \
      SymI_HasProto(stg_ap_5_upd_info)                                  \
      SymI_HasProto(stg_ap_6_upd_info)                                  \
      SymI_HasProto(stg_ap_7_upd_info)                                  \
      SymI_HasProto(stg_exit)                                           \
      SymI_HasProto(stg_sel_0_upd_info)                                 \
      SymI_HasProto(stg_sel_1_upd_info)                                 \
      SymI_HasProto(stg_sel_2_upd_info)                                 \
      SymI_HasProto(stg_sel_3_upd_info)                                 \
      SymI_HasProto(stg_sel_4_upd_info)                                 \
      SymI_HasProto(stg_sel_5_upd_info)                                 \
      SymI_HasProto(stg_sel_6_upd_info)                                 \
      SymI_HasProto(stg_sel_7_upd_info)                                 \
      SymI_HasProto(stg_sel_8_upd_info)                                 \
      SymI_HasProto(stg_sel_9_upd_info)                                 \
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371
      SymI_HasProto(stg_sel_10_upd_info)                                \
      SymI_HasProto(stg_sel_11_upd_info)                                \
      SymI_HasProto(stg_sel_12_upd_info)                                \
      SymI_HasProto(stg_sel_13_upd_info)                                \
      SymI_HasProto(stg_sel_14_upd_info)                                \
      SymI_HasProto(stg_sel_15_upd_info)                                \
      SymI_HasProto(stg_sel_0_noupd_info)                                 \
      SymI_HasProto(stg_sel_1_noupd_info)                                 \
      SymI_HasProto(stg_sel_2_noupd_info)                                 \
      SymI_HasProto(stg_sel_3_noupd_info)                                 \
      SymI_HasProto(stg_sel_4_noupd_info)                                 \
      SymI_HasProto(stg_sel_5_noupd_info)                                 \
      SymI_HasProto(stg_sel_6_noupd_info)                                 \
      SymI_HasProto(stg_sel_7_noupd_info)                                 \
      SymI_HasProto(stg_sel_8_noupd_info)                                 \
      SymI_HasProto(stg_sel_9_noupd_info)                                 \
      SymI_HasProto(stg_sel_10_noupd_info)                                \
      SymI_HasProto(stg_sel_11_noupd_info)                                \
      SymI_HasProto(stg_sel_12_noupd_info)                                \
      SymI_HasProto(stg_sel_13_noupd_info)                                \
      SymI_HasProto(stg_sel_14_noupd_info)                                \
      SymI_HasProto(stg_sel_15_noupd_info)                                \
1372 1373 1374 1375
      SymI_HasProto(stg_upd_frame_info)                                 \
      SymI_HasProto(stg_bh_upd_frame_info)                              \
      SymI_HasProto(suspendThread)                                      \
      SymI_HasProto(stg_takeMVarzh)                                     \
1376
      SymI_HasProto(stg_readMVarzh)                               \
1377 1378 1379
      SymI_HasProto(stg_threadStatuszh)                                 \
      SymI_HasProto(stg_tryPutMVarzh)                                   \
      SymI_HasProto(stg_tryTakeMVarzh)                                  \
1380
      SymI_HasProto(stg_tryReadMVarzh)                            \
1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393
      SymI_HasProto(stg_unmaskAsyncExceptionszh)                        \
      SymI_HasProto(unloadObj)                                          \
      SymI_HasProto(stg_unsafeThawArrayzh)                              \
      SymI_HasProto(stg_waitReadzh)                                     \
      SymI_HasProto(stg_waitWritezh)                                    \
      SymI_HasProto(stg_writeTVarzh)                                    \
      SymI_HasProto(stg_yieldzh)                                        \
      SymI_NeedsProto(stg_interp_constr_entry)                          \
      SymI_HasProto(stg_arg_bitmaps)                                    \
      SymI_HasProto(large_alloc_lim)                                    \
      SymI_HasProto(g0)                                                 \
      SymI_HasProto(allocate)                                           \
      SymI_HasProto(allocateExec)                                       \
1394
      SymI_HasProto(flushExec)                                          \
1395 1396 1397 1398
      SymI_HasProto(freeExec)                                           \
      SymI_HasProto(getAllocations)                                     \
      SymI_HasProto(revertCAFs)                                         \
      SymI_HasProto(RtsFlags)                                           \
1399 1400 1401
      SymI_NeedsDataProto(rts_breakpoint_io_action)                     \
      SymI_NeedsDataProto(rts_stop_next_breakpoint)                     \
      SymI_NeedsDataProto(rts_stop_on_exception)                        \
1402 1403
      SymI_HasProto(stopTimer)                                          \
      SymI_HasProto(n_capabilities)                                     \
1404
      SymI_HasProto(enabled_capabilities)                               \
1405 1406
      SymI_HasProto(stg_traceCcszh)                                     \
      SymI_HasProto(stg_traceEventzh)                                   \
1407
      SymI_HasProto(stg_traceMarkerzh)                                  \
1408 1409 1410 1411 1412
      SymI_HasProto(getMonotonicNSec)                                   \
      SymI_HasProto(lockFile)                                           \
      SymI_HasProto(unlockFile)                                         \
      SymI_HasProto(startProfTimer)                                     \
      SymI_HasProto(stopProfTimer)                                      \
Austin Seipp's avatar
Austin Seipp committed
1413 1414
      SymI_HasProto(atomic_inc)                                         \
      SymI_HasProto(atomic_dec)                                         \
Facundo Domínguez's avatar
Facundo Domínguez committed
1415 1416
      SymI_HasProto(hs_spt_lookup)                                      \
      SymI_HasProto(hs_spt_insert)                                      \
1417
      SymI_HasProto(hs_spt_remove)                                      \
Facundo Domínguez's avatar
Facundo Domínguez committed
1418 1419
      SymI_HasProto(hs_spt_keys)                                        \
      SymI_HasProto(hs_spt_key_count)                                   \
1420
      RTS_USER_SIGNALS_SYMBOLS                                          \
1421
      RTS_INTCHAR_SYMBOLS
1422

1423

1424
// 64-bit support functions in libgcc.a
1425
#if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32)