OSDN Git Service

2001-04-10 Loren J. Rittle <ljrittle@acm.org>
[pf3gnuchains/gcc-fork.git] / boehm-gc / gcconfig.h
1 /* 
2  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3  * Copyright (c) 1991-1994, 2001 by Xerox Corporation.  All rights reserved.
4  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
5  *
6  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
7  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
8  *
9  * Permission is hereby granted to use or copy this program
10  * for any purpose,  provided the above notices are retained on all copies.
11  * Permission to modify the code and to distribute modified code is granted,
12  * provided the above notices are retained, and a notice that the code was
13  * modified is included with the above copyright notice.
14  */
15  
16 #ifndef GCCONFIG_H
17
18 # define GCCONFIG_H
19
20 /* Machine dependent parameters.  Some tuning parameters can be found   */
21 /* near the top of gc_private.h.                                        */
22
23 /* Machine specific parts contributed by various people.  See README file. */
24
25 /* First a unified test for Linux: */
26 # if defined(linux) || defined(__linux__)
27 #    define LINUX
28 # endif
29
30 /* Determine the machine type: */
31 # if defined(sun) && defined(mc68000)
32 #    define M68K
33 #    define SUNOS4
34 #    define mach_type_known
35 # endif
36 # if defined(hp9000s300)
37 #    define M68K
38 #    define HP
39 #    define mach_type_known
40 # endif
41 # if defined(__OpenBSD__) && defined(m68k)
42 #    define M68K
43 #    define OPENBSD
44 #    define mach_type_known
45 # endif
46 # if defined(__OpenBSD__) && defined(__sparc__)
47 #    define SPARC
48 #    define OPENBSD
49 #    define mach_type_known
50 # endif
51 # if defined(__NetBSD__) && defined(m68k)
52 #    define M68K
53 #    define NETBSD
54 #    define mach_type_known
55 # endif
56 # if defined(__NetBSD__) && defined(arm32)
57 #    define ARM32
58 #    define NETBSD
59 #    define mach_type_known
60 # endif
61 # if defined(vax)
62 #    define VAX
63 #    ifdef ultrix
64 #       define ULTRIX
65 #    else
66 #       define BSD
67 #    endif
68 #    define mach_type_known
69 # endif
70 # if defined(mips) || defined(__mips)
71 #    define MIPS
72 #    if !defined(LINUX)
73 #      if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
74 #        define ULTRIX
75 #      else
76 #        if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
77             || defined(__SYSTYPE_SVR4__)
78 #          define IRIX5   /* or IRIX 6.X */
79 #        else
80 #          define RISCOS  /* or IRIX 4.X */
81 #        endif
82 #      endif
83 #    endif /* !LINUX */
84 #    define mach_type_known
85 # endif
86 # if defined(sequent) && defined(i386)
87 #    define I386
88 #    define SEQUENT
89 #    define mach_type_known
90 # endif
91 # if defined(sun) && defined(i386)
92 #    define I386
93 #    define SUNOS5
94 #    define mach_type_known
95 # endif
96 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
97 #    define I386
98 #    define OS2
99 #    define mach_type_known
100 # endif
101 # if defined(ibm032)
102 #   define RT
103 #   define mach_type_known
104 # endif
105 # if defined(sun) && (defined(sparc) || defined(__sparc))
106 #   define SPARC
107     /* Test for SunOS 5.x */
108 #     include <errno.h>
109 #     ifdef ECHRNG
110 #       define SUNOS5
111 #     else
112 #       define SUNOS4
113 #     endif
114 #   define mach_type_known
115 # endif
116 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
117      && !defined(__OpenBSD__)
118 #   define SPARC
119 #   define DRSNX
120 #   define mach_type_known
121 # endif
122 # if defined(_IBMR2)
123 #   define RS6000
124 #   define mach_type_known
125 # endif
126 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
127         /* The above test may need refinement   */
128 #   define I386
129 #   if defined(_SCO_ELF)
130 #     define SCO_ELF
131 #   else
132 #     define SCO
133 #   endif
134 #   define mach_type_known
135 # endif
136 # if defined(_AUX_SOURCE)
137 #   define M68K
138 #   define SYSV
139 #   define mach_type_known
140 # endif
141 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
142      || defined(hppa) || defined(__hppa__)
143 #   define HP_PA
144 #   ifndef LINUX
145 #     define HPUX
146 #   endif
147 #   define mach_type_known
148 # endif
149 # if defined(LINUX) && (defined(i386) || defined(__i386__))
150 #    define I386
151 #    define mach_type_known
152 # endif
153 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
154 #    define IA64
155 #    define mach_type_known
156 # endif
157 # if defined(LINUX) && defined(powerpc)
158 #    define POWERPC
159 #    define mach_type_known
160 # endif
161 # if defined(LINUX) && defined(__mc68000__)
162 #    define M68K
163 #    define mach_type_known
164 # endif
165 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
166 #    define SPARC
167 #    define mach_type_known
168 # endif
169 # if defined(LINUX) && defined(__arm__)
170 #    define ARM32
171 #    define mach_type_known
172 # endif
173 # if defined(__alpha) || defined(__alpha__)
174 #   define ALPHA
175 #   if !defined(LINUX)
176 #     define OSF1       /* a.k.a Digital Unix */
177 #   endif
178 #   define mach_type_known
179 # endif
180 # if defined(_AMIGA) && !defined(AMIGA)
181 #   define AMIGA
182 # endif
183 # ifdef AMIGA 
184 #   define M68K
185 #   define mach_type_known
186 # endif
187 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
188 #   define M68K
189 #   define MACOS
190 #   define mach_type_known
191 # endif
192 # if defined(__MWERKS__) && defined(__powerc)
193 #   define POWERPC
194 #   define MACOS
195 #   define mach_type_known
196 # endif
197 # if defined(macosx)
198 #    define MACOSX
199 #    define POWERPC
200 #    define mach_type_known
201 # endif
202 # if defined(NeXT) && defined(mc68000)
203 #   define M68K
204 #   define NEXT
205 #   define mach_type_known
206 # endif
207 # if defined(NeXT) && defined(i386)
208 #   define I386
209 #   define NEXT
210 #   define mach_type_known
211 # endif
212 # if defined(__OpenBSD__) && defined(i386)
213 #   define I386
214 #   define OPENBSD
215 #   define mach_type_known
216 # endif
217 # if defined(__FreeBSD__) && defined(i386)
218 #   define I386
219 #   define FREEBSD
220 #   define mach_type_known
221 # endif
222 # if defined(__NetBSD__) && defined(i386)
223 #   define I386
224 #   define NETBSD
225 #   define mach_type_known
226 # endif
227 # if defined(bsdi) && defined(i386)
228 #    define I386
229 #    define BSDI
230 #    define mach_type_known
231 # endif
232 # if !defined(mach_type_known) && defined(__386BSD__)
233 #   define I386
234 #   define THREE86BSD
235 #   define mach_type_known
236 # endif
237 # if defined(_CX_UX) && defined(_M88K)
238 #   define M88K
239 #   define CX_UX
240 #   define mach_type_known
241 # endif
242 # if defined(DGUX)
243 #   define M88K
244     /* DGUX defined */
245 #   define mach_type_known
246 # endif
247 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
248      || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
249 #   define I386
250 #   define MSWIN32      /* or Win32s */
251 #   define mach_type_known
252 # endif
253 # if defined(__DJGPP__)
254 #   define I386
255 #   ifndef DJGPP
256 #     define DJGPP  /* MSDOS running the DJGPP port of GCC */
257 #   endif
258 #   define mach_type_known
259 # endif
260 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
261 #   define I386
262 #   define CYGWIN32
263 #   define mach_type_known
264 # endif
265 # if defined(__MINGW32__)
266 #   define I386
267 #   define MSWIN32
268 #   define mach_type_known
269 # endif
270 # if defined(__BORLANDC__)
271 #   define I386
272 #   define MSWIN32
273 #   define mach_type_known
274 # endif
275 # if defined(_UTS) && !defined(mach_type_known)
276 #   define S370
277 #   define UTS4
278 #   define mach_type_known
279 # endif
280 # if defined(__pj__)
281 #   define PJ
282 #   define mach_type_known
283 # endif
284 /* Ivan Demakov */
285 # if defined(__WATCOMC__) && defined(__386__)
286 #   define I386
287 #   if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
288 #     if defined(__OS2__)
289 #       define OS2
290 #     else
291 #       if defined(__WINDOWS_386__) || defined(__NT__)
292 #         define MSWIN32
293 #       else
294 #         define DOS4GW
295 #       endif
296 #     endif
297 #   endif
298 #   define mach_type_known
299 # endif
300 # if defined(__embedded__) && defined(PPC)
301 #    define POWERPC
302 #    define mach_type_known
303 # endif
304
305 /* Feel free to add more clauses here */
306
307 /* Or manually define the machine type here.  A machine type is         */
308 /* characterized by the architecture.  Some                             */
309 /* machine types are further subdivided by OS.                          */
310 /* the macros ULTRIX, RISCOS, and BSD to distinguish.                   */
311 /* Note that SGI IRIX is treated identically to RISCOS.                 */
312 /* SYSV on an M68K actually means A/UX.                                 */
313 /* The distinction in these cases is usually the stack starting address */
314 # ifndef mach_type_known
315         --> unknown machine type
316 # endif
317                     /* Mapping is: M68K       ==> Motorola 680X0        */
318                     /*             (SUNOS4,HP,NEXT, and SYSV (A/UX),    */
319                     /*             MACOS and AMIGA variants)            */
320                     /*             I386       ==> Intel 386             */
321                     /*              (SEQUENT, OS2, SCO, LINUX, NETBSD,  */
322                     /*               FREEBSD, THREE86BSD, MSWIN32,      */
323                     /*               BSDI,SUNOS5, NEXT, other variants) */
324                     /*             NS32K      ==> Encore Multimax       */
325                     /*             MIPS       ==> R2000 or R3000        */
326                     /*                  (RISCOS, ULTRIX variants)       */
327                     /*             VAX        ==> DEC VAX               */
328                     /*                  (BSD, ULTRIX variants)          */
329                     /*             RS6000     ==> IBM RS/6000 AIX3.X    */
330                     /*             RT         ==> IBM PC/RT             */
331                     /*             HP_PA      ==> HP9000/700 & /800     */
332                     /*                            HP/UX                 */
333                     /*             SPARC      ==> SPARC v7/v8/v9        */
334                     /*                  (SUNOS4, SUNOS5, LINUX,         */
335                     /*                   DRSNX variants)                */
336                     /*             ALPHA      ==> DEC Alpha             */
337                     /*                  (OSF1 and LINUX variants)       */
338                     /*             M88K       ==> Motorola 88XX0        */
339                     /*                  (CX_UX and DGUX)                */
340                     /*             S370       ==> 370-like machine      */
341                     /*                  running Amdahl UTS4             */
342                     /*             ARM32      ==> Intel StrongARM       */
343                     /*             IA64       ==> Intel IA64            */
344                     /*                            (e.g. Itanium)        */
345
346
347 /*
348  * For each architecture and OS, the following need to be defined:
349  *
350  * CPP_WORD_SZ is a simple integer constant representing the word size.
351  * in bits.  We assume byte addressibility, where a byte has 8 bits.
352  * We also assume CPP_WORD_SZ is either 32 or 64.
353  * (We care about the length of pointers, not hardware
354  * bus widths.  Thus a 64 bit processor with a C compiler that uses
355  * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
356  *
357  * MACH_TYPE is a string representation of the machine type.
358  * OS_TYPE is analogous for the OS.
359  *
360  * ALIGNMENT is the largest N, such that
361  * all pointer are guaranteed to be aligned on N byte boundaries.
362  * defining it to be 1 will always work, but perform poorly.
363  *
364  * DATASTART is the beginning of the data segment.
365  * On UNIX systems, the collector will scan the area between DATASTART
366  * and DATAEND for root pointers.
367  *
368  * DATAEND, if not &end.
369  *
370  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
371  * the pointer size.
372  *
373  * STACKBOTTOM is the cool end of the stack, which is usually the
374  * highest address in the stack.
375  * Under PCR or OS/2, we have other ways of finding thread stacks.
376  * For each machine, the following should:
377  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
378  * 2) define exactly one of
379  *      STACKBOTTOM (should be defined to be an expression)
380  *      HEURISTIC1
381  *      HEURISTIC2
382  * If either of the last two macros are defined, then STACKBOTTOM is computed
383  * during collector startup using one of the following two heuristics:
384  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
385  *              the next multiple of STACK_GRAN.
386  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
387  *              in small steps (decrement if STACK_GROWS_UP), and read the value
388  *              at each location.  Remember the value when the first
389  *              Segmentation violation or Bus error is signalled.  Round that
390  *              to the nearest plausible page boundary, and use that instead
391  *              of STACKBOTTOM.
392  *
393  * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
394  * the value of environ is a pointer that can serve as STACKBOTTOM.
395  * I expect that HEURISTIC2 can be replaced by this approach, which
396  * interferes far less with debugging. 
397  *
398  * If no expression for STACKBOTTOM can be found, and neither of the above
399  * heuristics are usable, the collector can still be used with all of the above
400  * undefined, provided one of the following is done:
401  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
402  *    without reference to STACKBOTTOM.  This is appropriate for use in
403  *    conjunction with thread packages, since there will be multiple stacks.
404  *    (Allocating thread stacks in the heap, and treating them as ordinary
405  *    heap data objects is also possible as a last resort.  However, this is
406  *    likely to introduce significant amounts of excess storage retention
407  *    unless the dead parts of the thread stacks are periodically cleared.)
408  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
409  *    If the author of the client code controls the main program, this is
410  *    easily accomplished by introducing a new main program, setting
411  *    GC_stackbottom to the address of a local variable, and then calling
412  *    the original main program.  The new main program would read something
413  *    like:
414  *
415  *              # include "gc_private.h"
416  *
417  *              main(argc, argv, envp)
418  *              int argc;
419  *              char **argv, **envp;
420  *              {
421  *                  int dummy;
422  *
423  *                  GC_stackbottom = (ptr_t)(&dummy);
424  *                  return(real_main(argc, argv, envp));
425  *              }
426  *
427  *
428  * Each architecture may also define the style of virtual dirty bit
429  * implementation to be used:
430  *   MPROTECT_VDB: Write protect the heap and catch faults.
431  *   PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
432  *
433  * An architecture may define DYNAMIC_LOADING if dynamic_load.c
434  * defined GC_register_dynamic_libraries() for the architecture.
435  *
436  * An architecture may define PREFETCH(x) to preload the cache with *x.
437  * This defaults to a no-op.
438  *
439  * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
440  *
441  * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
442  * clear the two words at GC_malloc-aligned address x.  By default,
443  * word stores of 0 are used instead.
444  */
445
446
447 # define STACK_GRAN 0x1000000
448 # ifdef M68K
449 #   define MACH_TYPE "M68K"
450 #   define ALIGNMENT 2
451 #   ifdef OPENBSD
452 #       define OS_TYPE "OPENBSD"
453 #       define HEURISTIC2
454         extern char etext;
455 #       define DATASTART ((ptr_t)(&etext))
456 #   endif
457 #   ifdef NETBSD
458 #       define OS_TYPE "NETBSD"
459 #       define HEURISTIC2
460         extern char etext;
461 #       define DATASTART ((ptr_t)(&etext))
462 #   endif
463 #   ifdef LINUX
464 #       define OS_TYPE "LINUX"
465 #       define STACKBOTTOM ((ptr_t)0xf0000000)
466 #       define MPROTECT_VDB
467 #       ifdef __ELF__
468 #            define DYNAMIC_LOADING
469              extern char **__environ;
470 #            define DATASTART ((ptr_t)(&__environ))
471                              /* hideous kludge: __environ is the first */
472                              /* word in crt0.o, and delimits the start */
473                              /* of the data segment, no matter which   */
474                              /* ld options were passed through.        */
475                              /* We could use _etext instead, but that  */
476                              /* would include .rodata, which may       */
477                              /* contain large read-only data tables    */
478                              /* that we'd rather not scan.             */
479              extern int _end;
480 #            define DATAEND (&_end)
481 #       else
482              extern int etext;
483 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
484 #       endif
485 #   endif
486 #   ifdef SUNOS4
487 #       define OS_TYPE "SUNOS4"
488         extern char etext;
489 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
490 #       define HEURISTIC1       /* differs      */
491 #       define DYNAMIC_LOADING
492 #   endif
493 #   ifdef HP
494 #       define OS_TYPE "HP"
495         extern char etext;
496 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
497 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
498                               /* empirically determined.  seems to work. */
499 #       include <unistd.h>
500 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
501 #   endif
502 #   ifdef SYSV
503 #       define OS_TYPE "SYSV"
504         extern etext;
505 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
506                                    & ~0x3fffff) \
507                                   +((word)&etext & 0x1fff))
508         /* This only works for shared-text binaries with magic number 0413.
509            The other sorts of SysV binaries put the data at the end of the text,
510            in which case the default of &etext would work.  Unfortunately,
511            handling both would require having the magic-number available.
512                                 -- Parag
513            */
514 #       define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
515                         /* The stack starts at the top of memory, but   */
516                         /* 0x0 cannot be used as setjump_test complains */
517                         /* that the stack direction is incorrect.  Two  */
518                         /* bytes down from 0x0 should be safe enough.   */
519                         /*              --Parag                         */
520 #       include <sys/mmu.h>
521 #       define GETPAGESIZE() PAGESIZE   /* Is this still right? */
522 #   endif
523 #   ifdef AMIGA
524 #       define OS_TYPE "AMIGA"
525                 /* STACKBOTTOM and DATASTART handled specially  */
526                 /* in os_dep.c                                  */
527 #       define DATAEND  /* not needed */
528 #       define GETPAGESIZE() 4096
529 #   endif
530 #   ifdef MACOS
531 #     ifndef __LOWMEM__
532 #     include <LowMem.h>
533 #     endif
534 #     define OS_TYPE "MACOS"
535                         /* see os_dep.c for details of global data segments. */
536 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
537 #     define DATAEND    /* not needed */
538 #     define GETPAGESIZE() 4096
539 #   endif
540 #   ifdef NEXT
541 #       define OS_TYPE "NEXT"
542 #       define DATASTART ((ptr_t) get_etext())
543 #       define STACKBOTTOM ((ptr_t) 0x4000000)
544 #       define DATAEND  /* not needed */
545 #   endif
546 # endif
547
548 # ifdef POWERPC
549 #   define MACH_TYPE "POWERPC"
550 #   ifdef MACOS
551 #     define ALIGNMENT 2  /* Still necessary?  Could it be 4?   */
552 #     ifndef __LOWMEM__
553 #     include <LowMem.h>
554 #     endif
555 #     define OS_TYPE "MACOS"
556                         /* see os_dep.c for details of global data segments. */
557 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
558 #     define DATAEND  /* not needed */
559 #   endif
560 #   ifdef LINUX
561 #     define ALIGNMENT 4        /* Guess.  Can someone verify?  */
562                                 /* This was 2, but that didn't sound right. */
563 #     define OS_TYPE "LINUX"
564 #     define HEURISTIC1
565 #     define DYNAMIC_LOADING
566 #     undef STACK_GRAN
567 #     define STACK_GRAN 0x10000000
568         /* Stack usually starts at 0x80000000 */
569 #     define LINUX_DATA_START
570       extern int _end;
571 #     define DATAEND (&_end)
572 #   endif
573 #   ifdef MACOSX
574 #     define ALIGNMENT 4
575 #     define OS_TYPE "MACOSX"
576 #     define DATASTART ((ptr_t) get_etext())
577 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
578 #     define DATAEND    /* not needed */
579 #   endif
580 #   ifdef __embedded__
581 #     define ALIGNMENT 4
582 #     define OS_TYPE "EMBEDDED"
583       extern void __end, __dso_handle;
584 #     define DATASTART (&__dso_handle)  /* OK, that's ugly.  */
585 #     define DATAEND (&__end)
586         /* Stack starts at 0xE0000000 for the simulator.  */
587 #     undef STACK_GRAN
588 #     define STACK_GRAN 0x10000000
589 #     define HEURISTIC1
590 #   endif
591 # endif
592
593 # ifdef VAX
594 #   define MACH_TYPE "VAX"
595 #   define ALIGNMENT 4  /* Pointers are longword aligned by 4.2 C compiler */
596     extern char etext;
597 #   define DATASTART ((ptr_t)(&etext))
598 #   ifdef BSD
599 #       define OS_TYPE "BSD"
600 #       define HEURISTIC1
601                         /* HEURISTIC2 may be OK, but it's hard to test. */
602 #   endif
603 #   ifdef ULTRIX
604 #       define OS_TYPE "ULTRIX"
605 #       define STACKBOTTOM ((ptr_t) 0x7fffc800)
606 #   endif
607 # endif
608
609 # ifdef RT
610 #   define MACH_TYPE "RT"
611 #   define ALIGNMENT 4
612 #   define DATASTART ((ptr_t) 0x10000000)
613 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
614 # endif
615
616 # ifdef SPARC
617 #   define MACH_TYPE "SPARC"
618 #   if defined(__arch64__) || defined(__sparcv9)
619 #     define ALIGNMENT 8
620 #   else
621 #     define ALIGNMENT 4        /* Required by hardware */
622 #   endif
623 #   define ALIGN_DOUBLE
624     extern int etext;
625 #   ifdef SUNOS5
626 #       define OS_TYPE "SUNOS5"
627         extern int _etext;
628         extern int _end;
629         extern char * GC_SysVGetDataStart();
630 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
631 #       define DATAEND (&_end)
632 #       ifndef USE_MMAP
633 #           define USE_MMAP
634 #       endif
635 #       ifdef USE_MMAP
636 #         define HEAP_START (ptr_t)0x40000000
637 #       else
638 #         define HEAP_START DATAEND
639 #       endif
640 #       define PROC_VDB
641 /*      HEURISTIC1 reportedly no longer works under 2.7.  Thus we       */
642 /*      switched to HEURISTIC2, eventhough it creates some debugging    */
643 /*      issues.                                                         */
644 #       define HEURISTIC2
645 #       include <unistd.h>
646 #       define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
647                 /* getpagesize() appeared to be missing from at least one */
648                 /* Solaris 5.4 installation.  Weird.                      */
649 #       define DYNAMIC_LOADING
650 #   endif
651 #   ifdef SUNOS4
652 #       define OS_TYPE "SUNOS4"
653         /* [If you have a weak stomach, don't read this.]               */
654         /* We would like to use:                                        */
655 /* #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
656         /* This fails occasionally, due to an ancient, but very         */
657         /* persistent ld bug.  &etext is set 32 bytes too high.         */
658         /* We instead read the text segment size from the a.out         */
659         /* header, which happens to be mapped into our address space    */
660         /* at the start of the text segment.  The detective work here   */
661         /* was done by Robert Ehrlich, Manuel Serrano, and Bernard      */
662         /* Serpette of INRIA.                                           */
663         /* This assumes ZMAGIC, i.e. demand-loadable executables.       */
664 #       define TEXTSTART 0x2000
665 #       define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
666 #       define MPROTECT_VDB
667 #       define HEURISTIC1
668 #       define DYNAMIC_LOADING
669 #   endif
670 #   ifdef DRSNX
671 #       define CPP_WORDSZ 32
672 #       define OS_TYPE "DRSNX"
673         extern char * GC_SysVGetDataStart();
674         extern int etext;
675 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
676 #       define MPROTECT_VDB
677 #       define STACKBOTTOM ((ptr_t) 0xdfff0000)
678 #       define DYNAMIC_LOADING
679 #   endif
680 #   ifdef LINUX
681 #     define OS_TYPE "LINUX"
682 #     ifdef __ELF__
683 #       define DYNAMIC_LOADING
684 #     else
685           Linux Sparc/a.out not supported
686 #     endif
687       extern int _etext;
688       extern int _end;
689 #     define DATAEND (&_end)
690 #     define SVR4
691 #     ifdef __arch64__
692 #       define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
693 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
694 #       define CPP_WORDSZ 64
695 #     else
696 #       define STACKBOTTOM ((ptr_t) 0xf0000000)
697 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
698 #     endif
699 #   endif
700 #   ifdef OPENBSD
701 #     define OS_TYPE "OPENBSD"
702 #     define STACKBOTTOM ((ptr_t) 0xf8000000)
703 #     define DATASTART ((ptr_t)(&etext))
704 #   endif
705 # endif
706
707 # ifdef I386
708 #   define MACH_TYPE "I386"
709 #   define ALIGNMENT 4  /* Appears to hold for all "32 bit" compilers   */
710                         /* except Borland.  The -a4 option fixes        */
711                         /* Borland.                                     */
712                         /* Ivan Demakov: For Watcom the option is -zp4. */
713 #   ifndef SMALL_CONFIG
714 #     define ALIGN_DOUBLE /* Not strictly necessary, but may give speed   */
715                           /* improvement on Pentiums.                     */
716 #   endif
717 #   ifdef SEQUENT
718 #       define OS_TYPE "SEQUENT"
719         extern int etext;
720 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
721 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
722 #   endif
723 #   ifdef SUNOS5
724 #       define OS_TYPE "SUNOS5"
725         extern int etext, _start;
726         extern char * GC_SysVGetDataStart();
727 #       define DATASTART GC_SysVGetDataStart(0x1000, &etext)
728 #       define STACKBOTTOM ((ptr_t)(&_start))
729 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
730 /*#     define PROC_VDB*/
731 #       define DYNAMIC_LOADING
732 #       ifndef USE_MMAP
733 #           define USE_MMAP
734 #       endif
735 #       ifdef USE_MMAP
736 #         define HEAP_START (ptr_t)0x40000000
737 #       else
738 #         define HEAP_START DATAEND
739 #       endif
740 #   endif
741 #   ifdef SCO
742 #       define OS_TYPE "SCO"
743         extern int etext;
744 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
745                                   & ~0x3fffff) \
746                                  +((word)&etext & 0xfff))
747 #       define STACKBOTTOM ((ptr_t) 0x7ffffffc)
748 #   endif
749 #   ifdef SCO_ELF
750 #       define OS_TYPE "SCO_ELF"
751         extern int etext;
752 #       define DATASTART ((ptr_t)(&etext))
753 #       define STACKBOTTOM ((ptr_t) 0x08048000)
754 #       define DYNAMIC_LOADING
755 #       define ELF_CLASS ELFCLASS32
756 #   endif
757 #   ifdef LINUX
758 #       define OS_TYPE "LINUX"
759 #       define LINUX_STACKBOTTOM
760 #       if 0
761 #         define HEURISTIC1
762 #         undef STACK_GRAN
763 #         define STACK_GRAN 0x10000000
764           /* STACKBOTTOM is usually 0xc0000000, but this changes with   */
765           /* different kernel configurations.  In particular, systems   */
766           /* with 2GB physical memory will usually move the user        */
767           /* address space limit, and hence initial SP to 0x80000000.   */
768 #       endif
769 #       if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
770         /* libgcj: Linux threads don't interact well with the read() wrapper.
771            Not defining MPROTECT_VDB fixes this.  */
772 /* #        define MPROTECT_VDB */
773 #       else
774             /* We seem to get random errors in incremental mode,        */
775             /* possibly because Linux threads is itself a malloc client */
776             /* and can't deal with the signals.                         */
777 #       endif
778 #       ifdef __ELF__
779 #            define DYNAMIC_LOADING
780 #            ifdef UNDEFINED    /* includes ro data */
781                extern int _etext;
782 #              define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
783 #            endif
784 #            include <features.h>
785 #            if defined(__GLIBC__) && __GLIBC__ >= 2
786 #                define LINUX_DATA_START
787 #            else
788                  extern char **__environ;
789 #                define DATASTART ((ptr_t)(&__environ))
790                               /* hideous kludge: __environ is the first */
791                               /* word in crt0.o, and delimits the start */
792                               /* of the data segment, no matter which   */
793                               /* ld options were passed through.        */
794                               /* We could use _etext instead, but that  */
795                               /* would include .rodata, which may       */
796                               /* contain large read-only data tables    */
797                               /* that we'd rather not scan.             */
798 #            endif
799              extern int _end;
800 #            define DATAEND (&_end)
801 #       else
802              extern int etext;
803 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
804 #       endif
805 #       ifdef USE_I686_PREFETCH
806 #         define PREFETCH(x) \
807             __asm__ __volatile__ ("     prefetchnta     %0": : "m"(*(char *)(x)))
808             /* Empirically prefetcht0 is much more effective at reducing        */
809             /* cache miss stalls for the targetted load instructions.  But it   */
810             /* seems to interfere enough with other cache traffic that the net  */
811             /* result is worse than prefetchnta.                                */
812 #         if 0 
813             /* Using prefetches for write seems to have a slight negative       */
814             /* impact on performance, at least for a PIII/500.                  */
815 #           define PREFETCH_FOR_WRITE(x) \
816               __asm__ __volatile__ ("   prefetcht0      %0": : "m"(*(char *)(x)))
817 #         endif
818 #       endif
819 #       ifdef USE_3DNOW_PREFETCH
820 #         define PREFETCH(x) \
821             __asm__ __volatile__ ("     prefetch        %0": : "m"(*(char *)(x)))
822 #         define PREFETCH_FOR_WRITE(x) 
823             __asm__ __volatile__ ("     prefetchw       %0": : "m"(*(char *)(x)))
824 #       endif
825 #   endif
826 #   ifdef CYGWIN32
827 #       define OS_TYPE "CYGWIN32"
828           extern int _data_start__;
829           extern int _data_end__;
830           extern int _bss_start__;
831           extern int _bss_end__;
832         /* For binutils 2.9.1, we have                  */
833         /*      DATASTART   = _data_start__             */
834         /*      DATAEND     = _bss_end__                */
835         /* whereas for some earlier versions it was     */
836         /*      DATASTART   = _bss_start__              */
837         /*      DATAEND     = _data_end__               */
838         /* To get it right for both, we take the        */
839         /* minumum/maximum of the two.                  */
840 #       define MAX(x,y) ((x) > (y) ? (x) : (y))
841 #       define MIN(x,y) ((x) < (y) ? (x) : (y))
842 #       define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
843 #       define DATAEND   ((ptr_t) MAX(&_data_end__, &_bss_end__))
844 #       undef STACK_GRAN
845 #       define STACK_GRAN 0x10000
846 #       define HEURISTIC1
847 #   endif
848 #   ifdef OS2
849 #       define OS_TYPE "OS2"
850                 /* STACKBOTTOM and DATASTART are handled specially in   */
851                 /* os_dep.c. OS2 actually has the right                 */
852                 /* system call!                                         */
853 #       define DATAEND  /* not needed */
854 #   endif
855 #   ifdef MSWIN32
856 #       define OS_TYPE "MSWIN32"
857                 /* STACKBOTTOM and DATASTART are handled specially in   */
858                 /* os_dep.c.                                            */
859 #       ifndef __WATCOMC__
860 #         define MPROTECT_VDB
861 #       endif
862 #       define DATAEND  /* not needed */
863 #   endif
864 #   ifdef DJGPP
865 #       define OS_TYPE "DJGPP"
866 #       include "stubinfo.h"
867         extern int etext;
868         extern int _stklen;
869         extern int __djgpp_stack_limit;
870 #       define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
871 /* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
872                                                      + _stklen)) */
873 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
874                 /* This may not be right.  */
875 #   endif
876 #   ifdef OPENBSD
877 #       define OS_TYPE "OPENBSD"
878 #   endif
879 #   ifdef FREEBSD
880 #       define OS_TYPE "FREEBSD"
881 #       define MPROTECT_VDB
882 #   endif
883 #   ifdef NETBSD
884 #       define OS_TYPE "NETBSD"
885 #   endif
886 #   ifdef THREE86BSD
887 #       define OS_TYPE "THREE86BSD"
888 #   endif
889 #   ifdef BSDI
890 #       define OS_TYPE "BSDI"
891 #   endif
892 #   if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
893         || defined(THREE86BSD) || defined(BSDI)
894 #       define HEURISTIC2
895         extern char etext;
896 #       define DATASTART ((ptr_t)(&etext))
897 #   endif
898 #   ifdef NEXT
899 #       define OS_TYPE "NEXT"
900 #       define DATASTART ((ptr_t) get_etext())
901 #       define STACKBOTTOM ((ptr_t)0xc0000000)
902 #       define DATAEND  /* not needed */
903 #   endif
904 #   ifdef DOS4GW
905 #     define OS_TYPE "DOS4GW"
906       extern long __nullarea;
907       extern char _end;
908       extern char *_STACKTOP;
909       /* Depending on calling conventions Watcom C either precedes
910          or does not precedes with undescore names of C-variables.
911          Make sure startup code variables always have the same names.  */
912       #pragma aux __nullarea "*";
913       #pragma aux _end "*";
914 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
915                          /* confused? me too. */
916 #     define DATASTART ((ptr_t) &__nullarea)
917 #     define DATAEND ((ptr_t) &_end)
918 #   endif
919 # endif
920
921 # ifdef NS32K
922 #   define MACH_TYPE "NS32K"
923 #   define ALIGNMENT 4
924     extern char **environ;
925 #   define DATASTART ((ptr_t)(&environ))
926                               /* hideous kludge: environ is the first   */
927                               /* word in crt0.o, and delimits the start */
928                               /* of the data segment, no matter which   */
929                               /* ld options were passed through.        */
930 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
931 # endif
932
933 # ifdef MIPS
934 # ifndef ECOS
935 #   define MACH_TYPE "MIPS"
936         /* LIBGCJ LOCAL: respect predefined DATASTART_IS_ETEXT.  */
937 #   ifdef DATASTART_IS_ETEXT
938         extern int _etext;
939 #     define DATASTART ((ptr_t)(&_etext))
940 #   else
941 /* #   define STACKBOTTOM ((ptr_t)0x7fff8000)  sometimes also works.  */
942 #   ifdef LINUX
943       /* This was developed for a linuxce style platform.  Probably     */
944       /* needs to be tweaked for workstation class machines.            */
945 #     define OS_TYPE "LINUX"
946       extern int __data_start;
947 #     define DATASTART ((ptr_t)(&__data_start))
948 #     define ALIGNMENT 4
949 #     define USE_GENERIC_PUSH_REGS 1
950 #     define STACKBOTTOM 0x80000000
951         /* In many cases, this should probably use LINUX_STACKBOTTOM    */
952         /* instead. But some kernel versions seem to give the wrong     */
953         /* value from /proc.                                            */
954 #   endif /* Linux */
955 #   ifdef ULTRIX
956 #       define HEURISTIC2
957 #       define DATASTART (ptr_t)0x10000000
958                               /* Could probably be slightly higher since */
959                               /* startup code allocates lots of stuff.   */
960 #       define OS_TYPE "ULTRIX"
961 #       define ALIGNMENT 4
962 #   endif
963 #   ifdef RISCOS
964 #       define HEURISTIC2
965 #       define DATASTART (ptr_t)0x10000000
966 #       define OS_TYPE "RISCOS"
967 #       define ALIGNMENT 4  /* Required by hardware */
968 #   endif
969 #   ifdef IRIX5
970 #       define HEURISTIC2
971         extern int _fdata;
972 #       define DATASTART ((ptr_t)(&_fdata))
973 #       ifdef USE_MMAP
974 #         define HEAP_START (ptr_t)0x30000000
975 #       else
976 #         define HEAP_START DATASTART
977 #       endif
978                               /* Lowest plausible heap address.         */
979                               /* In the MMAP case, we map there.        */
980                               /* In either case it is used to identify  */
981                               /* heap sections so they're not           */
982                               /* considered as roots.                   */
983 #       define OS_TYPE "IRIX5"
984 #       define MPROTECT_VDB
985 #       ifdef _MIPS_SZPTR
986 #         define CPP_WORDSZ _MIPS_SZPTR
987 #         define ALIGNMENT (_MIPS_SZPTR/8)
988 #         if CPP_WORDSZ != 64
989 #           define ALIGN_DOUBLE
990 #         endif
991 #       else
992 #         define ALIGNMENT 4
993 #         define ALIGN_DOUBLE
994 #       endif
995 #       define DYNAMIC_LOADING
996 #   endif
997 #   endif /* DATASTART_IS_ETEXT */
998 #   endif /* ECOS */
999 # ifdef ECOS
1000     extern char __ram_data_start;
1001     extern char __ram_data_end;
1002 #   define MACH_TYPE "MIPS"
1003 #   define DATASTART (ptr_t)(&__ram_data_start)
1004 #   define DATAEND (ptr_t)(&__ram_data_end)
1005
1006 #   define HEURISTIC2
1007 #   define ALIGNMENT 4
1008 #   define ALIGN_DOUBLE
1009 #   endif /* ECOS */
1010 # endif
1011
1012 # ifdef RS6000
1013 #   define MACH_TYPE "RS6000"
1014 #   define ALIGNMENT 4
1015 #   define DATASTART ((ptr_t)0x20000000)
1016     extern int errno;
1017 #   define STACKBOTTOM ((ptr_t)((ulong)&errno))
1018 #   define DYNAMIC_LOADING
1019         /* For really old versions of AIX, this may have to be removed. */
1020 # endif
1021
1022 # ifdef HP_PA
1023     /* OS is assumed to be HP/UX        */
1024 #   define MACH_TYPE "HP_PA"
1025 #   define OS_TYPE "HPUX"
1026 #   ifdef __LP64__
1027 #     define CPP_WORDSZ 64
1028 #     define ALIGNMENT 8
1029 #   else
1030 #     define CPP_WORDSZ 32
1031 #     define ALIGNMENT 4
1032 #     define ALIGN_DOUBLE
1033 #   endif
1034     extern int __data_start;
1035 #   define DATASTART ((ptr_t)(&__data_start))
1036 #   if 0
1037         /* The following appears to work for 7xx systems running HP/UX  */
1038         /* 9.xx Furthermore, it might result in much faster             */
1039         /* collections than HEURISTIC2, which may involve scanning      */
1040         /* segments that directly precede the stack.  It is not the     */
1041         /* default, since it may not work on older machine/OS           */
1042         /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1043         /* this.)                                                       */
1044 #       define STACKBOTTOM ((ptr_t) 0x7b033000)  /* from /etc/conf/h/param.h */
1045 #   else
1046         /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2       */
1047         /* to this.  We'll probably do this on other platforms, too.    */
1048         /* For now I'll use it where I can test it.                     */
1049         extern char ** environ;
1050 #       define STACKBOTTOM ((ptr_t)environ)
1051 #   endif
1052 #   define STACK_GROWS_UP
1053 #   define DYNAMIC_LOADING
1054 #   ifndef HPUX_THREADS
1055 #     define MPROTECT_VDB
1056 #   endif
1057 #   include <unistd.h>
1058 #   define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1059 # endif
1060
1061 # ifdef ALPHA
1062 #   define MACH_TYPE "ALPHA"
1063 #   define ALIGNMENT 8
1064 #   define USE_GENERIC_PUSH_REGS
1065         /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
1066         /* fp registers in some cases when the target is a 21264.  The assembly */
1067         /* code doesn't handle that yet, and version dependencies make that a   */
1068         /* bit tricky.  Do the easy thing for now.                              */
1069 #   ifdef OSF1
1070 #       define OS_TYPE "OSF1"
1071 #       define DATASTART ((ptr_t) 0x140000000)
1072         extern int _end;
1073 #       define DATAEND ((ptr_t) &_end)
1074 #       define HEURISTIC2
1075         /* Normally HEURISTIC2 is too conervative, since                */
1076         /* the text segment immediately follows the stack.              */
1077         /* Hence we give an upper pound.                                */
1078         extern int __start;
1079 #       define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
1080 #       define CPP_WORDSZ 64
1081 #       define MPROTECT_VDB
1082 #       define DYNAMIC_LOADING
1083 #   endif
1084 #   ifdef LINUX
1085 #       define OS_TYPE "LINUX"
1086 #       define CPP_WORDSZ 64
1087 #       define STACKBOTTOM ((ptr_t) 0x120000000)
1088 #       ifdef __ELF__
1089 #         define LINUX_DATA_START
1090 #         define DYNAMIC_LOADING
1091           /* This doesn't work if the collector is in a dynamic library. */
1092 #       else
1093 #           define DATASTART ((ptr_t) 0x140000000)
1094 #       endif
1095         extern int _end;
1096 #       define DATAEND (&_end)
1097 #       undef MPROTECT_VDB
1098                 /* Has only been superficially tested.  May not */
1099                 /* work on all versions.                        */
1100 #   endif
1101 # endif
1102
1103 # ifdef IA64
1104 #   define MACH_TYPE "IA64"
1105 #   define ALIGN_DOUBLE
1106         /* Requires 16 byte alignment for malloc */
1107 #   define ALIGNMENT 8
1108 #   define USE_GENERIC_PUSH_REGS
1109         /* We need to get preserved registers in addition to register windows.  */
1110         /* That's easiest to do with setjmp.                                    */
1111 #   ifdef HPUX
1112         --> needs work
1113 #   endif
1114 #   ifdef LINUX
1115 #       define OS_TYPE "LINUX"
1116 #       define CPP_WORDSZ 64
1117         /* This should really be done through /proc, but that   */
1118         /* requires we run on an IA64 kernel.                   */
1119         /* The following works on NUE and older kernels:        */
1120 /* #       define STACKBOTTOM ((ptr_t) 0xa000000000000000l)     */
1121         /* This does not work on NUE:                           */
1122 #       define LINUX_STACKBOTTOM
1123         /* We also need the base address of the register stack  */
1124         /* backing store.  There should be a better way to get  */
1125         /* this:                                                */
1126 #       define APPROX_BS_BASE ((word)GC_stackbottom-0x80000000)
1127         /* We round to the next multiple of 1 MB, to compensate */
1128         /* for the fact that the stack base is displaced by     */
1129         /* the environment, etc.                                */
1130 #       define BACKING_STORE_BASE \
1131                 (ptr_t)((APPROX_BS_BASE + 0xfffff) & ~0xfffff)
1132
1133 #       if 1
1134 #           define SEARCH_FOR_DATA_START
1135 #           define DATASTART GC_data_start
1136 #       else
1137             extern int data_start;
1138 #           define DATASTART ((ptr_t)(&data_start))
1139 #       endif
1140 #       define DYNAMIC_LOADING
1141 #       define MPROTECT_VDB
1142                 /* Requires Linux 2.3.47 or later.      */
1143         extern int _end;
1144 #       define DATAEND (&_end)
1145 #       define PREFETCH(x) \
1146           __asm__ ("    lfetch  [%0]": : "r"((void *)(x)))
1147 #       define PREFETCH_FOR_WRITE(x) \
1148           __asm__ ("    lfetch.excl     [%0]": : "r"((void *)(x)))
1149 #       define CLEAR_DOUBLE(x) \
1150           __asm__ ("    stf.spill       [%0]=f0": : "r"((void *)(x)))
1151 #   endif
1152 # endif
1153
1154 # ifdef M88K
1155 #   define MACH_TYPE "M88K"
1156 #   define ALIGNMENT 4
1157 #   define ALIGN_DOUBLE
1158     extern int etext;
1159 #   ifdef CX_UX
1160 #       define OS_TYPE "CX_UX"
1161 #       define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1162 #   endif
1163 #   ifdef  DGUX
1164 #       define OS_TYPE "DGUX"
1165         extern char * GC_SysVGetDataStart();
1166 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
1167 #   endif
1168 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1169 # endif
1170
1171 # ifdef S370
1172 #   define MACH_TYPE "S370"
1173 #   define OS_TYPE "UTS4"
1174 #   define ALIGNMENT 4  /* Required by hardware */
1175     extern int etext;
1176         extern int _etext;
1177         extern int _end;
1178         extern char * GC_SysVGetDataStart();
1179 #       define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
1180 #       define DATAEND (&_end)
1181 #       define HEURISTIC2
1182 # endif
1183
1184 # if defined(PJ)
1185 #   define ALIGNMENT 4
1186     extern int _etext;
1187 #   define DATASTART ((ptr_t)(&_etext))
1188 #   define HEURISTIC1
1189 # endif
1190
1191 # ifdef ARM32
1192 #   define CPP_WORDSZ 32
1193 #   define MACH_TYPE "ARM32"
1194 #   define ALIGNMENT 4
1195 #   ifdef NETBSD
1196 #       define OS_TYPE "NETBSD"
1197 #       define HEURISTIC2
1198         extern char etext;
1199 #       define DATASTART ((ptr_t)(&etext))
1200 #       define USE_GENERIC_PUSH_REGS
1201 #   endif
1202 #   ifdef LINUX
1203 #       define OS_TYPE "LINUX"
1204 #       define HEURISTIC1
1205 #       undef STACK_GRAN
1206 #       define STACK_GRAN 0x10000000
1207 #       define USE_GENERIC_PUSH_REGS
1208 #       ifdef __ELF__
1209 #            define DYNAMIC_LOADING
1210 #            include <features.h>
1211 #            if defined(__GLIBC__) && __GLIBC__ >= 2
1212 #                define LINUX_DATA_START
1213 #            else
1214                  extern char **__environ;
1215 #                define DATASTART ((ptr_t)(&__environ))
1216                               /* hideous kludge: __environ is the first */
1217                               /* word in crt0.o, and delimits the start */
1218                               /* of the data segment, no matter which   */
1219                               /* ld options were passed through.        */
1220                               /* We could use _etext instead, but that  */
1221                               /* would include .rodata, which may       */
1222                               /* contain large read-only data tables    */
1223                               /* that we'd rather not scan.             */
1224 #            endif
1225              extern int _end;
1226 #            define DATAEND (&_end)
1227 #       else
1228              extern int etext;
1229 #            define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
1230 #       endif
1231 #   endif
1232 #endif
1233
1234 #ifdef LINUX_DATA_START
1235     /* Some Linux distributions arrange to define __data_start.  Some   */
1236     /* define data_start as a weak symbol.  The latter is technically   */
1237     /* broken, since the user program may define data_start, in which   */
1238     /* case we lose.  Nonetheless, we try both, prefering __data_start. */
1239     /* We assume gcc.   */
1240 #   pragma weak __data_start
1241     extern int __data_start;
1242 #   pragma weak data_start
1243     extern int data_start;
1244 #   define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
1245 #endif
1246
1247 # ifndef STACK_GROWS_UP
1248 #   define STACK_GROWS_DOWN
1249 # endif
1250
1251 # ifndef CPP_WORDSZ
1252 #   define CPP_WORDSZ 32
1253 # endif
1254
1255 # ifndef OS_TYPE
1256 #   define OS_TYPE ""
1257 # endif
1258
1259 # ifndef DATAEND
1260     extern int end;
1261 #   define DATAEND (&end)
1262 # endif
1263
1264 # if defined(SVR4) && !defined(GETPAGESIZE)
1265 #    include <unistd.h>
1266 #    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
1267 # endif
1268
1269 # ifndef GETPAGESIZE
1270 #   if defined(SUNOS5) || defined(IRIX5)
1271 #       include <unistd.h>
1272 #   endif
1273 #   define GETPAGESIZE() getpagesize()
1274 # endif
1275
1276 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
1277     /* OS has SVR4 generic features.  Probably others also qualify.     */
1278 #   define SVR4
1279 # endif
1280
1281 # if defined(SUNOS5) || defined(DRSNX)
1282     /* OS has SUNOS5 style semi-undocumented interface to dynamic       */
1283     /* loader.                                                          */
1284 #   define SUNOS5DL
1285     /* OS has SUNOS5 style signal handlers.                             */
1286 #   define SUNOS5SIGS
1287 # endif
1288
1289 # if defined(HPUX)
1290 #   define SUNOS5SIGS
1291 # endif
1292
1293 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
1294    -> bad word size
1295 # endif
1296
1297 # ifdef PCR
1298 #   undef DYNAMIC_LOADING
1299 #   undef STACKBOTTOM
1300 #   undef HEURISTIC1
1301 #   undef HEURISTIC2
1302 #   undef PROC_VDB
1303 #   undef MPROTECT_VDB
1304 #   define PCR_VDB
1305 # endif
1306
1307 # ifdef SRC_M3
1308 /* Postponed for now. */
1309 #   undef PROC_VDB
1310 #   undef MPROTECT_VDB
1311 # endif
1312
1313 # ifdef SMALL_CONFIG
1314 /* Presumably not worth the space it takes. */
1315 #   undef PROC_VDB
1316 #   undef MPROTECT_VDB
1317 # endif
1318
1319 # ifdef USE_MUNMAP
1320 #   undef MPROTECT_VDB  /* Can't deal with address space holes. */
1321 # endif
1322
1323 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
1324 #   define DEFAULT_VDB
1325 # endif
1326
1327 # ifndef PREFETCH
1328 #   define PREFETCH(x)
1329 #   define NO_PREFETCH
1330 # endif
1331
1332 # ifndef PREFETCH_FOR_WRITE
1333 #   define PREFETCH_FOR_WRITE(x)
1334 #   define NO_PREFETCH_FOR_WRITE
1335 # endif
1336
1337 # ifndef CACHE_LINE_SIZE
1338 #   define CACHE_LINE_SIZE 32   /* Wild guess   */
1339 # endif
1340
1341 # ifndef CLEAR_DOUBLE
1342 #   define CLEAR_DOUBLE(x) \
1343         ((word*)x)[0] = 0; \
1344         ((word*)x)[1] = 0;
1345 # endif /* CLEAR_DOUBLE */
1346
1347 # if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
1348 #   define SOLARIS_THREADS
1349 # endif
1350 # if defined(IRIX_THREADS) && !defined(IRIX5)
1351 --> inconsistent configuration
1352 # endif
1353 # if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
1354 --> inconsistent configuration
1355 # endif
1356 # if defined(LINUX_THREADS) && !defined(LINUX)
1357 --> inconsistent configuration
1358 # endif
1359 # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
1360 --> inconsistent configuration
1361 # endif
1362 # if defined(HPUX_THREADS) && !defined(HPUX)
1363 --> inconsistent configuration
1364 # endif
1365 # if defined(PCR) || defined(SRC_M3) || \
1366         defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
1367         defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
1368         defined(IRIX_JDK_THREADS) || defined(HPUX_THREADS)
1369 #   define THREADS
1370 # endif
1371
1372 # if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
1373      || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
1374         /* Use setjmp based hack to mark from callee-save registers. */
1375 #       define USE_GENERIC_PUSH_REGS
1376 # endif
1377 # if defined(SPARC)
1378 #   define SAVE_CALL_CHAIN
1379 #   define ASM_CLEAR_CODE       /* Stack clearing is crucial, and we    */
1380                                 /* include assembly code to do it well. */
1381 # endif
1382
1383 # endif /* GCCONFIG_H */