OSDN Git Service

2002-03-30 Krister Walfridsson <cato@df.lth.se>
[pf3gnuchains/gcc-fork.git] / boehm-gc / include / private / gcconfig.h
1 /* 
2  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
4  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
5  * Copyright (c) 2000 by Hewlett-Packard Company.  All rights reserved.
6  *
7  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
9  *
10  * Permission is hereby granted to use or copy this program
11  * for any purpose,  provided the above notices are retained on all copies.
12  * Permission to modify the code and to distribute modified code is granted,
13  * provided the above notices are retained, and a notice that the code was
14  * modified is included with the above copyright notice.
15  */
16  
17 #ifndef GCCONFIG_H
18
19 # define GCCONFIG_H
20
21 /* Machine dependent parameters.  Some tuning parameters can be found   */
22 /* near the top of gc_private.h.                                        */
23
24 /* Machine specific parts contributed by various people.  See README file. */
25
26 /* First a unified test for Linux: */
27 # if defined(linux) || defined(__linux__)
28 #    define LINUX
29 # endif
30
31 /* And one for NetBSD: */
32 # if defined(__NetBSD__)
33 #    define NETBSD
34 # endif
35
36 /* And one for OpenBSD: */
37 # if defined(__OpenBSD__)
38 #    define OPENBSD
39 # endif
40
41 /* And one for FreeBSD: */
42 # if defined(__FreeBSD__)
43 #    define FREEBSD
44 # endif
45
46 /* Determine the machine type: */
47 # if defined(__XSCALE__)
48 #    define ARM32
49 #    if !defined(LINUX)
50 #      define NOSYS
51 #      define mach_type_known
52 #    endif
53 # endif
54 # if defined(sun) && defined(mc68000)
55 #    define M68K
56 #    define SUNOS4
57 #    define mach_type_known
58 # endif
59 # if defined(hp9000s300)
60 #    define M68K
61 #    define HP
62 #    define mach_type_known
63 # endif
64 # if defined(OPENBSD) && defined(m68k)
65 #    define M68K
66 #    define mach_type_known
67 # endif
68 # if defined(OPENBSD) && defined(__sparc__)
69 #    define SPARC
70 #    define mach_type_known
71 # endif
72 # if defined(NETBSD) && defined(m68k)
73 #    define M68K
74 #    define mach_type_known
75 # endif
76 # if defined(NETBSD) && defined(__powerpc__)
77 #    define POWERPC
78 #    define mach_type_known
79 # endif
80 # if defined(NETBSD) && defined(__arm32__)
81 #    define ARM32
82 #    define mach_type_known
83 # endif
84 # if defined(vax)
85 #    define VAX
86 #    ifdef ultrix
87 #       define ULTRIX
88 #    else
89 #       define BSD
90 #    endif
91 #    define mach_type_known
92 # endif
93 # if defined(mips) || defined(__mips) || defined(_mips)
94 #    define MIPS
95 #    if defined(nec_ews) || defined(_nec_ews)
96 #      define EWS4800
97 #    endif
98 #    if !defined(LINUX) && !defined(EWS4800)
99 #      if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
100 #        define ULTRIX
101 #      else
102 #        if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
103             || defined(__SYSTYPE_SVR4__)
104 #          define IRIX5   /* or IRIX 6.X */
105 #        else
106 #          define RISCOS  /* or IRIX 4.X */
107 #        endif
108 #      endif
109 #    endif /* !LINUX */
110 #    if defined(__NetBSD__) && defined(__MIPSEL__)
111 #      undef ULTRIX
112 #    endif
113 #    define mach_type_known
114 # endif
115 # if defined(sequent) && (defined(i386) || defined(__i386__))
116 #    define I386
117 #    define SEQUENT
118 #    define mach_type_known
119 # endif
120 # if defined(sun) && (defined(i386) || defined(__i386__))
121 #    define I386
122 #    define SUNOS5
123 #    define mach_type_known
124 # endif
125 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
126 #    define I386
127 #    define OS2
128 #    define mach_type_known
129 # endif
130 # if defined(ibm032)
131 #   define RT
132 #   define mach_type_known
133 # endif
134 # if defined(sun) && (defined(sparc) || defined(__sparc))
135 #   define SPARC
136     /* Test for SunOS 5.x */
137 #     include <errno.h>
138 #     ifdef ECHRNG
139 #       define SUNOS5
140 #     else
141 #       define SUNOS4
142 #     endif
143 #   define mach_type_known
144 # endif
145 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
146      && !defined(__OpenBSD__) && !(__NetBSD__)
147 #   define SPARC
148 #   define DRSNX
149 #   define mach_type_known
150 # endif
151 # if defined(_IBMR2)
152 #   define RS6000
153 #   define mach_type_known
154 # endif
155 # if defined(__NetBSD__) && defined(__sparc__)
156 #   define SPARC
157 #   define mach_type_known
158 # endif
159 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
160         /* The above test may need refinement   */
161 #   define I386
162 #   if defined(_SCO_ELF)
163 #     define SCO_ELF
164 #   else
165 #     define SCO
166 #   endif
167 #   define mach_type_known
168 # endif
169 # if defined(_AUX_SOURCE)
170 #   define M68K
171 #   define SYSV
172 #   define mach_type_known
173 # endif
174 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
175      || defined(hppa) || defined(__hppa__)
176 #   define HP_PA
177 #   ifndef LINUX
178 #     define HPUX
179 #   endif
180 #   define mach_type_known
181 # endif
182 # if defined(__ia64) && defined(_HPUX_SOURCE)
183 #   define IA64
184 #   define HPUX
185 #   define mach_type_known
186 # endif
187 # if defined(__BEOS__) && defined(_X86_)
188 #    define I386
189 #    define BEOS
190 #    define mach_type_known
191 # endif
192 # if defined(LINUX) && (defined(i386) || defined(__i386__))
193 #    define I386
194 #    define mach_type_known
195 # endif
196 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
197 #    define IA64
198 #    define mach_type_known
199 # endif
200 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__))
201 #    define POWERPC
202 #    define mach_type_known
203 # endif
204 # if defined(LINUX) && defined(__mc68000__)
205 #    define M68K
206 #    define mach_type_known
207 # endif
208 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
209 #    define SPARC
210 #    define mach_type_known
211 # endif
212 # if defined(LINUX) && defined(__arm__)
213 #    define ARM32
214 #    define mach_type_known
215 # endif
216 # if defined(LINUX) && defined(__sh__)
217 #    define SH
218 #    define mach_type_known
219 # endif
220 # if defined(__alpha) || defined(__alpha__)
221 #   define ALPHA
222 #   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
223 #     define OSF1       /* a.k.a Digital Unix */
224 #   endif
225 #   define mach_type_known
226 # endif
227 # if defined(_AMIGA) && !defined(AMIGA)
228 #   define AMIGA
229 # endif
230 # ifdef AMIGA 
231 #   define M68K
232 #   define mach_type_known
233 # endif
234 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
235 #   define M68K
236 #   define MACOS
237 #   define mach_type_known
238 # endif
239 # if defined(__MWERKS__) && defined(__powerc)
240 #   define POWERPC
241 #   define MACOS
242 #   define mach_type_known
243 # endif
244 # if defined(macosx) || \
245      defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
246 #    define MACOSX
247 #    define POWERPC
248 #    define mach_type_known
249 # endif
250 # if defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
251 #    define MACOSX
252 #    define I386
253      --> Not really supported, but at least we recognize it.
254 # endif
255 # if defined(NeXT) && defined(mc68000)
256 #   define M68K
257 #   define NEXT
258 #   define mach_type_known
259 # endif
260 # if defined(NeXT) && (defined(i386) || defined(__i386__))
261 #   define I386
262 #   define NEXT
263 #   define mach_type_known
264 # endif
265 # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
266 #   define I386
267 #   define OPENBSD
268 #   define mach_type_known
269 # endif
270 # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
271 #   define I386
272 #   define mach_type_known
273 # endif
274 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
275 #   define I386
276 #   define mach_type_known
277 # endif
278 # if defined(bsdi) && (defined(i386) || defined(__i386__))
279 #    define I386
280 #    define BSDI
281 #    define mach_type_known
282 # endif
283 # if !defined(mach_type_known) && defined(__386BSD__)
284 #   define I386
285 #   define THREE86BSD
286 #   define mach_type_known
287 # endif
288 # if defined(_CX_UX) && defined(_M88K)
289 #   define M88K
290 #   define CX_UX
291 #   define mach_type_known
292 # endif
293 # if defined(DGUX)
294 #   define M88K
295     /* DGUX defined */
296 #   define mach_type_known
297 # endif
298 # if defined(_WIN32_WCE)
299     /* SH3, SH4, MIPS already defined for corresponding architectures */
300 #   if defined(SH3) || defined(SH4)
301 #     define SH
302 #   endif
303 #   if defined(x86)
304 #     define I386
305 #   endif
306 #   if defined(ARM)
307 #     define ARM32
308 #   endif
309 #   define MSWINCE
310 #   define mach_type_known
311 # else
312 #   if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
313         || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
314 #     define I386
315 #     define MSWIN32    /* or Win32s */
316 #     define mach_type_known
317 #   endif
318 # endif
319 # if defined(__DJGPP__)
320 #   define I386
321 #   ifndef DJGPP
322 #     define DJGPP  /* MSDOS running the DJGPP port of GCC */
323 #   endif
324 #   define mach_type_known
325 # endif
326 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
327 #   define I386
328 #   define CYGWIN32
329 #   define mach_type_known
330 # endif
331 # if defined(__MINGW32__)
332 #   define I386
333 #   define MSWIN32
334 #   define mach_type_known
335 # endif
336 # if defined(__BORLANDC__)
337 #   define I386
338 #   define MSWIN32
339 #   define mach_type_known
340 # endif
341 # if defined(_UTS) && !defined(mach_type_known)
342 #   define S370
343 #   define UTS4
344 #   define mach_type_known
345 # endif
346 # if defined(__pj__)
347 #   define PJ
348 #   define mach_type_known
349 # endif
350 # if defined(__embedded__) && defined(PPC)
351 #   define POWERPC
352 #   define NOSYS
353 #   define mach_type_known
354 # endif
355 /* Ivan Demakov */
356 # if defined(__WATCOMC__) && defined(__386__)
357 #   define I386
358 #   if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
359 #     if defined(__OS2__)
360 #       define OS2
361 #     else
362 #       if defined(__WINDOWS_386__) || defined(__NT__)
363 #         define MSWIN32
364 #       else
365 #         define DOS4GW
366 #       endif
367 #     endif
368 #   endif
369 #   define mach_type_known
370 # endif
371 # if defined(__s390__) && defined(LINUX)
372 #    define S370
373 #    define mach_type_known
374 # endif
375 # if defined(__GNU__)
376 #   if defined(__i386__)
377 /* The Debian Hurd running on generic PC */  
378 #     define  HURD
379 #     define  I386
380 #     define  mach_type_known
381 #    endif 
382 # endif
383
384 /* Feel free to add more clauses here */
385
386 /* Or manually define the machine type here.  A machine type is         */
387 /* characterized by the architecture.  Some                             */
388 /* machine types are further subdivided by OS.                          */
389 /* the macros ULTRIX, RISCOS, and BSD to distinguish.                   */
390 /* Note that SGI IRIX is treated identically to RISCOS.                 */
391 /* SYSV on an M68K actually means A/UX.                                 */
392 /* The distinction in these cases is usually the stack starting address */
393 # ifndef mach_type_known
394         --> unknown machine type
395 # endif
396                     /* Mapping is: M68K       ==> Motorola 680X0        */
397                     /*             (SUNOS4,HP,NEXT, and SYSV (A/UX),    */
398                     /*             MACOS and AMIGA variants)            */
399                     /*             I386       ==> Intel 386             */
400                     /*              (SEQUENT, OS2, SCO, LINUX, NETBSD,  */
401                     /*               FREEBSD, THREE86BSD, MSWIN32,      */
402                     /*               BSDI,SUNOS5, NEXT, other variants) */
403                     /*             NS32K      ==> Encore Multimax       */
404                     /*             MIPS       ==> R2000 or R3000        */
405                     /*                  (RISCOS, ULTRIX variants)       */
406                     /*             VAX        ==> DEC VAX               */
407                     /*                  (BSD, ULTRIX variants)          */
408                     /*             RS6000     ==> IBM RS/6000 AIX3.X    */
409                     /*             RT         ==> IBM PC/RT             */
410                     /*             HP_PA      ==> HP9000/700 & /800     */
411                     /*                            HP/UX, LINUX          */
412                     /*             SPARC      ==> SPARC v7/v8/v9        */
413                     /*                  (SUNOS4, SUNOS5, LINUX,         */
414                     /*                   DRSNX variants)                */
415                     /*             ALPHA      ==> DEC Alpha             */
416                     /*                  (OSF1 and LINUX variants)       */
417                     /*             M88K       ==> Motorola 88XX0        */
418                     /*                  (CX_UX and DGUX)                */
419                     /*             S370       ==> 370-like machine      */
420                     /*                  running Amdahl UTS4             */
421                     /*                  or a 390 running LINUX          */
422                     /*             ARM32      ==> Intel StrongARM       */
423                     /*             IA64       ==> Intel IPF             */
424                     /*                            (e.g. Itanium)        */
425                     /*                  (LINUX and HPUX)                */
426                     /*             IA64_32    ==> IA64 w/32 bit ABI     */
427                     /*                  (HPUX)                          */
428                     /*             SH         ==> Hitachi SuperH        */
429                     /*                  (LINUX & MSWINCE)               */
430
431
432 /*
433  * For each architecture and OS, the following need to be defined:
434  *
435  * CPP_WORD_SZ is a simple integer constant representing the word size.
436  * in bits.  We assume byte addressibility, where a byte has 8 bits.
437  * We also assume CPP_WORD_SZ is either 32 or 64.
438  * (We care about the length of pointers, not hardware
439  * bus widths.  Thus a 64 bit processor with a C compiler that uses
440  * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
441  *
442  * MACH_TYPE is a string representation of the machine type.
443  * OS_TYPE is analogous for the OS.
444  *
445  * ALIGNMENT is the largest N, such that
446  * all pointer are guaranteed to be aligned on N byte boundaries.
447  * defining it to be 1 will always work, but perform poorly.
448  *
449  * DATASTART is the beginning of the data segment.
450  * On UNIX systems, the collector will scan the area between DATASTART
451  * and DATAEND for root pointers.
452  *
453  * DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
454  * RTH suggests gaining access to linker script synth'd values with
455  * this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
456  *
457  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
458  * the pointer size.
459  *
460  * STACKBOTTOM is the cool end of the stack, which is usually the
461  * highest address in the stack.
462  * Under PCR or OS/2, we have other ways of finding thread stacks.
463  * For each machine, the following should:
464  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
465  * 2) define exactly one of
466  *      STACKBOTTOM (should be defined to be an expression)
467  *      HEURISTIC1
468  *      HEURISTIC2
469  * If either of the last two macros are defined, then STACKBOTTOM is computed
470  * during collector startup using one of the following two heuristics:
471  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
472  *              the next multiple of STACK_GRAN.
473  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
474  *              in small steps (decrement if STACK_GROWS_UP), and read the value
475  *              at each location.  Remember the value when the first
476  *              Segmentation violation or Bus error is signalled.  Round that
477  *              to the nearest plausible page boundary, and use that instead
478  *              of STACKBOTTOM.
479  *
480  * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
481  * the value of environ is a pointer that can serve as STACKBOTTOM.
482  * I expect that HEURISTIC2 can be replaced by this approach, which
483  * interferes far less with debugging.  However it has the disadvantage
484  * that it's confused by a putenv call before the collector is initialized.
485  * This could be dealt with by intercepting putenv ...
486  *
487  * If no expression for STACKBOTTOM can be found, and neither of the above
488  * heuristics are usable, the collector can still be used with all of the above
489  * undefined, provided one of the following is done:
490  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
491  *    without reference to STACKBOTTOM.  This is appropriate for use in
492  *    conjunction with thread packages, since there will be multiple stacks.
493  *    (Allocating thread stacks in the heap, and treating them as ordinary
494  *    heap data objects is also possible as a last resort.  However, this is
495  *    likely to introduce significant amounts of excess storage retention
496  *    unless the dead parts of the thread stacks are periodically cleared.)
497  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
498  *    If the author of the client code controls the main program, this is
499  *    easily accomplished by introducing a new main program, setting
500  *    GC_stackbottom to the address of a local variable, and then calling
501  *    the original main program.  The new main program would read something
502  *    like:
503  *
504  *              # include "gc_private.h"
505  *
506  *              main(argc, argv, envp)
507  *              int argc;
508  *              char **argv, **envp;
509  *              {
510  *                  int dummy;
511  *
512  *                  GC_stackbottom = (ptr_t)(&dummy);
513  *                  return(real_main(argc, argv, envp));
514  *              }
515  *
516  *
517  * Each architecture may also define the style of virtual dirty bit
518  * implementation to be used:
519  *   MPROTECT_VDB: Write protect the heap and catch faults.
520  *   PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
521  *
522  * An architecture may define DYNAMIC_LOADING if dynamic_load.c
523  * defined GC_register_dynamic_libraries() for the architecture.
524  *
525  * An architecture may define PREFETCH(x) to preload the cache with *x.
526  * This defaults to a no-op.
527  *
528  * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
529  *
530  * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
531  * clear the two words at GC_malloc-aligned address x.  By default,
532  * word stores of 0 are used instead.
533  */
534
535 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
536  * to push the relevant registers onto the stack.  This generally makes
537  * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
538  */
539 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
540                            (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
541 #   define HAVE_BUILTIN_UNWIND_INIT
542 # endif
543
544 # define STACK_GRAN 0x1000000
545 # ifdef M68K
546 #   define MACH_TYPE "M68K"
547 #   define ALIGNMENT 2
548 #   ifdef OPENBSD
549 #       define OS_TYPE "OPENBSD"
550 #       define HEURISTIC2
551         extern char etext[];
552 #       define DATASTART ((ptr_t)(etext))
553 #   endif
554 #   ifdef NETBSD
555 #       define OS_TYPE "NETBSD"
556 #       define HEURISTIC2
557         extern char etext[];
558 #       define DATASTART ((ptr_t)(etext))
559 #   endif
560 #   ifdef LINUX
561 #       define OS_TYPE "LINUX"
562 #       define STACKBOTTOM ((ptr_t)0xf0000000)
563 /* #       define MPROTECT_VDB - Reported to not work  9/17/01 */
564 #       ifdef __ELF__
565 #            define DYNAMIC_LOADING
566 #            include <features.h>
567 #            if defined(__GLIBC__)&& __GLIBC__>=2
568 #              define LINUX_DATA_START
569 #            else /* !GLIBC2 */
570                extern char **__environ;
571 #              define DATASTART ((ptr_t)(&__environ))
572                              /* hideous kludge: __environ is the first */
573                              /* word in crt0.o, and delimits the start */
574                              /* of the data segment, no matter which   */
575                              /* ld options were passed through.        */
576                              /* We could use _etext instead, but that  */
577                              /* would include .rodata, which may       */
578                              /* contain large read-only data tables    */
579                              /* that we'd rather not scan.             */
580 #            endif /* !GLIBC2 */
581              extern int _end[];
582 #            define DATAEND (_end)
583 #       else
584              extern int etext[];
585 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
586 #       endif
587 #   endif
588 #   ifdef SUNOS4
589 #       define OS_TYPE "SUNOS4"
590         extern char etext[];
591 #       define DATASTART ((ptr_t)((((word) (etext)) + 0x1ffff) & ~0x1ffff))
592 #       define HEURISTIC1       /* differs      */
593 #       define DYNAMIC_LOADING
594 #   endif
595 #   ifdef HP
596 #       define OS_TYPE "HP"
597         extern char etext[];
598 #       define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
599 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
600                               /* empirically determined.  seems to work. */
601 #       include <unistd.h>
602 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
603 #   endif
604 #   ifdef SYSV
605 #       define OS_TYPE "SYSV"
606         extern etext[];
607 #       define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
608                                    & ~0x3fffff) \
609                                   +((word)etext & 0x1fff))
610         /* This only works for shared-text binaries with magic number 0413.
611            The other sorts of SysV binaries put the data at the end of the text,
612            in which case the default of etext would work.  Unfortunately,
613            handling both would require having the magic-number available.
614                                 -- Parag
615            */
616 #       define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
617                         /* The stack starts at the top of memory, but   */
618                         /* 0x0 cannot be used as setjump_test complains */
619                         /* that the stack direction is incorrect.  Two  */
620                         /* bytes down from 0x0 should be safe enough.   */
621                         /*              --Parag                         */
622 #       include <sys/mmu.h>
623 #       define GETPAGESIZE() PAGESIZE   /* Is this still right? */
624 #   endif
625 #   ifdef AMIGA
626 #       define OS_TYPE "AMIGA"
627                 /* STACKBOTTOM and DATASTART handled specially  */
628                 /* in os_dep.c                                  */
629 #       define DATAEND  /* not needed */
630 #       define GETPAGESIZE() 4096
631 #   endif
632 #   ifdef MACOS
633 #     ifndef __LOWMEM__
634 #     include <LowMem.h>
635 #     endif
636 #     define OS_TYPE "MACOS"
637                         /* see os_dep.c for details of global data segments. */
638 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
639 #     define DATAEND    /* not needed */
640 #     define GETPAGESIZE() 4096
641 #   endif
642 #   ifdef NEXT
643 #       define OS_TYPE "NEXT"
644 #       define DATASTART ((ptr_t) get_etext())
645 #       define STACKBOTTOM ((ptr_t) 0x4000000)
646 #       define DATAEND  /* not needed */
647 #   endif
648 # endif
649
650 # ifdef POWERPC
651 #   define MACH_TYPE "POWERPC"
652 #   ifdef MACOS
653 #     define ALIGNMENT 2  /* Still necessary?  Could it be 4?   */
654 #     ifndef __LOWMEM__
655 #     include <LowMem.h>
656 #     endif
657 #     define OS_TYPE "MACOS"
658                         /* see os_dep.c for details of global data segments. */
659 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
660 #     define DATAEND  /* not needed */
661 #   endif
662 #   ifdef LINUX
663 #     define ALIGNMENT 4        /* Guess.  Can someone verify?  */
664                                 /* This was 2, but that didn't sound right. */
665 #     define OS_TYPE "LINUX"
666 #     define HEURISTIC1
667 #     define DYNAMIC_LOADING
668 #     undef STACK_GRAN
669 #     define STACK_GRAN 0x10000000
670         /* Stack usually starts at 0x80000000 */
671 #     define LINUX_DATA_START
672       extern int _end[];
673 #     define DATAEND (_end)
674 #   endif
675 #   ifdef MACOSX
676       /* There are reasons to suspect this may not be reliable.         */
677 #     define ALIGNMENT 4
678 #     define OS_TYPE "MACOSX"
679 #     define DATASTART ((ptr_t) get_etext())
680 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
681 #     define DATAEND    /* not needed */
682 #     define MPROTECT_VDB
683 #     include <unistd.h>
684 #     define GETPAGESIZE() getpagesize()
685 #   endif
686 #   ifdef NETBSD
687 #     define ALIGNMENT 4
688 #     define OS_TYPE "NETBSD"
689 #     define HEURISTIC2
690       extern char etext[];
691 #     define DATASTART GC_data_start
692 #     define DYNAMIC_LOADING
693 #   endif
694 #   ifdef NOSYS
695 #     define ALIGNMENT 4
696 #     define OS_TYPE "NOSYS"
697       extern void __end[], __dso_handle[];
698 #     define DATASTART (__dso_handle)  /* OK, that's ugly.  */
699 #     define DATAEND (__end)
700         /* Stack starts at 0xE0000000 for the simulator.  */
701 #     undef STACK_GRAN
702 #     define STACK_GRAN 0x10000000
703 #     define HEURISTIC1
704 #   endif
705 # endif
706
707 # ifdef VAX
708 #   define MACH_TYPE "VAX"
709 #   define ALIGNMENT 4  /* Pointers are longword aligned by 4.2 C compiler */
710     extern char etext[];
711 #   define DATASTART ((ptr_t)(etext))
712 #   ifdef BSD
713 #       define OS_TYPE "BSD"
714 #       define HEURISTIC1
715                         /* HEURISTIC2 may be OK, but it's hard to test. */
716 #   endif
717 #   ifdef ULTRIX
718 #       define OS_TYPE "ULTRIX"
719 #       define STACKBOTTOM ((ptr_t) 0x7fffc800)
720 #   endif
721 # endif
722
723 # ifdef RT
724 #   define MACH_TYPE "RT"
725 #   define ALIGNMENT 4
726 #   define DATASTART ((ptr_t) 0x10000000)
727 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
728 # endif
729
730 # ifdef SPARC
731 #   define MACH_TYPE "SPARC"
732 #   if defined(__arch64__) || defined(__sparcv9)
733 #     define ALIGNMENT 8
734 #     define CPP_WORDSZ 64
735 #     define ELF_CLASS ELFCLASS64
736 #   else
737 #     define ALIGNMENT 4        /* Required by hardware */
738 #     define CPP_WORDSZ 32
739 #   endif
740 #   define ALIGN_DOUBLE
741 #   ifdef SUNOS5
742 #       define OS_TYPE "SUNOS5"
743         extern int _etext[];
744         extern int _end[];
745         extern char * GC_SysVGetDataStart();
746 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, _etext)
747 #       define DATAEND (_end)
748 #       if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
749 #           define USE_MMAP
750             /* Otherwise we now use calloc.  Mmap may result in the     */
751             /* heap interleaved with thread stacks, which can result in */
752             /* excessive blacklisting.  Sbrk is unusable since it       */
753             /* doesn't interact correctly with the system malloc.       */
754 #       endif
755 #       ifdef USE_MMAP
756 #         define HEAP_START (ptr_t)0x40000000
757 #       else
758 #         define HEAP_START DATAEND
759 #       endif
760 #       define PROC_VDB
761 /*      HEURISTIC1 reportedly no longer works under 2.7.                */
762 /*      HEURISTIC2 probably works, but this appears to be preferable.   */
763 /*      Apparently USRSTACK is defined to be USERLIMIT, but in some     */
764 /*      installations that's undefined.  We work around this with a     */
765 /*      gross hack:                                                     */
766 #       include <sys/vmparam.h>
767 #       ifdef USERLIMIT
768           /* This should work everywhere, but doesn't.  */
769 #         define STACKBOTTOM USRSTACK
770 #       else
771 #         define HEURISTIC2
772 #       endif
773 #       include <unistd.h>
774 #       define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
775                 /* getpagesize() appeared to be missing from at least one */
776                 /* Solaris 5.4 installation.  Weird.                      */
777 #       if CPP_WORDSZ == 32
778 #         define DYNAMIC_LOADING
779 #       endif
780 #   endif
781 #   ifdef SUNOS4
782 #       define OS_TYPE "SUNOS4"
783         /* [If you have a weak stomach, don't read this.]               */
784         /* We would like to use:                                        */
785 /* #       define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */
786         /* This fails occasionally, due to an ancient, but very         */
787         /* persistent ld bug.  etext is set 32 bytes too high.          */
788         /* We instead read the text segment size from the a.out         */
789         /* header, which happens to be mapped into our address space    */
790         /* at the start of the text segment.  The detective work here   */
791         /* was done by Robert Ehrlich, Manuel Serrano, and Bernard      */
792         /* Serpette of INRIA.                                           */
793         /* This assumes ZMAGIC, i.e. demand-loadable executables.       */
794 #       define TEXTSTART 0x2000
795 #       define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
796 #       define MPROTECT_VDB
797 #       define HEURISTIC1
798 #       define DYNAMIC_LOADING
799 #   endif
800 #   ifdef DRSNX
801 #       define OS_TYPE "DRSNX"
802         extern char * GC_SysVGetDataStart();
803         extern int etext[];
804 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, etext)
805 #       define MPROTECT_VDB
806 #       define STACKBOTTOM ((ptr_t) 0xdfff0000)
807 #       define DYNAMIC_LOADING
808 #   endif
809 #   ifdef LINUX
810 #     define OS_TYPE "LINUX"
811 #     ifdef __ELF__
812 #       define DYNAMIC_LOADING
813 #     else
814           Linux Sparc/a.out not supported
815 #     endif
816       extern int _end[];
817       extern int _etext[];
818 #     define DATAEND (_end)
819 #     define SVR4
820 #     ifdef __arch64__
821 #       define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
822 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, _etext)
823 #     else
824 #       define STACKBOTTOM ((ptr_t) 0xf0000000)
825 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, _etext)
826 #     endif
827 #   endif
828 #   ifdef OPENBSD
829 #     define OS_TYPE "OPENBSD"
830 #     define STACKBOTTOM ((ptr_t) 0xf8000000)
831       extern int etext[];
832 #     define DATASTART ((ptr_t)(etext))
833 #   endif
834 #   ifdef NETBSD
835 #     define OS_TYPE "NETBSD"
836 #     define HEURISTIC2
837 #     ifdef __ELF__
838 #       define DATASTART GC_data_start
839 #       define DYNAMIC_LOADING
840 #     else
841         extern char etext[];
842 #       define DATASTART ((ptr_t)(etext))
843 #     endif
844 #   endif
845 # endif
846
847 # ifdef I386
848 #   define MACH_TYPE "I386"
849 #   define ALIGNMENT 4  /* Appears to hold for all "32 bit" compilers   */
850                         /* except Borland.  The -a4 option fixes        */
851                         /* Borland.                                     */
852                         /* Ivan Demakov: For Watcom the option is -zp4. */
853 #   ifndef SMALL_CONFIG
854 #     define ALIGN_DOUBLE /* Not strictly necessary, but may give speed   */
855                           /* improvement on Pentiums.                     */
856 #   endif
857 #   ifdef HAVE_BUILTIN_UNWIND_INIT
858 #       define USE_GENERIC_PUSH_REGS
859 #   endif
860 #   ifdef SEQUENT
861 #       define OS_TYPE "SEQUENT"
862         extern int etext[];
863 #       define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
864 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
865 #   endif
866 #   ifdef BEOS
867 #     define OS_TYPE "BEOS"
868 #     include <OS.h>
869 #     define GETPAGESIZE() B_PAGE_SIZE
870       extern int etext[];
871 #     define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
872 #   endif
873 #   ifdef SUNOS5
874 #       define OS_TYPE "SUNOS5"
875         extern int _etext[], _end[];
876         extern char * GC_SysVGetDataStart();
877 #       define DATASTART GC_SysVGetDataStart(0x1000, _etext)
878 #       define DATAEND (_end)
879 /*      # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7,      */
880 /*      but reportedly breaks under 2.8.  It appears that the stack     */
881 /*      base is a property of the executable, so this should not break  */
882 /*      old executables.                                                */
883 /*      HEURISTIC2 probably works, but this appears to be preferable.   */
884 #       include <sys/vm.h>
885 #       define STACKBOTTOM USRSTACK
886 /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
887 /* It appears to be fixed in 2.8 and 2.9.                               */
888 #       ifdef SOLARIS25_PROC_VDB_BUG_FIXED
889 #         define PROC_VDB
890 #       endif
891 #       define DYNAMIC_LOADING
892 #       if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
893 #           define USE_MMAP
894             /* Otherwise we now use calloc.  Mmap may result in the     */
895             /* heap interleaved with thread stacks, which can result in */
896             /* excessive blacklisting.  Sbrk is unusable since it       */
897             /* doesn't interact correctly with the system malloc.       */
898 #       endif
899 #       ifdef USE_MMAP
900 #         define HEAP_START (ptr_t)0x40000000
901 #       else
902 #         define HEAP_START DATAEND
903 #       endif
904 #   endif
905 #   ifdef SCO
906 #       define OS_TYPE "SCO"
907         extern int etext[];
908 #       define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
909                                   & ~0x3fffff) \
910                                  +((word)etext & 0xfff))
911 #       define STACKBOTTOM ((ptr_t) 0x7ffffffc)
912 #   endif
913 #   ifdef SCO_ELF
914 #       define OS_TYPE "SCO_ELF"
915         extern int etext[];
916 #       define DATASTART ((ptr_t)(etext))
917 #       define STACKBOTTOM ((ptr_t) 0x08048000)
918 #       define DYNAMIC_LOADING
919 #       define ELF_CLASS ELFCLASS32
920 #   endif
921 #   ifdef LINUX
922 #       ifndef __GNUC__
923           /* The Intel compiler doesn't like inline assembly */
924 #         define USE_GENERIC_PUSH_REGS
925 #       endif
926 #       define OS_TYPE "LINUX"
927 #       define LINUX_STACKBOTTOM
928 #       if 0
929 #         define HEURISTIC1
930 #         undef STACK_GRAN
931 #         define STACK_GRAN 0x10000000
932           /* STACKBOTTOM is usually 0xc0000000, but this changes with   */
933           /* different kernel configurations.  In particular, systems   */
934           /* with 2GB physical memory will usually move the user        */
935           /* address space limit, and hence initial SP to 0x80000000.   */
936 #       endif
937 #       if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
938 #           define MPROTECT_VDB
939 #       else
940             /* We seem to get random errors in incremental mode,        */
941             /* possibly because Linux threads is itself a malloc client */
942             /* and can't deal with the signals.                         */
943 #       endif
944 #       ifdef __ELF__
945 #            define DYNAMIC_LOADING
946 #            ifdef UNDEFINED    /* includes ro data */
947                extern int _etext[];
948 #              define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
949 #            endif
950 #            include <features.h>
951 #            if defined(__GLIBC__) && __GLIBC__ >= 2
952 #                define LINUX_DATA_START
953 #            else
954                  extern char **__environ;
955 #                define DATASTART ((ptr_t)(&__environ))
956                               /* hideous kludge: __environ is the first */
957                               /* word in crt0.o, and delimits the start */
958                               /* of the data segment, no matter which   */
959                               /* ld options were passed through.        */
960                               /* We could use _etext instead, but that  */
961                               /* would include .rodata, which may       */
962                               /* contain large read-only data tables    */
963                               /* that we'd rather not scan.             */
964 #            endif
965              extern int _end[];
966 #            define DATAEND (_end)
967 #       else
968              extern int etext[];
969 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
970 #       endif
971 #       ifdef USE_I686_PREFETCH
972 #         define PREFETCH(x) \
973             __asm__ __volatile__ ("     prefetchnta     %0": : "m"(*(char *)(x)))
974             /* Empirically prefetcht0 is much more effective at reducing        */
975             /* cache miss stalls for the targetted load instructions.  But it   */
976             /* seems to interfere enough with other cache traffic that the net  */
977             /* result is worse than prefetchnta.                                */
978 #         if 0 
979             /* Using prefetches for write seems to have a slight negative       */
980             /* impact on performance, at least for a PIII/500.                  */
981 #           define PREFETCH_FOR_WRITE(x) \
982               __asm__ __volatile__ ("   prefetcht0      %0": : "m"(*(char *)(x)))
983 #         endif
984 #       endif
985 #       ifdef USE_3DNOW_PREFETCH
986 #         define PREFETCH(x) \
987             __asm__ __volatile__ ("     prefetch        %0": : "m"(*(char *)(x)))
988 #         define PREFETCH_FOR_WRITE(x) \
989             __asm__ __volatile__ ("     prefetchw       %0": : "m"(*(char *)(x)))
990 #       endif
991 #   endif
992 #   ifdef CYGWIN32
993 #       define OS_TYPE "CYGWIN32"
994           extern int _data_start__[];
995           extern int _data_end__[];
996           extern int _bss_start__[];
997           extern int _bss_end__[];
998         /* For binutils 2.9.1, we have                  */
999         /*      DATASTART   = _data_start__             */
1000         /*      DATAEND     = _bss_end__                */
1001         /* whereas for some earlier versions it was     */
1002         /*      DATASTART   = _bss_start__              */
1003         /*      DATAEND     = _data_end__               */
1004         /* To get it right for both, we take the        */
1005         /* minumum/maximum of the two.                  */
1006 #       define MAX(x,y) ((x) > (y) ? (x) : (y))
1007 #       define MIN(x,y) ((x) < (y) ? (x) : (y))
1008 #       define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))
1009 #       define DATAEND   ((ptr_t) MAX(_data_end__, _bss_end__))
1010 #       undef STACK_GRAN
1011 #       define STACK_GRAN 0x10000
1012 #       define HEURISTIC1
1013 #   endif
1014 #   ifdef OS2
1015 #       define OS_TYPE "OS2"
1016                 /* STACKBOTTOM and DATASTART are handled specially in   */
1017                 /* os_dep.c. OS2 actually has the right                 */
1018                 /* system call!                                         */
1019 #       define DATAEND  /* not needed */
1020 #       define USE_GENERIC_PUSH_REGS
1021 #   endif
1022 #   ifdef MSWIN32
1023 #       define OS_TYPE "MSWIN32"
1024                 /* STACKBOTTOM and DATASTART are handled specially in   */
1025                 /* os_dep.c.                                            */
1026 #       ifndef __WATCOMC__
1027 #         define MPROTECT_VDB
1028 #       endif
1029 #       define DATAEND  /* not needed */
1030 #   endif
1031 #   ifdef MSWINCE
1032 #       define OS_TYPE "MSWINCE"
1033 #       define DATAEND  /* not needed */
1034 #   endif
1035 #   ifdef DJGPP
1036 #       define OS_TYPE "DJGPP"
1037 #       include "stubinfo.h"
1038         extern int etext[];
1039         extern int _stklen;
1040         extern int __djgpp_stack_limit;
1041 #       define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
1042 /* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
1043                                                      + _stklen)) */
1044 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
1045                 /* This may not be right.  */
1046 #   endif
1047 #   ifdef OPENBSD
1048 #       define OS_TYPE "OPENBSD"
1049 #   endif
1050 #   ifdef FREEBSD
1051 #       define OS_TYPE "FREEBSD"
1052 #       ifndef GC_FREEBSD_THREADS
1053 #           define MPROTECT_VDB
1054 #       endif
1055 #       define SIG_SUSPEND SIGUSR1
1056 #       define SIG_THR_RESTART SIGUSR2
1057 #       define FREEBSD_STACKBOTTOM
1058 #       ifdef __ELF__
1059 #           define DYNAMIC_LOADING
1060 #       endif
1061         extern char etext[];
1062 #       define DATASTART ((ptr_t)(etext))
1063 #   endif
1064 #   ifdef NETBSD
1065 #       define OS_TYPE "NETBSD"
1066 #       ifdef __ELF__
1067 #           define DYNAMIC_LOADING
1068 #       endif
1069 #   endif
1070 #   ifdef THREE86BSD
1071 #       define OS_TYPE "THREE86BSD"
1072 #   endif
1073 #   ifdef BSDI
1074 #       define OS_TYPE "BSDI"
1075 #   endif
1076 #   if defined(OPENBSD) || defined(NETBSD) \
1077         || defined(THREE86BSD) || defined(BSDI)
1078 #       define HEURISTIC2
1079         extern char etext[];
1080 #       define DATASTART ((ptr_t)(etext))
1081 #   endif
1082 #   ifdef NEXT
1083 #       define OS_TYPE "NEXT"
1084 #       define DATASTART ((ptr_t) get_etext())
1085 #       define STACKBOTTOM ((ptr_t)0xc0000000)
1086 #       define DATAEND  /* not needed */
1087 #   endif
1088 #   ifdef DOS4GW
1089 #     define OS_TYPE "DOS4GW"
1090       extern long __nullarea;
1091       extern char _end;
1092       extern char *_STACKTOP;
1093       /* Depending on calling conventions Watcom C either precedes
1094          or does not precedes with undescore names of C-variables.
1095          Make sure startup code variables always have the same names.  */
1096       #pragma aux __nullarea "*";
1097       #pragma aux _end "*";
1098 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
1099                          /* confused? me too. */
1100 #     define DATASTART ((ptr_t) &__nullarea)
1101 #     define DATAEND ((ptr_t) &_end)
1102 #   endif
1103 #   ifdef HURD
1104 #     define OS_TYPE "HURD"
1105 #     define STACK_GROWS_DOWN
1106 #     define HEURISTIC2
1107       extern int  __data_start[];
1108 #     define DATASTART ( (ptr_t) (__data_start))
1109       extern int   _end[];
1110 #     define DATAEND ( (ptr_t) (_end))
1111 /* #     define MPROTECT_VDB  Not quite working yet? */
1112 #     define DYNAMIC_LOADING
1113 #   endif
1114 # endif
1115
1116 # ifdef NS32K
1117 #   define MACH_TYPE "NS32K"
1118 #   define ALIGNMENT 4
1119     extern char **environ;
1120 #   define DATASTART ((ptr_t)(&environ))
1121                               /* hideous kludge: environ is the first   */
1122                               /* word in crt0.o, and delimits the start */
1123                               /* of the data segment, no matter which   */
1124                               /* ld options were passed through.        */
1125 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1126 # endif
1127
1128 # ifdef MIPS
1129 #   define MACH_TYPE "MIPS"
1130 #   ifdef LINUX
1131       /* This was developed for a linuxce style platform.  Probably     */
1132       /* needs to be tweaked for workstation class machines.            */
1133 #     define OS_TYPE "LINUX"
1134       extern int __data_start[];
1135 #     define DATASTART ((ptr_t)(__data_start))
1136 #     define ALIGNMENT 4
1137 #     define USE_GENERIC_PUSH_REGS
1138 #     define STACKBOTTOM ((ptr_t)0x7fff8000)
1139         /* Older toolchains may need 0x80000000.        */
1140         /* In many cases, this should probably use LINUX_STACKBOTTOM    */
1141         /* instead. But some kernel versions seem to give the wrong     */
1142         /* value from /proc.                                            */
1143 #   endif /* Linux */
1144 #   ifdef EWS4800
1145 #      define HEURISTIC2
1146 #      if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
1147          extern int _fdata[], _end[];
1148 #        define DATASTART ((ptr_t)_fdata)
1149 #        define DATAEND ((ptr_t)_end)
1150 #        define CPP_WORDSZ _MIPS_SZPTR
1151 #        define ALIGNMENT (_MIPS_SZPTR/8)
1152 #      else
1153          extern int etext[], edata[], end[];
1154          extern int _DYNAMIC_LINKING[], _gp[];
1155 #        define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \
1156                + ((word)etext & 0xffff)))
1157 #        define DATAEND (edata)
1158 #        define DATASTART2 (_DYNAMIC_LINKING \
1159                ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
1160                : (ptr_t)edata)
1161 #        define DATAEND2 (end)
1162 #        define ALIGNMENT 4
1163 #      endif
1164 #      define OS_TYPE "EWS4800"
1165 #      define USE_GENERIC_PUSH_REGS 1
1166 #   endif
1167 #   ifdef ULTRIX
1168 #       define HEURISTIC2
1169 #       define DATASTART (ptr_t)0x10000000
1170                               /* Could probably be slightly higher since */
1171                               /* startup code allocates lots of stuff.   */
1172 #       define OS_TYPE "ULTRIX"
1173 #       define ALIGNMENT 4
1174 #   endif
1175 #   ifdef RISCOS
1176 #       define HEURISTIC2
1177 #       define DATASTART (ptr_t)0x10000000
1178 #       define OS_TYPE "RISCOS"
1179 #       define ALIGNMENT 4  /* Required by hardware */
1180 #   endif
1181 #   ifdef IRIX5
1182 #       define HEURISTIC2
1183         extern int _fdata[];
1184 #       define DATASTART ((ptr_t)(_fdata))
1185 #       ifdef USE_MMAP
1186 #         define HEAP_START (ptr_t)0x30000000
1187 #       else
1188 #         define HEAP_START DATASTART
1189 #       endif
1190                               /* Lowest plausible heap address.         */
1191                               /* In the MMAP case, we map there.        */
1192                               /* In either case it is used to identify  */
1193                               /* heap sections so they're not           */
1194                               /* considered as roots.                   */
1195 #       define OS_TYPE "IRIX5"
1196 #       define MPROTECT_VDB
1197 #       ifdef _MIPS_SZPTR
1198 #         define CPP_WORDSZ _MIPS_SZPTR
1199 #         define ALIGNMENT (_MIPS_SZPTR/8)
1200 #         if CPP_WORDSZ != 64
1201 #           define ALIGN_DOUBLE
1202 #         endif
1203 #       else
1204 #         define ALIGNMENT 4
1205 #         define ALIGN_DOUBLE
1206 #       endif
1207 #       define DYNAMIC_LOADING
1208 #   endif
1209 #   ifdef MSWINCE
1210 #       define OS_TYPE "MSWINCE"
1211 #       define ALIGNMENT 4
1212 #       define DATAEND /* not needed */
1213 #   endif
1214 #   if defined(NETBSD)
1215       /* This also checked for __MIPSEL__ .  Why?  NETBSD recognition   */
1216       /* should be handled at the top of the file.                      */
1217 #     define ALIGNMENT 4
1218 #     define OS_TYPE "NETBSD"
1219 #     define HEURISTIC2
1220 #     define USE_GENERIC_PUSH_REGS
1221 #     ifdef __ELF__
1222         extern int etext[];
1223 #       define DATASTART GC_data_start
1224 #       define NEED_FIND_LIMIT
1225 #       define DYNAMIC_LOADING
1226 #     else
1227 #       define DATASTART ((ptr_t) 0x10000000)
1228 #       define STACKBOTTOM ((ptr_t) 0x7ffff000)
1229 #     endif /* _ELF_ */
1230 #  endif
1231 # endif
1232
1233 # ifdef RS6000
1234 #   define MACH_TYPE "RS6000"
1235 #   ifdef __64BIT__
1236 #     define ALIGNMENT 8
1237 #     define CPP_WORDSZ 64
1238 #   else
1239 #     define ALIGNMENT 4
1240 #     define CPP_WORDSZ 32
1241 #   endif
1242     extern int _data[], _end[];
1243 #   define DATASTART ((ptr_t)((ulong)_data))
1244 #   define DATAEND ((ptr_t)((ulong)_end))
1245     extern int errno;
1246 #   define STACKBOTTOM ((ptr_t)((ulong)&errno))
1247 #   define USE_GENERIC_PUSH_REGS
1248 #   define DYNAMIC_LOADING
1249         /* For really old versions of AIX, this may have to be removed. */
1250 # endif
1251
1252 # ifdef HP_PA
1253 #   define MACH_TYPE "HP_PA"
1254 #   ifdef __LP64__
1255 #     define CPP_WORDSZ 64
1256 #     define ALIGNMENT 8
1257 #   else
1258 #     define CPP_WORDSZ 32
1259 #     define ALIGNMENT 4
1260 #     define ALIGN_DOUBLE
1261 #   endif
1262 #   if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
1263 #     ifndef LINUX /* For now. */
1264 #       define MPROTECT_VDB
1265 #     endif
1266 #   else
1267 #     define GENERIC_COMPARE_AND_SWAP
1268         /* No compare-and-swap instruction.  Use pthread mutexes        */
1269         /* when we absolutely have to.                                  */
1270 #     ifdef PARALLEL_MARK
1271 #       define USE_MARK_BYTES
1272                 /* Minimize compare-and-swap usage.             */
1273 #     endif
1274 #   endif
1275 #   define STACK_GROWS_UP
1276 #   ifdef HPUX
1277 #     define OS_TYPE "HPUX"
1278       extern int __data_start[];
1279 #     define DATASTART ((ptr_t)(__data_start))
1280 #     if 0
1281         /* The following appears to work for 7xx systems running HP/UX  */
1282         /* 9.xx Furthermore, it might result in much faster             */
1283         /* collections than HEURISTIC2, which may involve scanning      */
1284         /* segments that directly precede the stack.  It is not the     */
1285         /* default, since it may not work on older machine/OS           */
1286         /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1287         /* this.)                                                       */
1288 #       define STACKBOTTOM ((ptr_t) 0x7b033000)  /* from /etc/conf/h/param.h */
1289 #     else
1290         /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2       */
1291         /* to this.  Note that the GC must be initialized before the    */
1292         /* first putenv call.                                           */
1293         extern char ** environ;
1294 #       define STACKBOTTOM ((ptr_t)environ)
1295 #     endif
1296 #     define DYNAMIC_LOADING
1297 #     include <unistd.h>
1298 #     define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1299 #     ifndef __GNUC__
1300 #       define PREFETCH(x)  { \
1301                               register long addr = (long)(x); \
1302                               (void) _asm ("LDW", 0, 0, addr, 0); \
1303                             }
1304 #     endif
1305 #   endif /* HPUX */
1306 #   ifdef LINUX
1307 #     define OS_TYPE "LINUX"
1308 #     define LINUX_STACKBOTTOM
1309 #     define DYNAMIC_LOADING
1310 #     define LINUX_DATA_START
1311       extern int _end[];
1312 #     define DATAEND (_end)
1313 #   endif /* LINUX */
1314 # endif /* HP_PA */
1315
1316 # ifdef ALPHA
1317 #   define MACH_TYPE "ALPHA"
1318 #   define ALIGNMENT 8
1319 #   ifdef NETBSD
1320 #       define OS_TYPE "NETBSD"
1321 #       define HEURISTIC2
1322 #       define DATASTART GC_data_start
1323 #       define ELFCLASS32 32
1324 #       define ELFCLASS64 64
1325 #       define ELF_CLASS ELFCLASS64
1326 #       define CPP_WORDSZ 64
1327 #       define DYNAMIC_LOADING
1328 #   endif
1329 #   ifdef OPENBSD
1330 #       define OS_TYPE "OPENBSD"
1331 #       define HEURISTIC2
1332 #       define CPP_WORDSZ 64
1333 #       ifdef __ELF__   /* since OpenBSD/Alpha 2.9 */
1334 #          define DATASTART GC_data_start
1335 #          define ELFCLASS32 32
1336 #          define ELFCLASS64 64
1337 #          define ELF_CLASS ELFCLASS64
1338 #       else            /* ECOFF, until OpenBSD/Alpha 2.7 */
1339 #          define DATASTART ((ptr_t) 0x140000000)
1340 #       endif
1341 #   endif
1342 #   ifdef FREEBSD
1343 #       define OS_TYPE "FREEBSD"
1344 /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
1345 #       define SIG_SUSPEND SIGUSR1
1346 #       define SIG_THR_RESTART SIGUSR2
1347 #       define FREEBSD_STACKBOTTOM
1348 #       ifdef __ELF__
1349 #           define DYNAMIC_LOADING
1350 #       endif
1351 /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
1352         extern char etext[];
1353         extern char edata[];
1354         extern char end[];
1355 #       define NEED_FIND_LIMIT
1356 #       define DATASTART ((ptr_t)(etext))
1357 #       define DATAEND (GC_find_limit (DATASTART, TRUE))
1358 #       define DATASTART2 ((ptr_t)(edata))
1359 #       define DATAEND2 ((ptr_t)(end))
1360 #       define CPP_WORDSZ 64
1361 #   endif
1362 #   ifdef OSF1
1363 #       define OS_TYPE "OSF1"
1364 #       define DATASTART ((ptr_t) 0x140000000)
1365         extern int _end[];
1366 #       define DATAEND ((ptr_t) _end)
1367         extern char ** environ;
1368         /* round up from the value of environ to the nearest page boundary */
1369         /* Probably breaks if putenv is called before collector            */
1370         /* initialization.                                                 */
1371 #       define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
1372 /* #    define HEURISTIC2 */
1373         /* Normally HEURISTIC2 is too conervative, since                */
1374         /* the text segment immediately follows the stack.              */
1375         /* Hence we give an upper pound.                                */
1376         /* This is currently unused, since we disabled HEURISTIC2       */
1377         extern int __start[];
1378 #       define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))
1379 #       define CPP_WORDSZ 64
1380 #       define MPROTECT_VDB
1381 #       define DYNAMIC_LOADING
1382 #   endif
1383 #   ifdef LINUX
1384 #       define OS_TYPE "LINUX"
1385 #       define CPP_WORDSZ 64
1386 #       define STACKBOTTOM ((ptr_t) 0x120000000)
1387 #       ifdef __ELF__
1388 #         define SEARCH_FOR_DATA_START
1389 #         define DATASTART GC_data_start
1390 #         define DYNAMIC_LOADING
1391 #       else
1392 #           define DATASTART ((ptr_t) 0x140000000)
1393 #       endif
1394         extern int _end[];
1395 #       define DATAEND (_end)
1396 #       define MPROTECT_VDB
1397                 /* Has only been superficially tested.  May not */
1398                 /* work on all versions.                        */
1399 #   endif
1400 # endif
1401
1402 # ifdef IA64
1403 #   define MACH_TYPE "IA64"
1404 #   define USE_GENERIC_PUSH_REGS
1405         /* We need to get preserved registers in addition to register   */
1406         /* windows.   That's easiest to do with setjmp.                 */
1407 #   ifdef PARALLEL_MARK
1408 #       define USE_MARK_BYTES
1409             /* Compare-and-exchange is too expensive to use for         */
1410             /* setting mark bits.                                       */
1411 #   endif
1412 #   ifdef HPUX
1413 #       ifdef _ILP32
1414 #         define CPP_WORDSZ 32
1415 #         define ALIGN_DOUBLE
1416             /* Requires 8 byte alignment for malloc */
1417 #         define ALIGNMENT 4
1418 #       else
1419 #         ifndef _LP64
1420                 ---> unknown ABI
1421 #         endif
1422 #         define CPP_WORDSZ 64
1423 #         define ALIGN_DOUBLE
1424             /* Requires 16 byte alignment for malloc */
1425 #         define ALIGNMENT 8
1426 #       endif
1427 #       define OS_TYPE "HPUX"   
1428         extern int __data_start[];
1429 #       define DATASTART ((ptr_t)(__data_start))
1430         /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2       */
1431         /* to this.  Note that the GC must be initialized before the    */
1432         /* first putenv call.                                           */
1433         extern char ** environ;
1434 #       define STACKBOTTOM ((ptr_t)environ)
1435 #       define DYNAMIC_LOADING
1436 #       include <unistd.h>
1437 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1438         /* The following was empirically determined, and is probably    */
1439         /* not very robust.                                             */
1440         /* Note that the backing store base seems to be at a nice       */
1441         /* address minus one page.                                      */
1442 #       define BACKING_STORE_DISPLACEMENT 0x1000000
1443 #       define BACKING_STORE_ALIGNMENT 0x1000
1444 #       define BACKING_STORE_BASE \
1445           (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) \
1446                         & ~(BACKING_STORE_ALIGNMENT - 1))
1447 #   endif
1448 #   ifdef LINUX
1449 #       define CPP_WORDSZ 64
1450 #       define ALIGN_DOUBLE
1451           /* Requires 16 byte alignment for malloc */
1452 #       define ALIGNMENT 8
1453 #       define OS_TYPE "LINUX"
1454         /* The following works on NUE and older kernels:        */
1455 /* #       define STACKBOTTOM ((ptr_t) 0xa000000000000000l)     */
1456         /* This does not work on NUE:                           */
1457 #       define LINUX_STACKBOTTOM
1458         /* We also need the base address of the register stack  */
1459         /* backing store.  This is computed in                  */
1460         /* GC_linux_register_stack_base based on the following  */
1461         /* constants:                                           */
1462 #       define BACKING_STORE_ALIGNMENT 0x100000
1463 #       define BACKING_STORE_DISPLACEMENT 0x80000000
1464         extern char * GC_register_stackbottom;
1465 #       define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
1466 #       define SEARCH_FOR_DATA_START
1467 #       define DATASTART GC_data_start
1468 #       ifdef __GNUC__
1469 #         define DYNAMIC_LOADING
1470 #       else
1471           /* In the Intel compiler environment, we seem to end up with  */
1472           /* statically linked executables and an undefined reference   */
1473           /* to _DYNAMIC                                                */
1474 #       endif
1475 #       define MPROTECT_VDB
1476                 /* Requires Linux 2.3.47 or later.      */
1477         extern int _end[];
1478 #       define DATAEND (_end)
1479 #       ifdef __GNUC__
1480 #         define PREFETCH(x) \
1481             __asm__ ("  lfetch  [%0]": : "r"((void *)(x)))
1482 #         define PREFETCH_FOR_WRITE(x) \
1483             __asm__ ("  lfetch.excl     [%0]": : "r"((void *)(x)))
1484 #         define CLEAR_DOUBLE(x) \
1485             __asm__ ("  stf.spill       [%0]=f0": : "r"((void *)(x)))
1486 #       endif
1487 #   endif
1488 # endif
1489
1490 # ifdef M88K
1491 #   define MACH_TYPE "M88K"
1492 #   define ALIGNMENT 4
1493 #   define ALIGN_DOUBLE
1494     extern int etext[];
1495 #   ifdef CX_UX
1496 #       define OS_TYPE "CX_UX"
1497 #       define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1498 #   endif
1499 #   ifdef  DGUX
1500 #       define OS_TYPE "DGUX"
1501         extern char * GC_SysVGetDataStart();
1502 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, etext)
1503 #   endif
1504 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1505 # endif
1506
1507 # ifdef S370
1508 #   define MACH_TYPE "S370"
1509 #   define ALIGNMENT 4  /* Required by hardware */
1510 #   define USE_GENERIC_PUSH_REGS
1511 #   ifdef UTS4
1512 #       define OS_TYPE "UTS4"
1513         extern int etext[];
1514         extern int _etext[];
1515         extern int _end[];
1516         extern char * GC_SysVGetDataStart();
1517 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, _etext)
1518 #       define DATAEND (_end)
1519 #       define HEURISTIC2
1520 #   endif
1521 #   ifdef LINUX
1522 #       define OS_TYPE "LINUX"
1523 #       define HEURISTIC1
1524 #       define DYNAMIC_LOADING
1525         extern int __data_start[];
1526 #       define DATASTART ((ptr_t)(__data_start))
1527 #   endif
1528 # endif
1529
1530 # if defined(PJ)
1531 #   define ALIGNMENT 4
1532     extern int _etext[];
1533 #   define DATASTART ((ptr_t)(_etext))
1534 #   define HEURISTIC1
1535 # endif
1536
1537 # ifdef ARM32
1538 #   define CPP_WORDSZ 32
1539 #   define MACH_TYPE "ARM32"
1540 #   define ALIGNMENT 4
1541 #   ifdef NETBSD
1542 #       define OS_TYPE "NETBSD"
1543 #       define HEURISTIC2
1544         extern char etext[];
1545 #       define DATASTART ((ptr_t)(etext))
1546 #       define USE_GENERIC_PUSH_REGS
1547 #   endif
1548 #   ifdef LINUX
1549 #       define OS_TYPE "LINUX"
1550 #       define HEURISTIC1
1551 #       undef STACK_GRAN
1552 #       define STACK_GRAN 0x10000000
1553 #       define USE_GENERIC_PUSH_REGS
1554 #       ifdef __ELF__
1555 #            define DYNAMIC_LOADING
1556 #            include <features.h>
1557 #            if defined(__GLIBC__) && __GLIBC__ >= 2
1558 #                define LINUX_DATA_START
1559 #            else
1560                  extern char **__environ;
1561 #                define DATASTART ((ptr_t)(&__environ))
1562                               /* hideous kludge: __environ is the first */
1563                               /* word in crt0.o, and delimits the start */
1564                               /* of the data segment, no matter which   */
1565                               /* ld options were passed through.        */
1566                               /* We could use _etext instead, but that  */
1567                               /* would include .rodata, which may       */
1568                               /* contain large read-only data tables    */
1569                               /* that we'd rather not scan.             */
1570 #            endif
1571              extern int _end[];
1572 #            define DATAEND (_end)
1573 #       else
1574              extern int etext[];
1575 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1576 #       endif
1577 #   endif
1578 #   ifdef MSWINCE
1579 #     define OS_TYPE "MSWINCE"
1580 #     define DATAEND /* not needed */
1581 #   endif
1582 #   ifdef NOSYS
1583       /* __data_start is usually defined in the target linker script.  */
1584       extern int __data_start[];
1585 #     define DATASTART (ptr_t)(__data_start)
1586 #     define USE_GENERIC_PUSH_REGS
1587       /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S  */
1588       extern void *__stack_base__;
1589 #     define STACKBOTTOM ((ptr_t) (__stack_base__))
1590 #   endif
1591 #endif
1592
1593 # ifdef SH
1594 #   define MACH_TYPE "SH"
1595 #   define ALIGNMENT 4
1596 #   ifdef MSWINCE
1597 #     define OS_TYPE "MSWINCE"
1598 #     define DATAEND /* not needed */
1599 #   endif
1600 #   ifdef LINUX
1601 #     define OS_TYPE "LINUX"
1602 #     define STACKBOTTOM ((ptr_t) 0x7c000000)
1603 #     define USE_GENERIC_PUSH_REGS
1604 #     define DYNAMIC_LOADING
1605 #     define LINUX_DATA_START
1606       extern int _end[];
1607 #     define DATAEND (_end)
1608 #   endif
1609 # endif
1610  
1611 # ifdef SH4
1612 #   define MACH_TYPE "SH4"
1613 #   define OS_TYPE "MSWINCE"
1614 #   define ALIGNMENT 4
1615 #   define DATAEND /* not needed */
1616 # endif
1617
1618 #ifdef LINUX_DATA_START
1619     /* Some Linux distributions arrange to define __data_start.  Some   */
1620     /* define data_start as a weak symbol.  The latter is technically   */
1621     /* broken, since the user program may define data_start, in which   */
1622     /* case we lose.  Nonetheless, we try both, prefering __data_start. */
1623     /* We assume gcc.   */
1624 #   pragma weak __data_start
1625     extern int __data_start[];
1626 #   pragma weak data_start
1627     extern int data_start[];
1628 #   define DATASTART ((ptr_t)(__data_start != 0? __data_start : data_start))
1629 #endif
1630
1631 #if defined(LINUX) && defined(REDIRECT_MALLOC)
1632     /* Rld appears to allocate some memory with its own allocator, and  */
1633     /* some through malloc, which might be redirected.  To make this    */
1634     /* work with collectable memory, we have to scan memory allocated   */
1635     /* by rld's internal malloc.                                        */
1636 #   define USE_PROC_FOR_LIBRARIES
1637 #endif
1638     
1639 # ifndef STACK_GROWS_UP
1640 #   define STACK_GROWS_DOWN
1641 # endif
1642
1643 # ifndef CPP_WORDSZ
1644 #   define CPP_WORDSZ 32
1645 # endif
1646
1647 # ifndef OS_TYPE
1648 #   define OS_TYPE ""
1649 # endif
1650
1651 # ifndef DATAEND
1652     extern int end[];
1653 #   define DATAEND (end)
1654 # endif
1655
1656 # if defined(SVR4) && !defined(GETPAGESIZE)
1657 #    include <unistd.h>
1658 #    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
1659 # endif
1660
1661 # ifndef GETPAGESIZE
1662 #   if defined(SUNOS5) || defined(IRIX5)
1663 #       include <unistd.h>
1664 #   endif
1665 #   define GETPAGESIZE() getpagesize()
1666 # endif
1667
1668 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1669     /* OS has SVR4 generic features.  Probably others also qualify.     */
1670 #   define SVR4
1671 # endif
1672
1673 # if defined(SUNOS5) || defined(DRSNX)
1674     /* OS has SUNOS5 style semi-undocumented interface to dynamic       */
1675     /* loader.                                                          */
1676 #   define SUNOS5DL
1677     /* OS has SUNOS5 style signal handlers.                             */
1678 #   define SUNOS5SIGS
1679 # endif
1680
1681 # if defined(HPUX)
1682 #   define SUNOS5SIGS
1683 # endif
1684
1685 # if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \
1686     || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1687     || defined(BSD) || defined(_AIX) || defined(MACOSX) || defined(OSF1)
1688 #   define UNIX_LIKE   /* Basic Unix-like system calls work.    */
1689 # endif
1690
1691 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1692    -> bad word size
1693 # endif
1694
1695 # ifdef PCR
1696 #   undef DYNAMIC_LOADING
1697 #   undef STACKBOTTOM
1698 #   undef HEURISTIC1
1699 #   undef HEURISTIC2
1700 #   undef PROC_VDB
1701 #   undef MPROTECT_VDB
1702 #   define PCR_VDB
1703 # endif
1704
1705 # ifdef SRC_M3
1706 /* Postponed for now. */
1707 #   undef PROC_VDB
1708 #   undef MPROTECT_VDB
1709 # endif
1710
1711 # ifdef SMALL_CONFIG
1712 /* Presumably not worth the space it takes. */
1713 #   undef PROC_VDB
1714 #   undef MPROTECT_VDB
1715 # endif
1716
1717 # ifdef USE_MUNMAP
1718 #   undef MPROTECT_VDB  /* Can't deal with address space holes. */
1719 # endif
1720
1721 # ifdef PARALLEL_MARK
1722 #   undef MPROTECT_VDB  /* For now.     */
1723 # endif
1724
1725 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1726 #   define DEFAULT_VDB
1727 # endif
1728
1729 # ifndef PREFETCH
1730 #   define PREFETCH(x)
1731 #   define NO_PREFETCH
1732 # endif
1733
1734 # ifndef PREFETCH_FOR_WRITE
1735 #   define PREFETCH_FOR_WRITE(x)
1736 #   define NO_PREFETCH_FOR_WRITE
1737 # endif
1738
1739 # ifndef CACHE_LINE_SIZE
1740 #   define CACHE_LINE_SIZE 32   /* Wild guess   */
1741 # endif
1742
1743 # ifndef CLEAR_DOUBLE
1744 #   define CLEAR_DOUBLE(x) \
1745         ((word*)x)[0] = 0; \
1746         ((word*)x)[1] = 0;
1747 # endif /* CLEAR_DOUBLE */
1748
1749 /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
1750 # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
1751 #   define GC_SOLARIS_THREADS
1752 # endif
1753
1754 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
1755 --> inconsistent configuration
1756 # endif
1757 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
1758 --> inconsistent configuration
1759 # endif
1760 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
1761 --> inconsistent configuration
1762 # endif
1763 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
1764 --> inconsistent configuration
1765 # endif
1766 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32)
1767     /* Ideally CYGWIN32 should work, in addition to MSWIN32.  I suspect */
1768     /* the necessary code is mostly there, but nobody has actually made */
1769     /* sure the right combination of pieces is compiled in, etc.        */
1770 --> inconsistent configuration
1771 # endif
1772
1773 # if defined(PCR) || defined(SRC_M3) || \
1774         defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
1775         defined(GC_PTHREADS)
1776 #   define THREADS
1777 # endif
1778
1779 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \
1780      || defined(LINT) || defined(MSWINCE) \
1781      || (defined(I386) && defined(__LCC__))
1782         /* Use setjmp based hack to mark from callee-save registers.    */
1783         /* The define should move to the individual platform            */
1784         /* descriptions.                                                */
1785 #       define USE_GENERIC_PUSH_REGS
1786 # endif
1787
1788 # if defined(SPARC)
1789 #   define ASM_CLEAR_CODE       /* Stack clearing is crucial, and we    */
1790                                 /* include assembly code to do it well. */
1791 # endif
1792
1793 /* Can we save call chain in objects for debugging?                     */
1794 /* SET NFRAMES (# of saved frames) and NARGS (#of args for each frame)  */
1795 /* to reasonable values for the platform.                               */
1796 /* Set SAVE_CALL_CHAIN if we can.  SAVE_CALL_COUNT can be specified at  */
1797 /* build time, though we feel free to adjust it slightly.               */
1798 /* Define NEED_CALLINFO if we either save the call stack or             */
1799 /* GC_ADD_CALLER is defined.                                            */
1800 #ifdef LINUX
1801 # include <features.h>
1802 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2
1803 #   define HAVE_BUILTIN_BACKTRACE
1804 # endif
1805 #endif
1806
1807 #if defined(SPARC)
1808 # define CAN_SAVE_CALL_STACKS
1809 # define CAN_SAVE_CALL_ARGS
1810 #endif
1811 #if defined(I386) && defined(LINUX)
1812     /* SAVE_CALL_CHAIN is supported if the code is compiled to save     */
1813     /* frame pointers by default, i.e. no -fomit-frame-pointer flag.    */
1814 # define CAN_SAVE_CALL_STACKS
1815 # define CAN_SAVE_CALL_ARGS
1816 #endif
1817 #if defined(HAVE_BUILTIN_BACKTRACE) && !defined(CAN_SAVE_CALL_STACKS)
1818 # define CAN_SAVE_CALL_STACKS
1819 #endif
1820
1821 # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
1822      && defined(CAN_SAVE_CALL_STACKS)
1823 #   define SAVE_CALL_CHAIN 
1824 # endif
1825 # ifdef SAVE_CALL_CHAIN
1826 #   if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
1827 #     define NARGS SAVE_CALL_NARGS
1828 #   else
1829 #     define NARGS 0    /* Number of arguments to save for each call.   */
1830 #   endif
1831 # endif
1832 # ifdef SAVE_CALL_CHAIN
1833 #   ifndef SAVE_CALL_COUNT
1834 #     define NFRAMES 6  /* Number of frames to save. Even for           */
1835                         /* alignment reasons.                           */
1836 #   else
1837 #     define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
1838 #   endif
1839 #   define NEED_CALLINFO
1840 # endif /* SAVE_CALL_CHAIN */
1841 # ifdef GC_ADD_CALLER
1842 #   define NFRAMES 1
1843 #   define NARGS 0
1844 #   define NEED_CALLINFO
1845 # endif
1846
1847 # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
1848 #   define DBG_HDRS_ALL
1849 # endif
1850
1851 # endif /* GCCONFIG_H */