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