📄 gcconfig.h
字号:
# ifdef M88K# define MACH_TYPE "M88K"# define ALIGNMENT 4 extern int etext[];# ifdef CX_UX# define OS_TYPE "CX_UX"# define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)# endif# ifdef DGUX# define OS_TYPE "DGUX" extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext)# endif# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */# endif# ifdef S370 /* If this still works, and if anyone cares, this should probably */ /* be moved to the S390 category. */# define MACH_TYPE "S370"# define ALIGNMENT 4 /* Required by hardware */# ifdef UTS4# define OS_TYPE "UTS4" extern int etext[]; extern int _etext[]; extern int _end[]; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)# define DATAEND (_end)# define HEURISTIC2# endif# endif# ifdef S390# define MACH_TYPE "S390"# ifndef __s390x__# define ALIGNMENT 4# define CPP_WORDSZ 32# else# define ALIGNMENT 8# define CPP_WORDSZ 64# ifndef HBLKSIZE# define HBLKSIZE 4096# endif# endif# ifdef LINUX# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# define DYNAMIC_LOADING extern int __data_start[];# define DATASTART ((ptr_t)(__data_start)) extern int _end[];# define DATAEND (_end)# define CACHE_LINE_SIZE 256# define GETPAGESIZE() 4096# endif# endif# ifdef ARM32# define CPP_WORDSZ 32# define MACH_TYPE "ARM32"# define ALIGNMENT 4# ifdef NETBSD# define OS_TYPE "NETBSD"# define HEURISTIC2# ifdef __ELF__# define DATASTART GC_data_start# define DYNAMIC_LOADING# else extern char etext[];# define DATASTART ((ptr_t)(etext))# endif# endif# ifdef LINUX# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# undef STACK_GRAN# define STACK_GRAN 0x10000000# ifdef __ELF__# define DYNAMIC_LOADING# include <features.h># if defined(__GLIBC__) && __GLIBC__ >= 2# define SEARCH_FOR_DATA_START# else extern char **__environ;# define DATASTART ((ptr_t)(&__environ)) /* hideous kludge: __environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */ /* We could use _etext instead, but that */ /* would include .rodata, which may */ /* contain large read-only data tables */ /* that we'd rather not scan. */# endif extern int _end[];# define DATAEND (_end)# else extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))# endif# endif# ifdef MSWINCE# define OS_TYPE "MSWINCE"# define DATAEND /* not needed */# endif# ifdef NOSYS /* __data_start is usually defined in the target linker script. */ extern int __data_start[];# define DATASTART (ptr_t)(__data_start) /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */ extern void *__stack_base__;# define STACKBOTTOM ((ptr_t) (__stack_base__))# endif#endif# ifdef CRIS# define MACH_TYPE "CRIS"# define CPP_WORDSZ 32# define ALIGNMENT 1# define OS_TYPE "LINUX"# define DYNAMIC_LOADING# define LINUX_STACKBOTTOM# define SEARCH_FOR_DATA_START extern int _end[];# define DATAEND (_end)# endif# ifdef SH# define MACH_TYPE "SH"# define ALIGNMENT 4# ifdef MSWINCE# define OS_TYPE "MSWINCE"# define DATAEND /* not needed */# endif# ifdef LINUX# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# define DYNAMIC_LOADING# define SEARCH_FOR_DATA_START extern int _end[];# define DATAEND (_end)# endif# ifdef NETBSD# define OS_TYPE "NETBSD"# define HEURISTIC2# define DATASTART GC_data_start# define DYNAMIC_LOADING# endif# endif # ifdef SH4# define MACH_TYPE "SH4"# define OS_TYPE "MSWINCE"# define ALIGNMENT 4# define DATAEND /* not needed */# endif# ifdef M32R# define CPP_WORDSZ 32# define MACH_TYPE "M32R"# define ALIGNMENT 4# ifdef LINUX# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# undef STACK_GRAN# define STACK_GRAN 0x10000000# define DYNAMIC_LOADING# define SEARCH_FOR_DATA_START extern int _end[];# define DATAEND (_end)# endif# endif# ifdef X86_64# define MACH_TYPE "X86_64"# define ALIGNMENT 8# define CPP_WORDSZ 64# ifndef HBLKSIZE# define HBLKSIZE 4096# endif# define CACHE_LINE_SIZE 64# ifdef LINUX# define OS_TYPE "LINUX"# define LINUX_STACKBOTTOM# if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)# define MPROTECT_VDB# else /* We seem to get random errors in incremental mode, */ /* possibly because Linux threads is itself a malloc client */ /* and can't deal with the signals. */# endif# ifdef __ELF__# define DYNAMIC_LOADING# ifdef UNDEFINED /* includes ro data */ extern int _etext[];# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))# endif# include <features.h># define SEARCH_FOR_DATA_START extern int _end[];# define DATAEND (_end)# else extern int etext[];# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))# endif# if defined(__GNUC__) && __GNUC__ >= 3# define PREFETCH(x) __builtin_prefetch((x), 0, 0)# define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)# endif# endif# ifdef DARWIN# define OS_TYPE "DARWIN"# define DARWIN_DONT_PARSE_STACK# define DYNAMIC_LOADING /* XXX: see get_end(3), get_etext() and get_end() should not be used. These aren't used when dyld support is enabled (it is by default) */# define DATASTART ((ptr_t) get_etext())# define DATAEND ((ptr_t) get_end())# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)# define USE_MMAP# define USE_MMAP_ANON# ifdef GC_DARWIN_THREADS# define MPROTECT_VDB# endif# include <unistd.h># define GETPAGESIZE() getpagesize() /* There seems to be some issues with trylock hanging on darwin. This should be looked into some more */# define NO_PTHREAD_TRYLOCK# endif# ifdef FREEBSD# define OS_TYPE "FREEBSD"# ifndef GC_FREEBSD_THREADS# define MPROTECT_VDB# endif# ifdef __GLIBC__# define SIG_SUSPEND (32+6)# define SIG_THR_RESTART (32+5) extern int _end[];# define DATAEND (_end)# else# define SIG_SUSPEND SIGUSR1# define SIG_THR_RESTART SIGUSR2# endif# define FREEBSD_STACKBOTTOM# ifdef __ELF__# define DYNAMIC_LOADING# endif extern char etext[]; extern char * GC_FreeBSDGetDataStart();# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)# endif# ifdef NETBSD# define OS_TYPE "NETBSD"# ifdef __ELF__# define DYNAMIC_LOADING# endif# define HEURISTIC2 extern char etext[];# define SEARCH_FOR_DATA_START# endif# ifdef SOLARIS# define OS_TYPE "SOLARIS"# define ELF_CLASS ELFCLASS64 extern int _etext[], _end[]; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);# define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)# define DATAEND (_end)/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, *//* but reportedly breaks under 2.8. It appears that the stack *//* base is a property of the executable, so this should not break *//* old executables. *//* HEURISTIC2 probably works, but this appears to be preferable. *//* Apparently USRSTACK is defined to be USERLIMIT, but in some *//* installations that's undefined. We work around this with a *//* gross hack: */# include <sys/vmparam.h># ifdef USERLIMIT /* This should work everywhere, but doesn't. */# define STACKBOTTOM USRSTACK# else# define HEURISTIC2# endif/* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. *//* It appears to be fixed in 2.8 and 2.9. */# ifdef SOLARIS25_PROC_VDB_BUG_FIXED# define PROC_VDB# endif# define DYNAMIC_LOADING# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)# define USE_MMAP /* Otherwise we now use calloc. Mmap may result in the */ /* heap interleaved with thread stacks, which can result in */ /* excessive blacklisting. Sbrk is unusable since it */ /* doesn't interact correctly with the system malloc. */# endif# ifdef USE_MMAP# define HEAP_START (ptr_t)0x40000000# else# define HEAP_START DATAEND# endif# endif# ifdef MSWIN32# define OS_TYPE "MSWIN32" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. */# if !defined(__WATCOMC__)# define MPROTECT_VDB /* We also avoided doing this in the past with GC_WIN32_THREADS */ /* Hopefully that's fixed. */# endif# if _MSC_VER >= 1300 /* .NET, i.e. > VisualStudio 6 */# define GWW_VDB# endif# define DATAEND /* not needed */# endif# endif#if defined(LINUX) && defined(USE_MMAP) /* The kernel may do a somewhat better job merging mappings etc. */ /* with anonymous mappings. */# define USE_MMAP_ANON#endif#if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) /* Nptl allocates thread stacks with mmap, which is fine. But it */ /* keeps a cache of thread stacks. Thread stacks contain the */ /* thread control blocks. These in turn contain a pointer to */ /* (sizeof (void *) from the beginning of) the dtv for thread-local */ /* storage, which is calloc allocated. If we don't scan the cached */ /* thread stacks, we appear to lose the dtv. This tends to */ /* result in something that looks like a bogus dtv count, which */ /* tends to result in a memset call on a block that is way too */ /* large. Sometimes we're lucky and the process just dies ... */ /* There seems to be a similar issue with some other memory */ /* allocated by the dynamic loader. */ /* This can be avoided by either: */ /* - Defining USE_PROC_FOR_LIBRARIES here. */ /* That performs very poorly, precisely because we end up */ /* scanning cached stacks. */ /* - Have calloc look at its callers. That is currently what we do.*/ /* In spite of the fact that it is gross and disgusting. *//* # define USE_PROC_FOR_LIBRARIES */#endif# ifndef STACK_GROWS_UP# define STACK_GROWS_DOWN# endif# ifndef CPP_WORDSZ# define CPP_WORDSZ 32# endif# ifndef OS_TYPE# define OS_TYPE ""# endif# ifndef DATAEND extern int end[];# define DATAEND (end)# endif# if defined(SVR4) && !defined(GETPAGESIZE)# include <unistd.h># define GETPAGESIZE() sysconf(_SC_PAGESIZE)# endif# ifndef GETPAGESIZE# if defined(SOLARIS) || defined(IRIX5) || defined(LINUX) \ || defined(NETBSD) || defined(FREEBSD) || defined(HPUX)# include <unistd.h># endif# define GETPAGESIZE() getpagesize()# endif# if defined(SOLARIS) || defined(DRSNX) || defined(UTS4) /* OS has SVR4 generic features. */ /* Probably others also qualify. */# define SVR4# endif# if defined(SOLARIS) || defined(DRSNX) /* OS has SOLARIS style semi-undocumented interface */ /* to dynamic loader. */# define SOLARISDL /* OS has SOLARIS style signal handlers. */# define SUNOS5SIGS# endif# if defined(HPUX)# define SUNOS5SIGS# endif# if defined(FREEBSD) && \ (defined(__DragonFly__) || __FreeBSD__ >= 4 || (__FreeBSD_kernel__ >= 4))# define SUNOS5SIGS# endif# ifdef GC_NETBSD_THREADS# define SIGRTMIN 33# define SIGRTMAX 63# endif# if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \ || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \ || defined(DGUX) || defined(BSD) \ || defined(AIX) || defined(DARWIN) || defined(OSF1) \ || defined(HURD)# define UNIX_LIKE /* Basic Unix-like system calls work. */# endif# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64 ->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -