OSDN Git Service

2002-03-25 Paolo Carlini <pcarlini@unitus.it>
[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.
454  *
455  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
456  * the pointer size.
457  *
458  * STACKBOTTOM is the cool end of the stack, which is usually the
459  * highest address in the stack.
460  * Under PCR or OS/2, we have other ways of finding thread stacks.
461  * For each machine, the following should:
462  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
463  * 2) define exactly one of
464  *      STACKBOTTOM (should be defined to be an expression)
465  *      HEURISTIC1
466  *      HEURISTIC2
467  * If either of the last two macros are defined, then STACKBOTTOM is computed
468  * during collector startup using one of the following two heuristics:
469  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
470  *              the next multiple of STACK_GRAN.
471  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
472  *              in small steps (decrement if STACK_GROWS_UP), and read the value
473  *              at each location.  Remember the value when the first
474  *              Segmentation violation or Bus error is signalled.  Round that
475  *              to the nearest plausible page boundary, and use that instead
476  *              of STACKBOTTOM.
477  *
478  * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
479  * the value of environ is a pointer that can serve as STACKBOTTOM.
480  * I expect that HEURISTIC2 can be replaced by this approach, which
481  * interferes far less with debugging.  However it has the disadvantage
482  * that it's confused by a putenv call before the collector is initialized.
483  * This could be dealt with by intercepting putenv ...
484  *
485  * If no expression for STACKBOTTOM can be found, and neither of the above
486  * heuristics are usable, the collector can still be used with all of the above
487  * undefined, provided one of the following is done:
488  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
489  *    without reference to STACKBOTTOM.  This is appropriate for use in
490  *    conjunction with thread packages, since there will be multiple stacks.
491  *    (Allocating thread stacks in the heap, and treating them as ordinary
492  *    heap data objects is also possible as a last resort.  However, this is
493  *    likely to introduce significant amounts of excess storage retention
494  *    unless the dead parts of the thread stacks are periodically cleared.)
495  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
496  *    If the author of the client code controls the main program, this is
497  *    easily accomplished by introducing a new main program, setting
498  *    GC_stackbottom to the address of a local variable, and then calling
499  *    the original main program.  The new main program would read something
500  *    like:
501  *
502  *              # include "gc_private.h"
503  *
504  *              main(argc, argv, envp)
505  *              int argc;
506  *              char **argv, **envp;
507  *              {
508  *                  int dummy;
509  *
510  *                  GC_stackbottom = (ptr_t)(&dummy);
511  *                  return(real_main(argc, argv, envp));
512  *              }
513  *
514  *
515  * Each architecture may also define the style of virtual dirty bit
516  * implementation to be used:
517  *   MPROTECT_VDB: Write protect the heap and catch faults.
518  *   PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
519  *
520  * An architecture may define DYNAMIC_LOADING if dynamic_load.c
521  * defined GC_register_dynamic_libraries() for the architecture.
522  *
523  * An architecture may define PREFETCH(x) to preload the cache with *x.
524  * This defaults to a no-op.
525  *
526  * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
527  *
528  * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
529  * clear the two words at GC_malloc-aligned address x.  By default,
530  * word stores of 0 are used instead.
531  */
532
533 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
534  * to push the relevant registers onto the stack.  This generally makes
535  * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
536  */
537 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
538                            (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
539 #   define HAVE_BUILTIN_UNWIND_INIT
540 # endif
541
542 # define STACK_GRAN 0x1000000
543 # ifdef M68K
544 #   define MACH_TYPE "M68K"
545 #   define ALIGNMENT 2
546 #   ifdef OPENBSD
547 #       define OS_TYPE "OPENBSD"
548 #       define HEURISTIC2
549         extern char etext;
550 #       define DATASTART ((ptr_t)(&etext))
551 #   endif
552 #   ifdef NETBSD
553 #       define OS_TYPE "NETBSD"
554 #       define HEURISTIC2
555         extern char etext;
556 #       define DATASTART ((ptr_t)(&etext))
557 #   endif
558 #   ifdef LINUX
559 #       define OS_TYPE "LINUX"
560 #       define STACKBOTTOM ((ptr_t)0xf0000000)
561 /* #       define MPROTECT_VDB - Reported to not work  9/17/01 */
562 #       ifdef __ELF__
563 #            define DYNAMIC_LOADING
564 #            include <features.h>
565 #            if defined(__GLIBC__)&& __GLIBC__>=2
566 #              define LINUX_DATA_START
567 #            else /* !GLIBC2 */
568                extern char **__environ;
569 #              define DATASTART ((ptr_t)(&__environ))
570                              /* hideous kludge: __environ is the first */
571                              /* word in crt0.o, and delimits the start */
572                              /* of the data segment, no matter which   */
573                              /* ld options were passed through.        */
574                              /* We could use _etext instead, but that  */
575                              /* would include .rodata, which may       */
576                              /* contain large read-only data tables    */
577                              /* that we'd rather not scan.             */
578 #            endif /* !GLIBC2 */
579              extern int _end;
580 #            define DATAEND (&_end)
581 #       else
582              extern int etext;
583 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
584 #       endif
585 #   endif
586 #   ifdef SUNOS4
587 #       define OS_TYPE "SUNOS4"
588         extern char etext;
589 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
590 #       define HEURISTIC1       /* differs      */
591 #       define DYNAMIC_LOADING
592 #   endif
593 #   ifdef HP
594 #       define OS_TYPE "HP"
595         extern char etext;
596 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
597 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
598                               /* empirically determined.  seems to work. */
599 #       include <unistd.h>
600 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
601 #   endif
602 #   ifdef SYSV
603 #       define OS_TYPE "SYSV"
604         extern etext;
605 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
606                                    & ~0x3fffff) \
607                                   +((word)&etext & 0x1fff))
608         /* This only works for shared-text binaries with magic number 0413.
609            The other sorts of SysV binaries put the data at the end of the text,
610            in which case the default of &etext would work.  Unfortunately,
611            handling both would require having the magic-number available.
612                                 -- Parag
613            */
614 #       define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
615                         /* The stack starts at the top of memory, but   */
616                         /* 0x0 cannot be used as setjump_test complains */
617                         /* that the stack direction is incorrect.  Two  */
618                         /* bytes down from 0x0 should be safe enough.   */
619                         /*              --Parag                         */
620 #       include <sys/mmu.h>
621 #       define GETPAGESIZE() PAGESIZE   /* Is this still right? */
622 #   endif
623 #   ifdef AMIGA
624 #       define OS_TYPE "AMIGA"
625                 /* STACKBOTTOM and DATASTART handled specially  */
626                 /* in os_dep.c                                  */
627 #       define DATAEND  /* not needed */
628 #       define GETPAGESIZE() 4096
629 #   endif
630 #   ifdef MACOS
631 #     ifndef __LOWMEM__
632 #     include <LowMem.h>
633 #     endif
634 #     define OS_TYPE "MACOS"
635                         /* see os_dep.c for details of global data segments. */
636 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
637 #     define DATAEND    /* not needed */
638 #     define GETPAGESIZE() 4096
639 #   endif
640 #   ifdef NEXT
641 #       define OS_TYPE "NEXT"
642 #       define DATASTART ((ptr_t) get_etext())
643 #       define STACKBOTTOM ((ptr_t) 0x4000000)
644 #       define DATAEND  /* not needed */
645 #   endif
646 # endif
647
648 # ifdef POWERPC
649 #   define MACH_TYPE "POWERPC"
650 #   ifdef MACOS
651 #     define ALIGNMENT 2  /* Still necessary?  Could it be 4?   */
652 #     ifndef __LOWMEM__
653 #     include <LowMem.h>
654 #     endif
655 #     define OS_TYPE "MACOS"
656                         /* see os_dep.c for details of global data segments. */
657 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
658 #     define DATAEND  /* not needed */
659 #   endif
660 #   ifdef LINUX
661 #     define ALIGNMENT 4        /* Guess.  Can someone verify?  */
662                                 /* This was 2, but that didn't sound right. */
663 #     define OS_TYPE "LINUX"
664 #     define HEURISTIC1
665 #     define DYNAMIC_LOADING
666 #     undef STACK_GRAN
667 #     define STACK_GRAN 0x10000000
668         /* Stack usually starts at 0x80000000 */
669 #     define LINUX_DATA_START
670       extern int _end;
671 #     define DATAEND (&_end)
672 #   endif
673 #   ifdef MACOSX
674       /* There are reasons to suspect this may not be reliable.         */
675 #     define ALIGNMENT 4
676 #     define OS_TYPE "MACOSX"
677 #     define DATASTART ((ptr_t) get_etext())
678 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
679 #     define DATAEND    /* not needed */
680 #     define MPROTECT_VDB
681 #     include <unistd.h>
682 #     define GETPAGESIZE() getpagesize()
683 #   endif
684 #   ifdef NETBSD
685 #     define ALIGNMENT 4
686 #     define OS_TYPE "NETBSD"
687 #     define HEURISTIC2
688       extern char etext;
689 #     define DATASTART GC_data_start
690 #     define DYNAMIC_LOADING
691 #   endif
692 #   ifdef NOSYS
693 #     define ALIGNMENT 4
694 #     define OS_TYPE "NOSYS"
695       extern void __end, __dso_handle;
696 #     define DATASTART (&__dso_handle)  /* OK, that's ugly.  */
697 #     define DATAEND (&__end)
698         /* Stack starts at 0xE0000000 for the simulator.  */
699 #     undef STACK_GRAN
700 #     define STACK_GRAN 0x10000000
701 #     define HEURISTIC1
702 #   endif
703 # endif
704
705 # ifdef VAX
706 #   define MACH_TYPE "VAX"
707 #   define ALIGNMENT 4  /* Pointers are longword aligned by 4.2 C compiler */
708     extern char etext;
709 #   define DATASTART ((ptr_t)(&etext))
710 #   ifdef BSD
711 #       define OS_TYPE "BSD"
712 #       define HEURISTIC1
713                         /* HEURISTIC2 may be OK, but it's hard to test. */
714 #   endif
715 #   ifdef ULTRIX
716 #       define OS_TYPE "ULTRIX"
717 #       define STACKBOTTOM ((ptr_t) 0x7fffc800)
718 #   endif
719 # endif
720
721 # ifdef RT
722 #   define MACH_TYPE "RT"
723 #   define ALIGNMENT 4
724 #   define DATASTART ((ptr_t) 0x10000000)
725 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
726 # endif
727
728 # ifdef SPARC
729 #   define MACH_TYPE "SPARC"
730 #   if defined(__arch64__) || defined(__sparcv9)
731 #     define ALIGNMENT 8
732 #     define CPP_WORDSZ 64
733 #     define ELF_CLASS ELFCLASS64
734 #   else
735 #     define ALIGNMENT 4        /* Required by hardware */
736 #     define CPP_WORDSZ 32
737 #   endif
738 #   define ALIGN_DOUBLE
739 #   ifdef SUNOS5
740 #       define OS_TYPE "SUNOS5"
741         extern int _etext;
742         extern int _end;
743         extern char * GC_SysVGetDataStart();
744 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
745 #       define DATAEND (&_end)
746 #       if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
747 #           define USE_MMAP
748             /* Otherwise we now use calloc.  Mmap may result in the     */
749             /* heap interleaved with thread stacks, which can result in */
750             /* excessive blacklisting.  Sbrk is unusable since it       */
751             /* doesn't interact correctly with the system malloc.       */
752 #       endif
753 #       ifdef USE_MMAP
754 #         define HEAP_START (ptr_t)0x40000000
755 #       else
756 #         define HEAP_START DATAEND
757 #       endif
758 #       define PROC_VDB
759 /*      HEURISTIC1 reportedly no longer works under 2.7.                */
760 /*      HEURISTIC2 probably works, but this appears to be preferable.   */
761 /*      Apparently USRSTACK is defined to be USERLIMIT, but in some     */
762 /*      installations that's undefined.  We work around this with a     */
763 /*      gross hack:                                                     */
764 #       include <sys/vmparam.h>
765 #       ifdef USERLIMIT
766           /* This should work everywhere, but doesn't.  */
767 #         define STACKBOTTOM USRSTACK
768 #       else
769 #         define HEURISTIC2
770 #       endif
771 #       include <unistd.h>
772 #       define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
773                 /* getpagesize() appeared to be missing from at least one */
774                 /* Solaris 5.4 installation.  Weird.                      */
775 #       if CPP_WORDSZ == 32
776 #         define DYNAMIC_LOADING
777 #       endif
778 #   endif
779 #   ifdef SUNOS4
780 #       define OS_TYPE "SUNOS4"
781         /* [If you have a weak stomach, don't read this.]               */
782         /* We would like to use:                                        */
783 /* #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
784         /* This fails occasionally, due to an ancient, but very         */
785         /* persistent ld bug.  &etext is set 32 bytes too high.         */
786         /* We instead read the text segment size from the a.out         */
787         /* header, which happens to be mapped into our address space    */
788         /* at the start of the text segment.  The detective work here   */
789         /* was done by Robert Ehrlich, Manuel Serrano, and Bernard      */
790         /* Serpette of INRIA.                                           */
791         /* This assumes ZMAGIC, i.e. demand-loadable executables.       */
792 #       define TEXTSTART 0x2000
793 #       define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
794 #       define MPROTECT_VDB
795 #       define HEURISTIC1
796 #       define DYNAMIC_LOADING
797 #   endif
798 #   ifdef DRSNX
799 #       define OS_TYPE "DRSNX"
800         extern char * GC_SysVGetDataStart();
801         extern int etext;
802 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
803 #       define MPROTECT_VDB
804 #       define STACKBOTTOM ((ptr_t) 0xdfff0000)
805 #       define DYNAMIC_LOADING
806 #   endif
807 #   ifdef LINUX
808 #     define OS_TYPE "LINUX"
809 #     ifdef __ELF__
810 #       define DYNAMIC_LOADING
811 #     else
812           Linux Sparc/a.out not supported
813 #     endif
814       extern int _end;
815       extern int _etext;
816 #     define DATAEND (&_end)
817 #     define SVR4
818 #     ifdef __arch64__
819 #       define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
820 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
821 #     else
822 #       define STACKBOTTOM ((ptr_t) 0xf0000000)
823 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
824 #     endif
825 #   endif
826 #   ifdef OPENBSD
827 #     define OS_TYPE "OPENBSD"
828 #     define STACKBOTTOM ((ptr_t) 0xf8000000)
829       extern int etext;
830 #     define DATASTART ((ptr_t)(&etext))
831 #   endif
832 #   ifdef NETBSD
833 #     define OS_TYPE "NETBSD"
834 #     define HEURISTIC2
835 #     ifdef __ELF__
836 #       define DATASTART GC_data_start
837 #       define DYNAMIC_LOADING
838 #     else
839         extern char etext;
840 #       define DATASTART ((ptr_t)(&etext))
841 #     endif
842 #   endif
843 # endif
844
845 # ifdef I386
846 #   define MACH_TYPE "I386"
847 #   define ALIGNMENT 4  /* Appears to hold for all "32 bit" compilers   */
848                         /* except Borland.  The -a4 option fixes        */
849                         /* Borland.                                     */
850                         /* Ivan Demakov: For Watcom the option is -zp4. */
851 #   ifndef SMALL_CONFIG
852 #     define ALIGN_DOUBLE /* Not strictly necessary, but may give speed   */
853                           /* improvement on Pentiums.                     */
854 #   endif
855 #   ifdef HAVE_BUILTIN_UNWIND_INIT
856 #       define USE_GENERIC_PUSH_REGS
857 #   endif
858 #   ifdef SEQUENT
859 #       define OS_TYPE "SEQUENT"
860         extern int etext;
861 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
862 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
863 #   endif
864 #   ifdef BEOS
865 #     define OS_TYPE "BEOS"
866 #     include <OS.h>
867 #     define GETPAGESIZE() B_PAGE_SIZE
868       extern int etext;
869 #     define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
870 #   endif
871 #   ifdef SUNOS5
872 #       define OS_TYPE "SUNOS5"
873         extern int _etext, _end;
874         extern char * GC_SysVGetDataStart();
875 #       define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
876 #       define DATAEND (&_end)
877 /*      # define STACKBOTTOM ((ptr_t)(&_start)) worked through 2.7,     */
878 /*      but reportedly breaks under 2.8.  It appears that the stack     */
879 /*      base is a property of the executable, so this should not break  */
880 /*      old executables.                                                */
881 /*      HEURISTIC2 probably works, but this appears to be preferable.   */
882 #       include <sys/vm.h>
883 #       define STACKBOTTOM USRSTACK
884 /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
885 /* It appears to be fixed in 2.8 and 2.9.                               */
886 #       ifdef SOLARIS25_PROC_VDB_BUG_FIXED
887 #         define PROC_VDB
888 #       endif
889 #       define DYNAMIC_LOADING
890 #       if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
891 #           define USE_MMAP
892             /* Otherwise we now use calloc.  Mmap may result in the     */
893             /* heap interleaved with thread stacks, which can result in */
894             /* excessive blacklisting.  Sbrk is unusable since it       */
895             /* doesn't interact correctly with the system malloc.       */
896 #       endif
897 #       ifdef USE_MMAP
898 #         define HEAP_START (ptr_t)0x40000000
899 #       else
900 #         define HEAP_START DATAEND
901 #       endif
902 #   endif
903 #   ifdef SCO
904 #       define OS_TYPE "SCO"
905         extern int etext;
906 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
907                                   & ~0x3fffff) \
908                                  +((word)&etext & 0xfff))
909 #       define STACKBOTTOM ((ptr_t) 0x7ffffffc)
910 #   endif
911 #   ifdef SCO_ELF
912 #       define OS_TYPE "SCO_ELF"
913         extern int etext;
914 #       define DATASTART ((ptr_t)(&etext))
915 #       define STACKBOTTOM ((ptr_t) 0x08048000)
916 #       define DYNAMIC_LOADING
917 #       define ELF_CLASS ELFCLASS32
918 #   endif
919 #   ifdef LINUX
920 #       ifndef __GNUC__
921           /* The Intel compiler doesn't like inline assembly */
922 #         define USE_GENERIC_PUSH_REGS
923 #       endif
924 #       define OS_TYPE "LINUX"
925 #       define LINUX_STACKBOTTOM
926 #       if 0
927 #         define HEURISTIC1
928 #         undef STACK_GRAN
929 #         define STACK_GRAN 0x10000000
930           /* STACKBOTTOM is usually 0xc0000000, but this changes with   */
931           /* different kernel configurations.  In particular, systems   */
932           /* with 2GB physical memory will usually move the user        */
933           /* address space limit, and hence initial SP to 0x80000000.   */
934 #       endif
935 #       if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
936 #           define MPROTECT_VDB
937 #       else
938             /* We seem to get random errors in incremental mode,        */
939             /* possibly because Linux threads is itself a malloc client */
940             /* and can't deal with the signals.                         */
941 #       endif
942 #       ifdef __ELF__
943 #            define DYNAMIC_LOADING
944 #            ifdef UNDEFINED    /* includes ro data */
945                extern int _etext;
946 #              define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
947 #            endif
948 #            include <features.h>
949 #            if defined(__GLIBC__) && __GLIBC__ >= 2
950 #                define LINUX_DATA_START
951 #            else
952                  extern char **__environ;
953 #                define DATASTART ((ptr_t)(&__environ))
954                               /* hideous kludge: __environ is the first */
955                               /* word in crt0.o, and delimits the start */
956                               /* of the data segment, no matter which   */
957                               /* ld options were passed through.        */
958                               /* We could use _etext instead, but that  */
959                               /* would include .rodata, which may       */
960                               /* contain large read-only data tables    */
961                               /* that we'd rather not scan.             */
962 #            endif
963              extern int _end;
964 #            define DATAEND (&_end)
965 #       else
966              extern int etext;
967 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
968 #       endif
969 #       ifdef USE_I686_PREFETCH
970 #         define PREFETCH(x) \
971             __asm__ __volatile__ ("     prefetchnta     %0": : "m"(*(char *)(x)))
972             /* Empirically prefetcht0 is much more effective at reducing        */
973             /* cache miss stalls for the targetted load instructions.  But it   */
974             /* seems to interfere enough with other cache traffic that the net  */
975             /* result is worse than prefetchnta.                                */
976 #         if 0 
977             /* Using prefetches for write seems to have a slight negative       */
978             /* impact on performance, at least for a PIII/500.                  */
979 #           define PREFETCH_FOR_WRITE(x) \
980               __asm__ __volatile__ ("   prefetcht0      %0": : "m"(*(char *)(x)))
981 #         endif
982 #       endif
983 #       ifdef USE_3DNOW_PREFETCH
984 #         define PREFETCH(x) \
985             __asm__ __volatile__ ("     prefetch        %0": : "m"(*(char *)(x)))
986 #         define PREFETCH_FOR_WRITE(x) \
987             __asm__ __volatile__ ("     prefetchw       %0": : "m"(*(char *)(x)))
988 #       endif
989 #   endif
990 #   ifdef CYGWIN32
991 #       define OS_TYPE "CYGWIN32"
992           extern int _data_start__;
993           extern int _data_end__;
994           extern int _bss_start__;
995           extern int _bss_end__;
996         /* For binutils 2.9.1, we have                  */
997         /*      DATASTART   = _data_start__             */
998         /*      DATAEND     = _bss_end__                */
999         /* whereas for some earlier versions it was     */
1000         /*      DATASTART   = _bss_start__              */
1001         /*      DATAEND     = _data_end__               */
1002         /* To get it right for both, we take the        */
1003         /* minumum/maximum of the two.                  */
1004 #       define MAX(x,y) ((x) > (y) ? (x) : (y))
1005 #       define MIN(x,y) ((x) < (y) ? (x) : (y))
1006 #       define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
1007 #       define DATAEND   ((ptr_t) MAX(&_data_end__, &_bss_end__))
1008 #       undef STACK_GRAN
1009 #       define STACK_GRAN 0x10000
1010 #       define HEURISTIC1
1011 #   endif
1012 #   ifdef OS2
1013 #       define OS_TYPE "OS2"
1014                 /* STACKBOTTOM and DATASTART are handled specially in   */
1015                 /* os_dep.c. OS2 actually has the right                 */
1016                 /* system call!                                         */
1017 #       define DATAEND  /* not needed */
1018 #       define USE_GENERIC_PUSH_REGS
1019 #   endif
1020 #   ifdef MSWIN32
1021 #       define OS_TYPE "MSWIN32"
1022                 /* STACKBOTTOM and DATASTART are handled specially in   */
1023                 /* os_dep.c.                                            */
1024 #       ifndef __WATCOMC__
1025 #         define MPROTECT_VDB
1026 #       endif
1027 #       define DATAEND  /* not needed */
1028 #   endif
1029 #   ifdef MSWINCE
1030 #       define OS_TYPE "MSWINCE"
1031 #       define DATAEND  /* not needed */
1032 #   endif
1033 #   ifdef DJGPP
1034 #       define OS_TYPE "DJGPP"
1035 #       include "stubinfo.h"
1036         extern int etext;
1037         extern int _stklen;
1038         extern int __djgpp_stack_limit;
1039 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
1040 /* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
1041                                                      + _stklen)) */
1042 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
1043                 /* This may not be right.  */
1044 #   endif
1045 #   ifdef OPENBSD
1046 #       define OS_TYPE "OPENBSD"
1047 #   endif
1048 #   ifdef FREEBSD
1049 #       define OS_TYPE "FREEBSD"
1050 #       ifndef GC_FREEBSD_THREADS
1051 #           define MPROTECT_VDB
1052 #       endif
1053 #       define SIG_SUSPEND SIGUSR1
1054 #       define SIG_THR_RESTART SIGUSR2
1055 #       define FREEBSD_STACKBOTTOM
1056 #       ifdef __ELF__
1057 #           define DYNAMIC_LOADING
1058 #       endif
1059         extern char etext;
1060 #       define DATASTART ((ptr_t)(&etext))
1061 #   endif
1062 #   ifdef NETBSD
1063 #       define OS_TYPE "NETBSD"
1064 #   endif
1065 #   ifdef THREE86BSD
1066 #       define OS_TYPE "THREE86BSD"
1067 #   endif
1068 #   ifdef BSDI
1069 #       define OS_TYPE "BSDI"
1070 #   endif
1071 #   if defined(OPENBSD) || defined(NETBSD) \
1072         || defined(THREE86BSD) || defined(BSDI)
1073 #       define HEURISTIC2
1074         extern char etext;
1075 #       define DATASTART ((ptr_t)(&etext))
1076 #   endif
1077 #   ifdef NEXT
1078 #       define OS_TYPE "NEXT"
1079 #       define DATASTART ((ptr_t) get_etext())
1080 #       define STACKBOTTOM ((ptr_t)0xc0000000)
1081 #       define DATAEND  /* not needed */
1082 #   endif
1083 #   ifdef DOS4GW
1084 #     define OS_TYPE "DOS4GW"
1085       extern long __nullarea;
1086       extern char _end;
1087       extern char *_STACKTOP;
1088       /* Depending on calling conventions Watcom C either precedes
1089          or does not precedes with undescore names of C-variables.
1090          Make sure startup code variables always have the same names.  */
1091       #pragma aux __nullarea "*";
1092       #pragma aux _end "*";
1093 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
1094                          /* confused? me too. */
1095 #     define DATASTART ((ptr_t) &__nullarea)
1096 #     define DATAEND ((ptr_t) &_end)
1097 #   endif
1098 #   ifdef HURD
1099 #     define OS_TYPE "HURD"
1100 #     define STACK_GROWS_DOWN
1101 #     define HEURISTIC2
1102       extern int  __data_start;
1103 #     define DATASTART ( (ptr_t) (&__data_start))
1104       extern int   _end;
1105 #     define DATAEND ( (ptr_t) (&_end))
1106 /* #     define MPROTECT_VDB  Not quite working yet? */
1107 #     define DYNAMIC_LOADING
1108 #   endif
1109 # endif
1110
1111 # ifdef NS32K
1112 #   define MACH_TYPE "NS32K"
1113 #   define ALIGNMENT 4
1114     extern char **environ;
1115 #   define DATASTART ((ptr_t)(&environ))
1116                               /* hideous kludge: environ is the first   */
1117                               /* word in crt0.o, and delimits the start */
1118                               /* of the data segment, no matter which   */
1119                               /* ld options were passed through.        */
1120 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1121 # endif
1122
1123 # ifdef MIPS
1124 #   define MACH_TYPE "MIPS"
1125 #   ifdef LINUX
1126       /* This was developed for a linuxce style platform.  Probably     */
1127       /* needs to be tweaked for workstation class machines.            */
1128 #     define OS_TYPE "LINUX"
1129       extern int __data_start;
1130 #     define DATASTART ((ptr_t)(&__data_start))
1131 #     define ALIGNMENT 4
1132 #     define USE_GENERIC_PUSH_REGS
1133 #     define STACKBOTTOM ((ptr_t)0x7fff8000)
1134         /* Older toolchains may need 0x80000000.        */
1135         /* In many cases, this should probably use LINUX_STACKBOTTOM    */
1136         /* instead. But some kernel versions seem to give the wrong     */
1137         /* value from /proc.                                            */
1138 #   endif /* Linux */
1139 #   ifdef EWS4800
1140 #      define HEURISTIC2
1141 #      if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
1142          extern int _fdata[], _end[];
1143 #        define DATASTART ((ptr_t)_fdata)
1144 #        define DATAEND ((ptr_t)_end)
1145 #        define CPP_WORDSZ _MIPS_SZPTR
1146 #        define ALIGNMENT (_MIPS_SZPTR/8)
1147 #      else
1148          extern int etext, edata, end;
1149          extern int _DYNAMIC_LINKING, _gp;
1150 #        define DATASTART ((ptr_t)((((word)&etext + 0x3ffff) & ~0x3ffff) \
1151                + ((word)&etext & 0xffff)))
1152 #        define DATAEND (&edata)
1153 #        define DATASTART2 (&_DYNAMIC_LINKING \
1154                ? (ptr_t)(((word)&_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
1155                : (ptr_t)&edata)
1156 #        define DATAEND2 (&end)
1157 #        define ALIGNMENT 4
1158 #      endif
1159 #      define OS_TYPE "EWS4800"
1160 #      define USE_GENERIC_PUSH_REGS 1
1161 #   endif
1162 #   ifdef ULTRIX
1163 #       define HEURISTIC2
1164 #       define DATASTART (ptr_t)0x10000000
1165                               /* Could probably be slightly higher since */
1166                               /* startup code allocates lots of stuff.   */
1167 #       define OS_TYPE "ULTRIX"
1168 #       define ALIGNMENT 4
1169 #   endif
1170 #   ifdef RISCOS
1171 #       define HEURISTIC2
1172 #       define DATASTART (ptr_t)0x10000000
1173 #       define OS_TYPE "RISCOS"
1174 #       define ALIGNMENT 4  /* Required by hardware */
1175 #   endif
1176 #   ifdef IRIX5
1177 #       define HEURISTIC2
1178         extern int _fdata;
1179 #       define DATASTART ((ptr_t)(&_fdata))
1180 #       ifdef USE_MMAP
1181 #         define HEAP_START (ptr_t)0x30000000
1182 #       else
1183 #         define HEAP_START DATASTART
1184 #       endif
1185                               /* Lowest plausible heap address.         */
1186                               /* In the MMAP case, we map there.        */
1187                               /* In either case it is used to identify  */
1188                               /* heap sections so they're not           */
1189                               /* considered as roots.                   */
1190 #       define OS_TYPE "IRIX5"
1191 #       define MPROTECT_VDB
1192 #       ifdef _MIPS_SZPTR
1193 #         define CPP_WORDSZ _MIPS_SZPTR
1194 #         define ALIGNMENT (_MIPS_SZPTR/8)
1195 #         if CPP_WORDSZ != 64
1196 #           define ALIGN_DOUBLE
1197 #         endif
1198 #       else
1199 #         define ALIGNMENT 4
1200 #         define ALIGN_DOUBLE
1201 #       endif
1202 #       define DYNAMIC_LOADING
1203 #   endif
1204 #   ifdef MSWINCE
1205 #       define OS_TYPE "MSWINCE"
1206 #       define ALIGNMENT 4
1207 #       define DATAEND /* not needed */
1208 #   endif
1209 #   if defined(NETBSD)
1210       /* This also checked for __MIPSEL__ .  Why?  NETBSD recognition   */
1211       /* should be handled at the top of the file.                      */
1212 #     define ALIGNMENT 4
1213 #     define OS_TYPE "NETBSD"
1214 #     define HEURISTIC2
1215 #     define USE_GENERIC_PUSH_REGS
1216 #     ifdef __ELF__
1217         extern int etext;
1218 #       define DATASTART GC_data_start
1219 #       define NEED_FIND_LIMIT
1220 #       define DYNAMIC_LOADING
1221 #     else
1222 #       define DATASTART ((ptr_t) 0x10000000)
1223 #       define STACKBOTTOM ((ptr_t) 0x7ffff000)
1224 #     endif /* _ELF_ */
1225 #  endif
1226 # endif
1227
1228 # ifdef RS6000
1229 #   define MACH_TYPE "RS6000"
1230 #   ifdef __64BIT__
1231 #     define ALIGNMENT 8
1232 #     define CPP_WORDSZ 64
1233 #   else
1234 #     define ALIGNMENT 4
1235 #     define CPP_WORDSZ 32
1236 #   endif
1237     extern int _data, _end;
1238 #   define DATASTART ((ptr_t)((ulong)&_data))
1239 #   define DATAEND ((ptr_t)((ulong)&_end))
1240     extern int errno;
1241 #   define STACKBOTTOM ((ptr_t)((ulong)&errno))
1242 #   define USE_GENERIC_PUSH_REGS
1243 #   define DYNAMIC_LOADING
1244         /* For really old versions of AIX, this may have to be removed. */
1245 # endif
1246
1247 # ifdef HP_PA
1248 #   define MACH_TYPE "HP_PA"
1249 #   ifdef __LP64__
1250 #     define CPP_WORDSZ 64
1251 #     define ALIGNMENT 8
1252 #   else
1253 #     define CPP_WORDSZ 32
1254 #     define ALIGNMENT 4
1255 #     define ALIGN_DOUBLE
1256 #   endif
1257 #   if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
1258 #     ifndef LINUX /* For now. */
1259 #       define MPROTECT_VDB
1260 #     endif
1261 #   else
1262 #     define GENERIC_COMPARE_AND_SWAP
1263         /* No compare-and-swap instruction.  Use pthread mutexes        */
1264         /* when we absolutely have to.                                  */
1265 #     ifdef PARALLEL_MARK
1266 #       define USE_MARK_BYTES
1267                 /* Minimize compare-and-swap usage.             */
1268 #     endif
1269 #   endif
1270 #   define STACK_GROWS_UP
1271 #   ifdef HPUX
1272 #     define OS_TYPE "HPUX"
1273       extern int __data_start;
1274 #     define DATASTART ((ptr_t)(&__data_start))
1275 #     if 0
1276         /* The following appears to work for 7xx systems running HP/UX  */
1277         /* 9.xx Furthermore, it might result in much faster             */
1278         /* collections than HEURISTIC2, which may involve scanning      */
1279         /* segments that directly precede the stack.  It is not the     */
1280         /* default, since it may not work on older machine/OS           */
1281         /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1282         /* this.)                                                       */
1283 #       define STACKBOTTOM ((ptr_t) 0x7b033000)  /* from /etc/conf/h/param.h */
1284 #     else
1285         /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2       */
1286         /* to this.  Note that the GC must be initialized before the    */
1287         /* first putenv call.                                           */
1288         extern char ** environ;
1289 #       define STACKBOTTOM ((ptr_t)environ)
1290 #     endif
1291 #     define DYNAMIC_LOADING
1292 #     include <unistd.h>
1293 #     define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1294 #     ifndef __GNUC__
1295 #       define PREFETCH(x)  { \
1296                               register long addr = (long)(x); \
1297                               (void) _asm ("LDW", 0, 0, addr, 0); \
1298                             }
1299 #     endif
1300 #   endif /* HPUX */
1301 #   ifdef LINUX
1302 #     define OS_TYPE "LINUX"
1303 #     define LINUX_STACKBOTTOM
1304 #     define DYNAMIC_LOADING
1305 #     define LINUX_DATA_START
1306       extern int _end;
1307 #     define DATAEND (&_end)
1308 #   endif /* LINUX */
1309 # endif /* HP_PA */
1310
1311 # ifdef ALPHA
1312 #   define MACH_TYPE "ALPHA"
1313 #   define ALIGNMENT 8
1314 #   ifdef NETBSD
1315 #       define OS_TYPE "NETBSD"
1316 #       define HEURISTIC2
1317 #       define DATASTART GC_data_start
1318 #       define ELFCLASS32 32
1319 #       define ELFCLASS64 64
1320 #       define ELF_CLASS ELFCLASS64
1321 #       define CPP_WORDSZ 64
1322 #       define DYNAMIC_LOADING
1323 #   endif
1324 #   ifdef OPENBSD
1325 #       define OS_TYPE "OPENBSD"
1326 #       define HEURISTIC2
1327 #       define CPP_WORDSZ 64
1328 #       ifdef __ELF__   /* since OpenBSD/Alpha 2.9 */
1329 #          define DATASTART GC_data_start
1330 #          define ELFCLASS32 32
1331 #          define ELFCLASS64 64
1332 #          define ELF_CLASS ELFCLASS64
1333 #       else            /* ECOFF, until OpenBSD/Alpha 2.7 */
1334 #          define DATASTART ((ptr_t) 0x140000000)
1335 #       endif
1336 #   endif
1337 #   ifdef FREEBSD
1338 #       define OS_TYPE "FREEBSD"
1339 /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
1340 #       define SIG_SUSPEND SIGUSR1
1341 #       define SIG_THR_RESTART SIGUSR2
1342 #       define FREEBSD_STACKBOTTOM
1343 #       ifdef __ELF__
1344 #           define DYNAMIC_LOADING
1345 #       endif
1346 /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
1347         extern char etext;
1348         extern char edata;
1349         extern char end;
1350 #       define NEED_FIND_LIMIT
1351 #       define DATASTART ((ptr_t)(&etext))
1352 #       define DATAEND (GC_find_limit (DATASTART, TRUE))
1353 #       define DATASTART2 ((ptr_t)(&edata))
1354 #       define DATAEND2 ((ptr_t)(&end))
1355 #       define CPP_WORDSZ 64
1356 #   endif
1357 #   ifdef OSF1
1358 #       define OS_TYPE "OSF1"
1359 #       define DATASTART ((ptr_t) 0x140000000)
1360         extern int _end;
1361 #       define DATAEND ((ptr_t) &_end)
1362         extern char ** environ;
1363         /* round up from the value of environ to the nearest page boundary */
1364         /* Probably breaks if putenv is called before collector            */
1365         /* initialization.                                                 */
1366 #       define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
1367 /* #    define HEURISTIC2 */
1368         /* Normally HEURISTIC2 is too conervative, since                */
1369         /* the text segment immediately follows the stack.              */
1370         /* Hence we give an upper pound.                                */
1371         /* This is currently unused, since we disabled HEURISTIC2       */
1372         extern int __start;
1373 #       define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
1374 #       define CPP_WORDSZ 64
1375 #       define MPROTECT_VDB
1376 #       define DYNAMIC_LOADING
1377 #   endif
1378 #   ifdef LINUX
1379 #       define OS_TYPE "LINUX"
1380 #       define CPP_WORDSZ 64
1381 #       define STACKBOTTOM ((ptr_t) 0x120000000)
1382 #       ifdef __ELF__
1383 #         define SEARCH_FOR_DATA_START
1384 #         define DATASTART GC_data_start
1385 #         define DYNAMIC_LOADING
1386 #       else
1387 #           define DATASTART ((ptr_t) 0x140000000)
1388 #       endif
1389         extern int _end;
1390 #       define DATAEND (&_end)
1391 #       define MPROTECT_VDB
1392                 /* Has only been superficially tested.  May not */
1393                 /* work on all versions.                        */
1394 #   endif
1395 # endif
1396
1397 # ifdef IA64
1398 #   define MACH_TYPE "IA64"
1399 #   define USE_GENERIC_PUSH_REGS
1400         /* We need to get preserved registers in addition to register   */
1401         /* windows.   That's easiest to do with setjmp.                 */
1402 #   ifdef PARALLEL_MARK
1403 #       define USE_MARK_BYTES
1404             /* Compare-and-exchange is too expensive to use for         */
1405             /* setting mark bits.                                       */
1406 #   endif
1407 #   ifdef HPUX
1408 #       ifdef _ILP32
1409 #         define CPP_WORDSZ 32
1410 #         define ALIGN_DOUBLE
1411             /* Requires 8 byte alignment for malloc */
1412 #         define ALIGNMENT 4
1413 #       else
1414 #         ifndef _LP64
1415                 ---> unknown ABI
1416 #         endif
1417 #         define CPP_WORDSZ 64
1418 #         define ALIGN_DOUBLE
1419             /* Requires 16 byte alignment for malloc */
1420 #         define ALIGNMENT 8
1421 #       endif
1422 #       define OS_TYPE "HPUX"   
1423         extern int __data_start;
1424 #       define DATASTART ((ptr_t)(&__data_start))
1425         /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2       */
1426         /* to this.  Note that the GC must be initialized before the    */
1427         /* first putenv call.                                           */
1428         extern char ** environ;
1429 #       define STACKBOTTOM ((ptr_t)environ)
1430 #       define DYNAMIC_LOADING
1431 #       include <unistd.h>
1432 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1433         /* The following was empirically determined, and is probably    */
1434         /* not very robust.                                             */
1435         /* Note that the backing store base seems to be at a nice       */
1436         /* address minus one page.                                      */
1437 #       define BACKING_STORE_DISPLACEMENT 0x1000000
1438 #       define BACKING_STORE_ALIGNMENT 0x1000
1439 #       define BACKING_STORE_BASE \
1440           (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) \
1441                         & ~(BACKING_STORE_ALIGNMENT - 1))
1442 #   endif
1443 #   ifdef LINUX
1444 #       define CPP_WORDSZ 64
1445 #       define ALIGN_DOUBLE
1446           /* Requires 16 byte alignment for malloc */
1447 #       define ALIGNMENT 8
1448 #       define OS_TYPE "LINUX"
1449         /* The following works on NUE and older kernels:        */
1450 /* #       define STACKBOTTOM ((ptr_t) 0xa000000000000000l)     */
1451         /* This does not work on NUE:                           */
1452 #       define LINUX_STACKBOTTOM
1453         /* We also need the base address of the register stack  */
1454         /* backing store.  This is computed in                  */
1455         /* GC_linux_register_stack_base based on the following  */
1456         /* constants:                                           */
1457 #       define BACKING_STORE_ALIGNMENT 0x100000
1458 #       define BACKING_STORE_DISPLACEMENT 0x80000000
1459         extern char * GC_register_stackbottom;
1460 #       define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
1461 #       define SEARCH_FOR_DATA_START
1462 #       define DATASTART GC_data_start
1463 #       ifdef __GNUC__
1464 #         define DYNAMIC_LOADING
1465 #       else
1466           /* In the Intel compiler environment, we seem to end up with  */
1467           /* statically linked executables and an undefined reference   */
1468           /* to _DYNAMIC                                                */
1469 #       endif
1470 #       define MPROTECT_VDB
1471                 /* Requires Linux 2.3.47 or later.      */
1472         extern int _end;
1473 #       define DATAEND (&_end)
1474 #       ifdef __GNUC__
1475 #         define PREFETCH(x) \
1476             __asm__ ("  lfetch  [%0]": : "r"((void *)(x)))
1477 #         define PREFETCH_FOR_WRITE(x) \
1478             __asm__ ("  lfetch.excl     [%0]": : "r"((void *)(x)))
1479 #         define CLEAR_DOUBLE(x) \
1480             __asm__ ("  stf.spill       [%0]=f0": : "r"((void *)(x)))
1481 #       endif
1482 #   endif
1483 # endif
1484
1485 # ifdef M88K
1486 #   define MACH_TYPE "M88K"
1487 #   define ALIGNMENT 4
1488 #   define ALIGN_DOUBLE
1489     extern int etext;
1490 #   ifdef CX_UX
1491 #       define OS_TYPE "CX_UX"
1492 #       define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1493 #   endif
1494 #   ifdef  DGUX
1495 #       define OS_TYPE "DGUX"
1496         extern char * GC_SysVGetDataStart();
1497 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1498 #   endif
1499 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1500 # endif
1501
1502 # ifdef S370
1503 #   define MACH_TYPE "S370"
1504 #   define ALIGNMENT 4  /* Required by hardware */
1505 #   define USE_GENERIC_PUSH_REGS
1506 #   ifdef UTS4
1507 #       define OS_TYPE "UTS4"
1508         extern int etext;
1509         extern int _etext;
1510         extern int _end;
1511         extern char * GC_SysVGetDataStart();
1512 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1513 #       define DATAEND (&_end)
1514 #       define HEURISTIC2
1515 #   endif
1516 #   ifdef LINUX
1517 #       define OS_TYPE "LINUX"
1518 #       define HEURISTIC1
1519 #       define DYNAMIC_LOADING
1520         extern int __data_start;
1521 #       define DATASTART ((ptr_t)(&__data_start))
1522 #   endif
1523 # endif
1524
1525 # if defined(PJ)
1526 #   define ALIGNMENT 4
1527     extern int _etext;
1528 #   define DATASTART ((ptr_t)(&_etext))
1529 #   define HEURISTIC1
1530 # endif
1531
1532 # ifdef ARM32
1533 #   define CPP_WORDSZ 32
1534 #   define MACH_TYPE "ARM32"
1535 #   define ALIGNMENT 4
1536 #   ifdef NETBSD
1537 #       define OS_TYPE "NETBSD"
1538 #       define HEURISTIC2
1539         extern char etext;
1540 #       define DATASTART ((ptr_t)(&etext))
1541 #       define USE_GENERIC_PUSH_REGS
1542 #   endif
1543 #   ifdef LINUX
1544 #       define OS_TYPE "LINUX"
1545 #       define HEURISTIC1
1546 #       undef STACK_GRAN
1547 #       define STACK_GRAN 0x10000000
1548 #       define USE_GENERIC_PUSH_REGS
1549 #       ifdef __ELF__
1550 #            define DYNAMIC_LOADING
1551 #            include <features.h>
1552 #            if defined(__GLIBC__) && __GLIBC__ >= 2
1553 #                define LINUX_DATA_START
1554 #            else
1555                  extern char **__environ;
1556 #                define DATASTART ((ptr_t)(&__environ))
1557                               /* hideous kludge: __environ is the first */
1558                               /* word in crt0.o, and delimits the start */
1559                               /* of the data segment, no matter which   */
1560                               /* ld options were passed through.        */
1561                               /* We could use _etext instead, but that  */
1562                               /* would include .rodata, which may       */
1563                               /* contain large read-only data tables    */
1564                               /* that we'd rather not scan.             */
1565 #            endif
1566              extern int _end;
1567 #            define DATAEND (&_end)
1568 #       else
1569              extern int etext;
1570 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
1571 #       endif
1572 #   endif
1573 #   ifdef MSWINCE
1574 #     define OS_TYPE "MSWINCE"
1575 #     define DATAEND /* not needed */
1576 #   endif
1577 #   ifdef NOSYS
1578       /* __data_start is usually defined in the target linker script.  */
1579       extern int __data_start;
1580 #     define DATASTART (ptr_t)(&__data_start)
1581 #     define USE_GENERIC_PUSH_REGS
1582       /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S  */
1583       extern void *__stack_base__;
1584 #     define STACKBOTTOM ((ptr_t) (__stack_base__))
1585 #   endif
1586 #endif
1587
1588 # ifdef SH
1589 #   define MACH_TYPE "SH"
1590 #   define ALIGNMENT 4
1591 #   ifdef MSWINCE
1592 #     define OS_TYPE "MSWINCE"
1593 #     define DATAEND /* not needed */
1594 #   endif
1595 #   ifdef LINUX
1596 #     define OS_TYPE "LINUX"
1597 #     define STACKBOTTOM ((ptr_t) 0x7c000000)
1598 #     define USE_GENERIC_PUSH_REGS
1599 #     define DYNAMIC_LOADING
1600 #     define LINUX_DATA_START
1601       extern int _end;
1602 #     define DATAEND (&_end)
1603 #   endif
1604 # endif
1605  
1606 # ifdef SH4
1607 #   define MACH_TYPE "SH4"
1608 #   define OS_TYPE "MSWINCE"
1609 #   define ALIGNMENT 4
1610 #   define DATAEND /* not needed */
1611 # endif
1612
1613 #ifdef LINUX_DATA_START
1614     /* Some Linux distributions arrange to define __data_start.  Some   */
1615     /* define data_start as a weak symbol.  The latter is technically   */
1616     /* broken, since the user program may define data_start, in which   */
1617     /* case we lose.  Nonetheless, we try both, prefering __data_start. */
1618     /* We assume gcc.   */
1619 #   pragma weak __data_start
1620     extern int __data_start;
1621 #   pragma weak data_start
1622     extern int data_start;
1623 #   define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
1624 #endif
1625
1626 #if defined(LINUX) && defined(REDIRECT_MALLOC)
1627     /* Rld appears to allocate some memory with its own allocator, and  */
1628     /* some through malloc, which might be redirected.  To make this    */
1629     /* work with collectable memory, we have to scan memory allocated   */
1630     /* by rld's internal malloc.                                        */
1631 #   define USE_PROC_FOR_LIBRARIES
1632 #endif
1633     
1634 # ifndef STACK_GROWS_UP
1635 #   define STACK_GROWS_DOWN
1636 # endif
1637
1638 # ifndef CPP_WORDSZ
1639 #   define CPP_WORDSZ 32
1640 # endif
1641
1642 # ifndef OS_TYPE
1643 #   define OS_TYPE ""
1644 # endif
1645
1646 # ifndef DATAEND
1647     extern int end;
1648 #   define DATAEND (&end)
1649 # endif
1650
1651 # if defined(SVR4) && !defined(GETPAGESIZE)
1652 #    include <unistd.h>
1653 #    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
1654 # endif
1655
1656 # ifndef GETPAGESIZE
1657 #   if defined(SUNOS5) || defined(IRIX5)
1658 #       include <unistd.h>
1659 #   endif
1660 #   define GETPAGESIZE() getpagesize()
1661 # endif
1662
1663 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1664     /* OS has SVR4 generic features.  Probably others also qualify.     */
1665 #   define SVR4
1666 # endif
1667
1668 # if defined(SUNOS5) || defined(DRSNX)
1669     /* OS has SUNOS5 style semi-undocumented interface to dynamic       */
1670     /* loader.                                                          */
1671 #   define SUNOS5DL
1672     /* OS has SUNOS5 style signal handlers.                             */
1673 #   define SUNOS5SIGS
1674 # endif
1675
1676 # if defined(HPUX)
1677 #   define SUNOS5SIGS
1678 # endif
1679
1680 # if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \
1681     || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
1682     || defined(BSD) || defined(_AIX) || defined(MACOSX) || defined(OSF1)
1683 #   define UNIX_LIKE   /* Basic Unix-like system calls work.    */
1684 # endif
1685
1686 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1687    -> bad word size
1688 # endif
1689
1690 # ifdef PCR
1691 #   undef DYNAMIC_LOADING
1692 #   undef STACKBOTTOM
1693 #   undef HEURISTIC1
1694 #   undef HEURISTIC2
1695 #   undef PROC_VDB
1696 #   undef MPROTECT_VDB
1697 #   define PCR_VDB
1698 # endif
1699
1700 # ifdef SRC_M3
1701 /* Postponed for now. */
1702 #   undef PROC_VDB
1703 #   undef MPROTECT_VDB
1704 # endif
1705
1706 # ifdef SMALL_CONFIG
1707 /* Presumably not worth the space it takes. */
1708 #   undef PROC_VDB
1709 #   undef MPROTECT_VDB
1710 # endif
1711
1712 # ifdef USE_MUNMAP
1713 #   undef MPROTECT_VDB  /* Can't deal with address space holes. */
1714 # endif
1715
1716 # ifdef PARALLEL_MARK
1717 #   undef MPROTECT_VDB  /* For now.     */
1718 # endif
1719
1720 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1721 #   define DEFAULT_VDB
1722 # endif
1723
1724 # ifndef PREFETCH
1725 #   define PREFETCH(x)
1726 #   define NO_PREFETCH
1727 # endif
1728
1729 # ifndef PREFETCH_FOR_WRITE
1730 #   define PREFETCH_FOR_WRITE(x)
1731 #   define NO_PREFETCH_FOR_WRITE
1732 # endif
1733
1734 # ifndef CACHE_LINE_SIZE
1735 #   define CACHE_LINE_SIZE 32   /* Wild guess   */
1736 # endif
1737
1738 # ifndef CLEAR_DOUBLE
1739 #   define CLEAR_DOUBLE(x) \
1740         ((word*)x)[0] = 0; \
1741         ((word*)x)[1] = 0;
1742 # endif /* CLEAR_DOUBLE */
1743
1744 /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
1745 # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
1746 #   define GC_SOLARIS_THREADS
1747 # endif
1748
1749 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
1750 --> inconsistent configuration
1751 # endif
1752 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
1753 --> inconsistent configuration
1754 # endif
1755 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
1756 --> inconsistent configuration
1757 # endif
1758 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
1759 --> inconsistent configuration
1760 # endif
1761 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32)
1762     /* Ideally CYGWIN32 should work, in addition to MSWIN32.  I suspect */
1763     /* the necessary code is mostly there, but nobody has actually made */
1764     /* sure the right combination of pieces is compiled in, etc.        */
1765 --> inconsistent configuration
1766 # endif
1767
1768 # if defined(PCR) || defined(SRC_M3) || \
1769         defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
1770         defined(GC_PTHREADS)
1771 #   define THREADS
1772 # endif
1773
1774 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \
1775      || defined(LINT) || defined(MSWINCE) \
1776      || (defined(I386) && defined(__LCC__))
1777         /* Use setjmp based hack to mark from callee-save registers.    */
1778         /* The define should move to the individual platform            */
1779         /* descriptions.                                                */
1780 #       define USE_GENERIC_PUSH_REGS
1781 # endif
1782
1783 # if defined(SPARC)
1784 #   define ASM_CLEAR_CODE       /* Stack clearing is crucial, and we    */
1785                                 /* include assembly code to do it well. */
1786 # endif
1787
1788 /* Can we save call chain in objects for debugging?                     */
1789 /* SET NFRAMES (# of saved frames) and NARGS (#of args for each frame)  */
1790 /* to reasonable values for the platform.                               */
1791 /* Set SAVE_CALL_CHAIN if we can.  SAVE_CALL_COUNT can be specified at  */
1792 /* build time, though we feel free to adjust it slightly.               */
1793 /* Define NEED_CALLINFO if we either save the call stack or             */
1794 /* GC_ADD_CALLER is defined.                                            */
1795 #ifdef LINUX
1796 # include <features.h>
1797 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2
1798 #   define HAVE_BUILTIN_BACKTRACE
1799 # endif
1800 #endif
1801
1802 #if defined(SPARC)
1803 # define CAN_SAVE_CALL_STACKS
1804 # define CAN_SAVE_CALL_ARGS
1805 #endif
1806 #if defined(I386) && defined(LINUX)
1807     /* SAVE_CALL_CHAIN is supported if the code is compiled to save     */
1808     /* frame pointers by default, i.e. no -fomit-frame-pointer flag.    */
1809 # define CAN_SAVE_CALL_STACKS
1810 # define CAN_SAVE_CALL_ARGS
1811 #endif
1812 #if defined(HAVE_BUILTIN_BACKTRACE) && !defined(CAN_SAVE_CALL_STACKS)
1813 # define CAN_SAVE_CALL_STACKS
1814 #endif
1815
1816 # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
1817      && defined(CAN_SAVE_CALL_STACKS)
1818 #   define SAVE_CALL_CHAIN 
1819 # endif
1820 # ifdef SAVE_CALL_CHAIN
1821 #   if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
1822 #     define NARGS SAVE_CALL_NARGS
1823 #   else
1824 #     define NARGS 0    /* Number of arguments to save for each call.   */
1825 #   endif
1826 # endif
1827 # ifdef SAVE_CALL_CHAIN
1828 #   ifndef SAVE_CALL_COUNT
1829 #     define NFRAMES 6  /* Number of frames to save. Even for           */
1830                         /* alignment reasons.                           */
1831 #   else
1832 #     define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
1833 #   endif
1834 #   define NEED_CALLINFO
1835 # endif /* SAVE_CALL_CHAIN */
1836 # ifdef GC_ADD_CALLER
1837 #   define NFRAMES 1
1838 #   define NARGS 0
1839 #   define NEED_CALLINFO
1840 # endif
1841
1842 # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
1843 #   define DBG_HDRS_ALL
1844 # endif
1845
1846 # endif /* GCCONFIG_H */