Add FR30 to list of targets for which -fpic is inappropriate.
[official-gcc.git] / boehm-gc / config.h
blob7791b6cacb98f232a40746eab6bf55f714574ce3
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.
6 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
7 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
16 #ifndef CONFIG_H
18 # define CONFIG_H
20 /* Machine dependent parameters. Some tuning parameters can be found */
21 /* near the top of gc_private.h. */
23 /* Machine specific parts contributed by various people. See README file. */
25 /* Determine the machine type: */
26 # if defined(sun) && defined(mc68000)
27 # define M68K
28 # define SUNOS4
29 # define mach_type_known
30 # endif
31 # if defined(hp9000s300)
32 # define M68K
33 # define HP
34 # define mach_type_known
35 # endif
36 # if defined(__NetBSD__) && defined(m68k)
37 # define M68K
38 # define NETBSD
39 # define mach_type_known
40 # endif
41 # if defined(vax)
42 # define VAX
43 # ifdef ultrix
44 # define ULTRIX
45 # else
46 # define BSD
47 # endif
48 # define mach_type_known
49 # endif
50 # if defined(mips) || defined(__mips)
51 # define MIPS
52 # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
53 # define ULTRIX
54 # else
55 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
56 # define IRIX5 /* or IRIX 6.X */
57 # else
58 # define RISCOS /* or IRIX 4.X */
59 # endif
60 # endif
61 # define mach_type_known
62 # endif
63 # if defined(sequent) && defined(i386)
64 # define I386
65 # define SEQUENT
66 # define mach_type_known
67 # endif
68 # if defined(sun) && defined(i386)
69 # define I386
70 # define SUNOS5
71 # define mach_type_known
72 # endif
73 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
74 # define I386
75 # define OS2
76 # define mach_type_known
77 # endif
78 # if defined(ibm032)
79 # define RT
80 # define mach_type_known
81 # endif
82 # if defined(sun) && (defined(sparc) || defined(__sparc))
83 # define SPARC
84 /* Test for SunOS 5.x */
85 # include <errno.h>
86 # ifdef ECHRNG
87 # define SUNOS5
88 # else
89 # define SUNOS4
90 # endif
91 # define mach_type_known
92 # endif
93 # if defined(sparc) && defined(unix) && !defined(sun)
94 # define SPARC
95 # define DRSNX
96 # define mach_type_known
97 # endif
98 # if defined(_IBMR2)
99 # define RS6000
100 # define mach_type_known
101 # endif
102 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
103 /* The above test may need refinement */
104 # define I386
105 # if defined(_SCO_ELF)
106 # define SCO_ELF
107 # else
108 # define SCO
109 # endif
110 # define mach_type_known
111 # endif
112 # if defined(_AUX_SOURCE)
113 # define M68K
114 # define SYSV
115 # define mach_type_known
116 # endif
117 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1)
118 # define HP_PA
119 # define mach_type_known
120 # endif
121 # if defined(linux) && defined(i386)
122 # define I386
123 # define LINUX
124 # define mach_type_known
125 # endif
126 # if defined(linux) && defined(powerpc)
127 # define POWERPC
128 # define LINUX
129 # define mach_type_known
130 # endif
131 # if defined(__alpha) || defined(__alpha__)
132 # define ALPHA
133 # if defined(linux) || defined(__linux__)
134 # define LINUX
135 # else
136 # define OSF1 /* a.k.a Digital Unix */
137 # endif
138 # define mach_type_known
139 # endif
140 # if defined(_AMIGA)
141 # define M68K
142 # define AMIGA
143 # define mach_type_known
144 # endif
145 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
146 # define M68K
147 # define MACOS
148 # define mach_type_known
149 # endif
150 # if defined(__MWERKS__) && defined(__powerc)
151 # define POWERPC
152 # define MACOS
153 # define mach_type_known
154 # endif
155 # if defined(NeXT) && defined(mc68000)
156 # define M68K
157 # define NEXT
158 # define mach_type_known
159 # endif
160 # if defined(NeXT) && defined(i386)
161 # define I386
162 # define NEXT
163 # define mach_type_known
164 # endif
165 # if defined(__FreeBSD__) && defined(i386)
166 # define I386
167 # define FREEBSD
168 # define mach_type_known
169 # endif
170 # if defined(__NetBSD__) && defined(i386)
171 # define I386
172 # define NETBSD
173 # define mach_type_known
174 # endif
175 # if defined(bsdi) && defined(i386)
176 # define I386
177 # define BSDI
178 # define mach_type_known
179 # endif
180 # if !defined(mach_type_known) && defined(__386BSD__)
181 # define I386
182 # define THREE86BSD
183 # define mach_type_known
184 # endif
185 # if defined(_CX_UX) && defined(_M88K)
186 # define M88K
187 # define CX_UX
188 # define mach_type_known
189 # endif
190 # if defined(DGUX)
191 # define M88K
192 /* DGUX defined */
193 # define mach_type_known
194 # endif
195 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300)
196 # define I386
197 # define MSWIN32 /* or Win32s */
198 # define mach_type_known
199 # endif
200 # if defined(__DJGPP__)
201 # define I386
202 # ifndef DJGPP
203 # define DJGPP /* MSDOS running the DJGPP port of GCC */
204 # endif
205 # define mach_type_known
206 # endif
207 # if defined(__CYGWIN32__)
208 # define I386
209 # define CYGWIN32
210 # define mach_type_known
211 # endif
212 # if defined(__BORLANDC__)
213 # define I386
214 # define MSWIN32
215 # define mach_type_known
216 # endif
217 # if defined(_UTS) && !defined(mach_type_known)
218 # define S370
219 # define UTS4
220 # define mach_type_known
221 # endif
222 /* Ivan Demakov */
223 # if defined(__WATCOMC__) && defined(__386__)
224 # define I386
225 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
226 # if defined(__OS2__)
227 # define OS2
228 # else
229 # if defined(__WINDOWS_386__) || defined(__NT__)
230 # define MSWIN32
231 # else
232 # define DOS4GW
233 # endif
234 # endif
235 # endif
236 # define mach_type_known
237 # endif
239 /* Feel free to add more clauses here */
241 /* Or manually define the machine type here. A machine type is */
242 /* characterized by the architecture. Some */
243 /* machine types are further subdivided by OS. */
244 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
245 /* Note that SGI IRIX is treated identically to RISCOS. */
246 /* SYSV on an M68K actually means A/UX. */
247 /* The distinction in these cases is usually the stack starting address */
248 # ifndef mach_type_known
249 --> unknown machine type
250 # endif
251 /* Mapping is: M68K ==> Motorola 680X0 */
252 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
253 /* MACOS and AMIGA variants) */
254 /* I386 ==> Intel 386 */
255 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
256 /* FREEBSD, THREE86BSD, MSWIN32, */
257 /* BSDI, SUNOS5, NEXT variants) */
258 /* NS32K ==> Encore Multimax */
259 /* MIPS ==> R2000 or R3000 */
260 /* (RISCOS, ULTRIX variants) */
261 /* VAX ==> DEC VAX */
262 /* (BSD, ULTRIX variants) */
263 /* RS6000 ==> IBM RS/6000 AIX3.X */
264 /* RT ==> IBM PC/RT */
265 /* HP_PA ==> HP9000/700 & /800 */
266 /* HP/UX */
267 /* SPARC ==> SPARC under SunOS */
268 /* (SUNOS4, SUNOS5, */
269 /* DRSNX variants) */
270 /* ALPHA ==> DEC Alpha */
271 /* (OSF1 and LINUX variants) */
272 /* M88K ==> Motorola 88XX0 */
273 /* (CX_UX and DGUX) */
274 /* S370 ==> 370-like machine */
275 /* running Amdahl UTS4 */
279 * For each architecture and OS, the following need to be defined:
281 * CPP_WORD_SZ is a simple integer constant representing the word size.
282 * in bits. We assume byte addressibility, where a byte has 8 bits.
283 * We also assume CPP_WORD_SZ is either 32 or 64.
284 * (We care about the length of pointers, not hardware
285 * bus widths. Thus a 64 bit processor with a C compiler that uses
286 * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
288 * MACH_TYPE is a string representation of the machine type.
289 * OS_TYPE is analogous for the OS.
291 * ALIGNMENT is the largest N, such that
292 * all pointer are guaranteed to be aligned on N byte boundaries.
293 * defining it to be 1 will always work, but perform poorly.
295 * DATASTART is the beginning of the data segment.
296 * On UNIX systems, the collector will scan the area between DATASTART
297 * and DATAEND for root pointers.
299 * DATAEND, if not &end.
301 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
302 * the pointer size.
304 * STACKBOTTOM is the cool end of the stack, which is usually the
305 * highest address in the stack.
306 * Under PCR or OS/2, we have other ways of finding thread stacks.
307 * For each machine, the following should:
308 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
309 * 2) define exactly one of
310 * STACKBOTTOM (should be defined to be an expression)
311 * HEURISTIC1
312 * HEURISTIC2
313 * If either of the last two macros are defined, then STACKBOTTOM is computed
314 * during collector startup using one of the following two heuristics:
315 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
316 * the next multiple of STACK_GRAN.
317 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
318 * in small steps (decrement if STACK_GROWS_UP), and read the value
319 * at each location. Remember the value when the first
320 * Segmentation violation or Bus error is signalled. Round that
321 * to the nearest plausible page boundary, and use that instead
322 * of STACKBOTTOM.
324 * If no expression for STACKBOTTOM can be found, and neither of the above
325 * heuristics are usable, the collector can still be used with all of the above
326 * undefined, provided one of the following is done:
327 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
328 * without reference to STACKBOTTOM. This is appropriate for use in
329 * conjunction with thread packages, since there will be multiple stacks.
330 * (Allocating thread stacks in the heap, and treating them as ordinary
331 * heap data objects is also possible as a last resort. However, this is
332 * likely to introduce significant amounts of excess storage retention
333 * unless the dead parts of the thread stacks are periodically cleared.)
334 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
335 * If the author of the client code controls the main program, this is
336 * easily accomplished by introducing a new main program, setting
337 * GC_stackbottom to the address of a local variable, and then calling
338 * the original main program. The new main program would read something
339 * like:
341 * # include "gc_private.h"
343 * main(argc, argv, envp)
344 * int argc;
345 * char **argv, **envp;
347 * int dummy;
349 * GC_stackbottom = (ptr_t)(&dummy);
350 * return(real_main(argc, argv, envp));
354 * Each architecture may also define the style of virtual dirty bit
355 * implementation to be used:
356 * MPROTECT_VDB: Write protect the heap and catch faults.
357 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
359 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
360 * defined GC_register_dynamic_libraries() for the architecture.
364 # define STACK_GRAN 0x1000000
365 # ifdef M68K
366 # define MACH_TYPE "M68K"
367 # define ALIGNMENT 2
368 # ifdef NETBSD
369 # define OS_TYPE "NETBSD"
370 # define HEURISTIC2
371 extern char etext;
372 # define DATASTART ((ptr_t)(&etext))
373 # endif
374 # ifdef SUNOS4
375 # define OS_TYPE "SUNOS4"
376 extern char etext;
377 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
378 # define HEURISTIC1 /* differs */
379 # define DYNAMIC_LOADING
380 # endif
381 # ifdef HP
382 # define OS_TYPE "HP"
383 extern char etext;
384 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
385 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
386 /* empirically determined. seems to work. */
387 # include <unistd.h>
388 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
389 # endif
390 # ifdef SYSV
391 # define OS_TYPE "SYSV"
392 extern etext;
393 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
394 & ~0x3fffff) \
395 +((word)&etext & 0x1fff))
396 /* This only works for shared-text binaries with magic number 0413.
397 The other sorts of SysV binaries put the data at the end of the text,
398 in which case the default of &etext would work. Unfortunately,
399 handling both would require having the magic-number available.
400 -- Parag
402 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
403 /* The stack starts at the top of memory, but */
404 /* 0x0 cannot be used as setjump_test complains */
405 /* that the stack direction is incorrect. Two */
406 /* bytes down from 0x0 should be safe enough. */
407 /* --Parag */
408 # include <sys/mmu.h>
409 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
410 # endif
411 # ifdef AMIGA
412 # define OS_TYPE "AMIGA"
413 /* STACKBOTTOM and DATASTART handled specially */
414 /* in os_dep.c */
415 # define DATAEND /* not needed */
416 # define GETPAGESIZE() 4096
417 # endif
418 # ifdef MACOS
419 # ifndef __LOWMEM__
420 # include <LowMem.h>
421 # endif
422 # define OS_TYPE "MACOS"
423 /* see os_dep.c for details of global data segments. */
424 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
425 # define DATAEND /* not needed */
426 # define GETPAGESIZE() 4096
427 # endif
428 # ifdef NEXT
429 # define OS_TYPE "NEXT"
430 # define DATASTART ((ptr_t) get_etext())
431 # define STACKBOTTOM ((ptr_t) 0x4000000)
432 # define DATAEND /* not needed */
433 # endif
434 # endif
436 # ifdef POWERPC
437 # define MACH_TYPE "POWERPC"
438 # define ALIGNMENT 2
439 # ifdef MACOS
440 # ifndef __LOWMEM__
441 # include <LowMem.h>
442 # endif
443 # define OS_TYPE "MACOS"
444 /* see os_dep.c for details of global data segments. */
445 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
446 # define DATAEND /* not needed */
447 # endif
448 # ifdef LINUX
449 # define OS_TYPE "LINUX"
450 # define STACKBOTTOM ((ptr_t)0x80000000)
451 # define DATASTART GC_data_start
452 extern int _end;
453 # define DATAEND (&_end)
454 # endif
455 # endif
457 # ifdef VAX
458 # define MACH_TYPE "VAX"
459 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
460 extern char etext;
461 # define DATASTART ((ptr_t)(&etext))
462 # ifdef BSD
463 # define OS_TYPE "BSD"
464 # define HEURISTIC1
465 /* HEURISTIC2 may be OK, but it's hard to test. */
466 # endif
467 # ifdef ULTRIX
468 # define OS_TYPE "ULTRIX"
469 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
470 # endif
471 # endif
473 # ifdef RT
474 # define MACH_TYPE "RT"
475 # define ALIGNMENT 4
476 # define DATASTART ((ptr_t) 0x10000000)
477 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
478 # endif
480 # ifdef SPARC
481 # define MACH_TYPE "SPARC"
482 # define ALIGNMENT 4 /* Required by hardware */
483 # define ALIGN_DOUBLE
484 extern int etext;
485 # ifdef SUNOS5
486 # define OS_TYPE "SUNOS5"
487 extern int _etext;
488 extern int _end;
489 extern char * GC_SysVGetDataStart();
490 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
491 # define DATAEND (&_end)
492 # ifndef USE_MMAP
493 # define USE_MMAP
494 # endif
495 # ifdef USE_MMAP
496 # define HEAP_START (ptr_t)0x40000000
497 # else
498 # define HEAP_START DATAEND
499 # endif
500 # define PROC_VDB
501 # define HEURISTIC1
502 # include <unistd.h>
503 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
504 /* getpagesize() appeared to be missing from at least one */
505 /* Solaris 5.4 installation. Weird. */
506 # endif
507 # ifdef SUNOS4
508 # define OS_TYPE "SUNOS4"
509 /* [If you have a weak stomach, don't read this.] */
510 /* We would like to use: */
511 /* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
512 /* This fails occasionally, due to an ancient, but very */
513 /* persistent ld bug. &etext is set 32 bytes too high. */
514 /* We instead read the text segment size from the a.out */
515 /* header, which happens to be mapped into our address space */
516 /* at the start of the text segment. The detective work here */
517 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
518 /* Serpette of INRIA. */
519 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
520 # define TEXTSTART 0x2000
521 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
522 # define MPROTECT_VDB
523 # define HEURISTIC1
524 # endif
525 # ifdef DRSNX
526 # define CPP_WORDSZ 32
527 # define OS_TYPE "DRSNX"
528 extern char * GC_SysVGetDataStart();
529 extern int etext;
530 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
531 # define MPROTECT_VDB
532 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
533 # endif
534 # define DYNAMIC_LOADING
535 # endif
537 # ifdef I386
538 # define MACH_TYPE "I386"
539 # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
540 /* except Borland. The -a4 option fixes */
541 /* Borland. */
542 /* Ivan Demakov: For Watcom the option is -zp4. */
543 # ifndef SMALL_CONFIG
544 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
545 /* improvement on Pentiums. */
546 # endif
547 # ifdef SEQUENT
548 # define OS_TYPE "SEQUENT"
549 extern int etext;
550 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
551 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
552 # endif
553 # ifdef SUNOS5
554 # define OS_TYPE "SUNOS5"
555 extern int etext, _start;
556 extern char * GC_SysVGetDataStart();
557 # define DATASTART GC_SysVGetDataStart(0x1000, &etext)
558 # define STACKBOTTOM ((ptr_t)(&_start))
559 /** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
560 /*# define PROC_VDB*/
561 # define DYNAMIC_LOADING
562 # ifndef USE_MMAP
563 # define USE_MMAP
564 # endif
565 # ifdef USE_MMAP
566 # define HEAP_START (ptr_t)0x40000000
567 # else
568 # define HEAP_START DATAEND
569 # endif
570 # endif
571 # ifdef SCO
572 # define OS_TYPE "SCO"
573 extern int etext;
574 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
575 & ~0x3fffff) \
576 +((word)&etext & 0xfff))
577 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
578 # endif
579 # ifdef SCO_ELF
580 # define OS_TYPE "SCO_ELF"
581 extern int etext;
582 # define DATASTART ((ptr_t)(&etext))
583 # define STACKBOTTOM ((ptr_t) 0x08048000)
584 # define DYNAMIC_LOADING
585 # define ELF_CLASS ELFCLASS32
586 # endif
587 # ifdef LINUX
588 # define OS_TYPE "LINUX"
589 # define STACKBOTTOM ((ptr_t)0xc0000000)
590 /* Appears to be 0xe0000000 for at least one 2.1.91 kernel. */
591 /* Probably needs to be more flexible, but I don't yet */
592 /* fully understand how flexible. */
594 /* Linux threads don't interact well with the read() wrapper.
595 Not defining MPROTECT_VDB fixes this. */
596 /* # define MPROTECT_VDB*/
597 # ifdef __ELF__
598 # define DYNAMIC_LOADING
599 # ifdef UNDEFINED /* includes ro data */
600 extern int _etext;
601 # define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
602 # endif
603 # include <linux/version.h>
604 # include <features.h>
605 # if LINUX_VERSION_CODE >= 0x20000 && defined(__GLIBC__) && __GLIBC__ >= 2
606 extern int __data_start;
607 # define DATASTART ((ptr_t)(&__data_start))
608 # else
609 extern char **__environ;
610 # define DATASTART ((ptr_t)(&__environ))
611 /* hideous kludge: __environ is the first */
612 /* word in crt0.o, and delimits the start */
613 /* of the data segment, no matter which */
614 /* ld options were passed through. */
615 /* We could use _etext instead, but that */
616 /* would include .rodata, which may */
617 /* contain large read-only data tables */
618 /* that we'd rather not scan. */
619 # endif
620 extern int _end;
621 # define DATAEND (&_end)
622 # else
623 extern int etext;
624 # define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
625 # endif
626 # endif
627 # ifdef CYGWIN32
628 extern int _data_start__;
629 extern int _data_end__;
630 extern int _bss_start__;
631 extern int _bss_end__;
632 /* For binutils 2.9.1, we have */
633 /* DATASTART = _data_start__ */
634 /* DATAEND = _bss_end__ */
635 /* whereas for some earlier versions it was */
636 /* DATASTART = _bss_start__ */
637 /* DATAEND = _data_end__ */
638 /* To get it right for both, we take the */
639 /* minumum/maximum of the two. */
640 # define MAX(x,y) ((x) > (y) ? (x) : (y))
641 # define MIN(x,y) ((x) < (y) ? (x) : (y))
642 # define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))
643 # define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__))
644 # undef STACK_GRAN
645 # define STACK_GRAN 0x10000
646 # define HEURISTIC1
647 # endif
648 # ifdef OS2
649 # define OS_TYPE "OS2"
650 /* STACKBOTTOM and DATASTART are handled specially in */
651 /* os_dep.c. OS2 actually has the right */
652 /* system call! */
653 # define DATAEND /* not needed */
654 # endif
655 # ifdef MSWIN32
656 # define OS_TYPE "MSWIN32"
657 /* STACKBOTTOM and DATASTART are handled specially in */
658 /* os_dep.c. */
659 # ifndef __WATCOMC__
660 # define MPROTECT_VDB
661 # endif
662 # define DATAEND /* not needed */
663 # endif
664 # ifdef DJGPP
665 # define OS_TYPE "DJGPP"
666 # include "stubinfo.h"
667 extern int etext;
668 extern int _stklen;
669 # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
670 # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
671 + _stklen))
672 /* This may not be right. */
673 # endif
674 # ifdef FREEBSD
675 # define OS_TYPE "FREEBSD"
676 # define MPROTECT_VDB
677 # endif
678 # ifdef NETBSD
679 # define OS_TYPE "NETBSD"
680 # endif
681 # ifdef THREE86BSD
682 # define OS_TYPE "THREE86BSD"
683 # endif
684 # ifdef BSDI
685 # define OS_TYPE "BSDI"
686 # endif
687 # if defined(FREEBSD) || defined(NETBSD) \
688 || defined(THREE86BSD) || defined(BSDI)
689 # define HEURISTIC2
690 extern char etext;
691 # define DATASTART ((ptr_t)(&etext))
692 # endif
693 # ifdef NEXT
694 # define OS_TYPE "NEXT"
695 # define DATASTART ((ptr_t) get_etext())
696 # define STACKBOTTOM ((ptr_t)0xc0000000)
697 # define DATAEND /* not needed */
698 # endif
699 # ifdef DOS4GW
700 # define OS_TYPE "DOS4GW"
701 /* Get_DATASTART, Get_DATAEND, Get_STACKBOTTOM
702 * Defined in gc-watcom.asm
704 extern char* Get_DATASTART (void);
705 extern char* Get_DATAEND (void);
706 extern char* Get_STACKBOTTOM (void);
707 # pragma aux Get_DATASTART "*" value [eax];
708 # pragma aux Get_DATAEND "*" value [eax];
709 # pragma aux Get_STACKBOTTOM "*" value [eax];
710 # define DATASTART ((ptr_t) Get_DATASTART())
711 # define STACKBOTTOM ((ptr_t) Get_STACKBOTTOM())
712 # define DATAEND ((ptr_t) Get_DATAEND())
713 # endif
714 # endif
716 # ifdef NS32K
717 # define MACH_TYPE "NS32K"
718 # define ALIGNMENT 4
719 extern char **environ;
720 # define DATASTART ((ptr_t)(&environ))
721 /* hideous kludge: environ is the first */
722 /* word in crt0.o, and delimits the start */
723 /* of the data segment, no matter which */
724 /* ld options were passed through. */
725 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
726 # endif
728 # ifdef MIPS
729 # ifndef ECOS
730 # define MACH_TYPE "MIPS"
731 /* CYGNUS LOCAL: respect predefined DATASTART_IS_ETEXT. */
732 # ifdef DATASTART_IS_ETEXT
733 extern int _etext;
734 # define DATASTART ((ptr_t)(&_etext))
735 # else
736 # ifndef IRIX5
737 # define DATASTART (ptr_t)0x10000000
738 /* Could probably be slightly higher since */
739 /* startup code allocates lots of stuff. */
740 # else
741 extern int _fdata;
742 # define DATASTART ((ptr_t)(&_fdata))
743 # ifdef USE_MMAP
744 # define HEAP_START (ptr_t)0x30000000
745 # else
746 # define HEAP_START DATASTART
747 # endif
748 /* Lowest plausible heap address. */
749 /* In the MMAP case, we map there. */
750 /* In either case it is used to identify */
751 /* heap sections so they're not */
752 /* considered as roots. */
753 # endif /* IRIX5 */
754 # endif /* DATASTART_IS_ETEXT */
755 # define HEURISTIC2
756 /* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
757 # ifdef ULTRIX
758 # define OS_TYPE "ULTRIX"
759 # define ALIGNMENT 4
760 # endif
761 # ifdef RISCOS
762 # define OS_TYPE "RISCOS"
763 # define ALIGNMENT 4 /* Required by hardware */
764 # endif
765 # ifdef IRIX5
766 # define OS_TYPE "IRIX5"
767 # define MPROTECT_VDB
768 # ifdef _MIPS_SZPTR
769 # define CPP_WORDSZ _MIPS_SZPTR
770 # define ALIGNMENT (_MIPS_SZPTR/8)
771 # if CPP_WORDSZ != 64
772 # define ALIGN_DOUBLE
773 # endif
774 # else
775 # define ALIGNMENT 4
776 # define ALIGN_DOUBLE
777 # endif
778 # define DYNAMIC_LOADING
779 # endif
780 # endif /* ECOS */
781 # ifdef ECOS
782 extern char __ram_data_start;
783 extern char __ram_data_end;
784 # define MACH_TYPE "MIPS"
785 # define DATASTART (ptr_t)(&__ram_data_start)
786 # define DATAEND (ptr_t)(&__ram_data_end)
788 # define HEURISTIC2
789 # define ALIGNMENT 4
790 # define ALIGN_DOUBLE
791 # endif /* ECOS */
792 # endif
794 # ifdef RS6000
795 # define MACH_TYPE "RS6000"
796 # define ALIGNMENT 4
797 # define DATASTART ((ptr_t)0x20000000)
798 extern int errno;
799 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
800 # define DYNAMIC_LOADING
801 /* For really old versions of AIX, this may have to be removed. */
802 # endif
804 # ifdef HP_PA
805 # define MACH_TYPE "HP_PA"
806 # define ALIGNMENT 4
807 # define ALIGN_DOUBLE
808 extern int __data_start;
809 # define DATASTART ((ptr_t)(&__data_start))
810 # if 0
811 /* The following appears to work for 7xx systems running HP/UX */
812 /* 9.xx Furthermore, it might result in much faster */
813 /* collections than HEURISTIC2, which may involve scanning */
814 /* segments that directly precede the stack. It is not the */
815 /* default, since it may not work on older machine/OS */
816 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
817 /* this.) */
818 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
819 # else
820 # define HEURISTIC2
821 # endif
822 # define STACK_GROWS_UP
823 # define DYNAMIC_LOADING
824 # include <unistd.h>
825 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
826 /* They misspelled the Posix macro? */
827 # endif
829 # ifdef ALPHA
830 # define MACH_TYPE "ALPHA"
831 # define ALIGNMENT 8
832 # ifdef OSF1
833 # define OS_TYPE "OSF1"
834 # define DATASTART ((ptr_t) 0x140000000)
835 # define HEURISTIC2
836 /* Normally HEURISTIC2 is too conervative, since */
837 /* the text segment immediately follows the stack. */
838 /* Hence we give an upper pound. */
839 extern int __start;
840 # define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
841 # define CPP_WORDSZ 64
842 # define MPROTECT_VDB
843 # define DYNAMIC_LOADING
844 # endif
845 # ifdef LINUX
846 # define OS_TYPE "LINUX"
847 # define CPP_WORDSZ 64
848 # define STACKBOTTOM ((ptr_t) 0x120000000)
849 # ifdef __ELF__
850 # define DATASTART GC_data_start
851 # define USE_PROC
852 # define DYNAMIC_LOADING
853 # else
854 # define DATASTART ((ptr_t) 0x140000000)
855 # endif
856 extern int _end;
857 # define DATAEND (&_end)
858 /* As of 1.3.90, I couldn't find a way to retrieve the correct */
859 /* fault address from a signal handler. */
860 /* Hence MPROTECT_VDB is broken. */
861 # endif
862 # endif
864 # ifdef M88K
865 # define MACH_TYPE "M88K"
866 # define ALIGNMENT 4
867 # define ALIGN_DOUBLE
868 extern int etext;
869 # ifdef CX_UX
870 # define OS_TYPE "CX_UX"
871 # define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
872 # endif
873 # ifdef DGUX
874 # define OS_TYPE "DGUX"
875 extern char * GC_SysVGetDataStart();
876 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
877 # endif
878 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
879 # endif
881 # ifdef S370
882 # define MACH_TYPE "S370"
883 # define OS_TYPE "UTS4"
884 # define ALIGNMENT 4 /* Required by hardware */
885 extern int etext;
886 extern int _etext;
887 extern int _end;
888 extern char * GC_SysVGetDataStart();
889 # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
890 # define DATAEND (&_end)
891 # define HEURISTIC2
892 # endif
894 # ifndef STACK_GROWS_UP
895 # define STACK_GROWS_DOWN
896 # endif
898 # ifndef CPP_WORDSZ
899 # define CPP_WORDSZ 32
900 # endif
902 # ifndef OS_TYPE
903 # define OS_TYPE ""
904 # endif
906 # ifndef DATAEND
907 extern int end;
908 # define DATAEND (&end)
909 # endif
911 # if defined(SVR4) && !defined(GETPAGESIZE)
912 # include <unistd.h>
913 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
914 # endif
916 # ifndef GETPAGESIZE
917 # if defined(SUNOS5) || defined(IRIX5)
918 # include <unistd.h>
919 # endif
920 # define GETPAGESIZE() getpagesize()
921 # endif
923 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
924 /* OS has SVR4 generic features. Probably others also qualify. */
925 # define SVR4
926 # endif
928 # if defined(SUNOS5) || defined(DRSNX)
929 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
930 /* loader. */
931 # define SUNOS5DL
932 /* OS has SUNOS5 style signal handlers. */
933 # define SUNOS5SIGS
934 # endif
936 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
937 -> bad word size
938 # endif
940 # ifdef PCR
941 # undef DYNAMIC_LOADING
942 # undef STACKBOTTOM
943 # undef HEURISTIC1
944 # undef HEURISTIC2
945 # undef PROC_VDB
946 # undef MPROTECT_VDB
947 # define PCR_VDB
948 # endif
950 # ifdef SRC_M3
951 /* Postponed for now. */
952 # undef PROC_VDB
953 # undef MPROTECT_VDB
954 # endif
956 # ifdef SMALL_CONFIG
957 /* Presumably not worth the space it takes. */
958 # undef PROC_VDB
959 # undef MPROTECT_VDB
960 # endif
962 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
963 # define DEFAULT_VDB
964 # endif
966 # if defined(IRIX_THREADS) && !defined(IRIX5)
967 --> inconsistent configuration
968 # endif
969 # if defined(LINUX_THREADS) && !defined(LINUX)
970 --> inconsistent configuration
971 # endif
972 # if defined(SOLARIS_THREADS) && !defined(SUNOS5)
973 --> inconsistent configuration
974 # endif
975 # if defined(PCR) || defined(SRC_M3) || \
976 defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
977 defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
978 defined(QUICK_THREADS)
979 # define THREADS
980 # endif
982 # if defined(SPARC)
983 # define SAVE_CALL_CHAIN
984 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
985 /* include assembly code to do it well. */
986 # endif
988 # endif