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