Reverting merge from trunk
[official-gcc.git] / boehm-gc / include / private / gcconfig.h
blob475bb2c191adae72ac0e6babd120a7873882fa58
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-2004 Hewlett-Packard Development Company, L.P.
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.
18 * This header is private to the gc. It is almost always included from
19 * gc_priv.h. However it is possible to include it by itself if just the
20 * configuration macros are needed. In that
21 * case, a few declarations relying on types declared in gc_priv.h will be
22 * omitted.
25 #ifndef GCCONFIG_H
27 # define GCCONFIG_H
29 # ifndef GC_PRIVATE_H
30 /* Fake ptr_t declaration, just to avoid compilation errors. */
31 /* This avoids many instances if "ifndef GC_PRIVATE_H" below. */
32 typedef struct GC_undefined_struct * ptr_t;
33 # endif
35 /* Machine dependent parameters. Some tuning parameters can be found */
36 /* near the top of gc_private.h. */
38 /* Machine specific parts contributed by various people. See README file. */
40 /* First a unified test for Linux: */
41 # if defined(linux) || defined(__linux__)
42 # ifndef LINUX
43 # define LINUX
44 # endif
45 # endif
47 /* And one for NetBSD: */
48 # if defined(__NetBSD__)
49 # define NETBSD
50 # endif
52 /* And one for OpenBSD: */
53 # if defined(__OpenBSD__)
54 # define OPENBSD
55 # endif
57 /* And one for FreeBSD: */
58 # if ( defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ) && !defined(FREEBSD)
59 # define FREEBSD
60 # endif
62 /* Determine the machine type: */
63 #if defined(__aarch64__)
64 # define AARCH64
65 # if !defined(LINUX)
66 # define NOSYS
67 # define mach_type_known
68 # endif
69 # endif
70 # if defined(__arm__) || defined(__thumb__)
71 # define ARM32
72 # if !defined(LINUX) && !defined(NETBSD)
73 # define NOSYS
74 # define mach_type_known
75 # endif
76 # endif
77 # if defined(sun) && defined(mc68000)
78 # define M68K
79 # define SUNOS4
80 # define mach_type_known
81 # endif
82 # if defined(hp9000s300)
83 # define M68K
84 # define HP
85 # define mach_type_known
86 # endif
87 # if defined(OPENBSD) && defined(m68k)
88 # define M68K
89 # define mach_type_known
90 # endif
91 # if defined(OPENBSD) && defined(__sparc__)
92 # define SPARC
93 # define mach_type_known
94 # endif
95 # if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
96 # define M68K
97 # define mach_type_known
98 # endif
99 # if defined(NETBSD) && defined(__powerpc__)
100 # define POWERPC
101 # define mach_type_known
102 # endif
103 # if defined(NETBSD) && (defined(__arm32__) || defined(__arm__))
104 # define ARM32
105 # define mach_type_known
106 # endif
107 # if defined(NETBSD) && defined(__sh__)
108 # define SH
109 # define mach_type_known
110 # endif
111 # if defined(vax)
112 # define VAX
113 # ifdef ultrix
114 # define ULTRIX
115 # else
116 # define BSD
117 # endif
118 # define mach_type_known
119 # endif
120 # if defined(__NetBSD__) && defined(__vax__)
121 # define VAX
122 # define mach_type_known
123 # endif
124 # if defined(mips) || defined(__mips) || defined(_mips)
125 # define MIPS
126 # if defined(nec_ews) || defined(_nec_ews)
127 # define EWS4800
128 # endif
129 # if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
130 # if defined(ultrix) || defined(__ultrix)
131 # define ULTRIX
132 # else
133 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
134 || defined(__SYSTYPE_SVR4__)
135 # define IRIX5 /* or IRIX 6.X */
136 # else
137 # define RISCOS /* or IRIX 4.X */
138 # endif
139 # endif
140 # endif /* !LINUX */
141 # if defined(__NetBSD__) && defined(__MIPSEL__)
142 # undef ULTRIX
143 # endif
144 # define mach_type_known
145 # endif
146 # if defined(DGUX) && (defined(i386) || defined(__i386__))
147 # define I386
148 # ifndef _USING_DGUX
149 # define _USING_DGUX
150 # endif
151 # define mach_type_known
152 # endif
153 # if defined(sequent) && (defined(i386) || defined(__i386__))
154 # define I386
155 # define SEQUENT
156 # define mach_type_known
157 # endif
158 # if defined(sun) && (defined(i386) || defined(__i386__))
159 # define I386
160 # define SUNOS5
161 # define mach_type_known
162 # endif
163 # if defined(sun) && defined(__amd64)
164 # define X86_64
165 # define SUNOS5
166 # define mach_type_known
167 # endif
168 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
169 # define I386
170 # define OS2
171 # define mach_type_known
172 # endif
173 # if defined(ibm032)
174 # define RT
175 # define mach_type_known
176 # endif
177 # if defined(sun) && (defined(sparc) || defined(__sparc))
178 # define SPARC
179 /* Test for SunOS 5.x */
180 # include <errno.h>
181 # ifdef ECHRNG
182 # define SUNOS5
183 # else
184 # define SUNOS4
185 # endif
186 # define mach_type_known
187 # endif
188 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
189 && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
190 # define SPARC
191 # define DRSNX
192 # define mach_type_known
193 # endif
194 # if defined(_IBMR2)
195 # define RS6000
196 # define mach_type_known
197 # endif
198 # if defined(__NetBSD__) && defined(__sparc__)
199 # define SPARC
200 # define mach_type_known
201 # endif
202 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
203 /* The above test may need refinement */
204 # define I386
205 # if defined(_SCO_ELF)
206 # define SCO_ELF
207 # else
208 # define SCO
209 # endif
210 # define mach_type_known
211 # endif
212 # if defined(_AUX_SOURCE)
213 # define M68K
214 # define SYSV
215 # define mach_type_known
216 # endif
217 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
218 || defined(hppa) || defined(__hppa__)
219 # define HP_PA
220 # if !defined(LINUX) && !defined(HPUX)
221 # define HPUX
222 # endif
223 # define mach_type_known
224 # endif
225 # if defined(__ia64) && defined(_HPUX_SOURCE)
226 # define IA64
227 # ifndef HPUX
228 # define HPUX
229 # endif
230 # define mach_type_known
231 # endif
232 # if defined(__BEOS__) && defined(_X86_)
233 # define I386
234 # define BEOS
235 # define mach_type_known
236 # endif
237 # if defined(LINUX) && (defined(i386) || defined(__i386__))
238 # define I386
239 # define mach_type_known
240 # endif
241 # if defined(LINUX) && defined(__x86_64__)
242 # define X86_64
243 # define mach_type_known
244 # endif
245 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
246 # define IA64
247 # define mach_type_known
248 # endif
249 # if defined(LINUX) && defined(__aarch64__)
250 # define AARCH64
251 # define mach_type_known
252 # endif
253 # if defined(LINUX) && defined(__arm__)
254 # define ARM32
255 # define mach_type_known
256 # endif
257 # if defined(LINUX) && defined(__cris__)
258 # ifndef CRIS
259 # define CRIS
260 # endif
261 # define mach_type_known
262 # endif
263 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \
264 defined(powerpc64) || defined(__powerpc64__))
265 # define POWERPC
266 # define mach_type_known
267 # endif
268 # if defined(FREEBSD) && (defined(powerpc) || defined(__powerpc__))
269 # define POWERPC
270 # define mach_type_known
271 # endif
272 # if defined(LINUX) && defined(__mc68000__)
273 # define M68K
274 # define mach_type_known
275 # endif
276 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
277 # define SPARC
278 # define mach_type_known
279 # endif
280 # if defined(LINUX) && defined(__arm__)
281 # define ARM32
282 # define mach_type_known
283 # endif
284 # if defined(LINUX) && defined(__sh__)
285 # define SH
286 # define mach_type_known
287 # endif
288 # if defined(LINUX) && defined(__m32r__)
289 # define M32R
290 # define mach_type_known
291 # endif
292 # if defined(__alpha) || defined(__alpha__)
293 # define ALPHA
294 # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
295 # define OSF1 /* a.k.a Digital Unix */
296 # endif
297 # define mach_type_known
298 # endif
299 # if defined(_AMIGA) && !defined(AMIGA)
300 # define AMIGA
301 # endif
302 # ifdef AMIGA
303 # define M68K
304 # define mach_type_known
305 # endif
306 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
307 # define M68K
308 # define MACOS
309 # define mach_type_known
310 # endif
311 # if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__)
312 # define POWERPC
313 # define MACOS
314 # define mach_type_known
315 # endif
316 # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
317 # define DARWIN
318 # if defined(__ppc__) || defined(__ppc64__)
319 # define POWERPC
320 # define mach_type_known
321 # elif defined(__x86_64__)
322 # define X86_64
323 # define mach_type_known
324 # elif defined(__i386__)
325 # define I386
326 # define mach_type_known
327 # endif
328 # endif
329 # if defined(NeXT) && defined(mc68000)
330 # define M68K
331 # define NEXT
332 # define mach_type_known
333 # endif
334 # if defined(NeXT) && (defined(i386) || defined(__i386__))
335 # define I386
336 # define NEXT
337 # define mach_type_known
338 # endif
339 # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
340 # define I386
341 # define OPENBSD
342 # define mach_type_known
343 # endif
344 # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
345 # define I386
346 # define mach_type_known
347 # endif
348 # if defined(FREEBSD) && defined(__x86_64__)
349 # define X86_64
350 # define mach_type_known
351 # endif
352 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
353 # define I386
354 # define mach_type_known
355 # endif
356 # if defined(__NetBSD__) && defined(__x86_64__)
357 # define X86_64
358 # define mach_type_known
359 # endif
360 # if defined(FREEBSD) && defined(__sparc__)
361 # define SPARC
362 # define mach_type_known
363 #endif
364 # if defined(bsdi) && (defined(i386) || defined(__i386__))
365 # define I386
366 # define BSDI
367 # define mach_type_known
368 # endif
369 # if !defined(mach_type_known) && defined(__386BSD__)
370 # define I386
371 # define THREE86BSD
372 # define mach_type_known
373 # endif
374 # if defined(_CX_UX) && defined(_M88K)
375 # define M88K
376 # define CX_UX
377 # define mach_type_known
378 # endif
379 # if defined(DGUX) && defined(m88k)
380 # define M88K
381 /* DGUX defined */
382 # define mach_type_known
383 # endif
384 # if defined(_WIN32_WCE)
385 /* SH3, SH4, MIPS already defined for corresponding architectures */
386 # if defined(SH3) || defined(SH4)
387 # define SH
388 # endif
389 # if defined(x86)
390 # define I386
391 # endif
392 # if defined(ARM)
393 # define ARM32
394 # endif
395 # define MSWINCE
396 # define mach_type_known
397 # else
398 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
399 || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
400 # define I386
401 # define MSWIN32 /* or Win32s */
402 # define mach_type_known
403 # endif
404 # if defined(_MSC_VER) && defined(_M_IA64)
405 # define IA64
406 # define MSWIN32 /* Really win64, but we don't treat 64-bit */
407 /* variants as a differnt platform. */
408 # endif
409 # endif
410 # if defined(__DJGPP__)
411 # define I386
412 # ifndef DJGPP
413 # define DJGPP /* MSDOS running the DJGPP port of GCC */
414 # endif
415 # define mach_type_known
416 # endif
417 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
418 # define I386
419 # define CYGWIN32
420 # define mach_type_known
421 # endif
422 # if defined(__MINGW32__)
423 # define I386
424 # define MSWIN32
425 # define mach_type_known
426 # endif
427 # if defined(__BORLANDC__)
428 # define I386
429 # define MSWIN32
430 # define mach_type_known
431 # endif
432 # if defined(_UTS) && !defined(mach_type_known)
433 # define S370
434 # define UTS4
435 # define mach_type_known
436 # endif
437 # if defined(__pj__)
438 # define PJ
439 # define mach_type_known
440 # endif
441 # if defined(__embedded__) && defined(PPC)
442 # define POWERPC
443 # define NOSYS
444 # define mach_type_known
445 # endif
446 /* Ivan Demakov */
447 # if defined(__WATCOMC__) && defined(__386__)
448 # define I386
449 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
450 # if defined(__OS2__)
451 # define OS2
452 # else
453 # if defined(__WINDOWS_386__) || defined(__NT__)
454 # define MSWIN32
455 # else
456 # define DOS4GW
457 # endif
458 # endif
459 # endif
460 # define mach_type_known
461 # endif
462 # if defined(__s390__) && defined(LINUX)
463 # define S390
464 # define mach_type_known
465 # endif
466 # if defined(__GNU__)
467 # if defined(__i386__)
468 /* The Debian Hurd running on generic PC */
469 # define HURD
470 # define I386
471 # define mach_type_known
472 # endif
473 # endif
475 /* Feel free to add more clauses here */
477 /* Or manually define the machine type here. A machine type is */
478 /* characterized by the architecture. Some */
479 /* machine types are further subdivided by OS. */
480 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
481 /* Note that SGI IRIX is treated identically to RISCOS. */
482 /* SYSV on an M68K actually means A/UX. */
483 /* The distinction in these cases is usually the stack starting address */
484 # ifndef mach_type_known
485 --> unknown machine type
486 # endif
487 /* Mapping is: M68K ==> Motorola 680X0 */
488 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
489 /* MACOS and AMIGA variants) */
490 /* I386 ==> Intel 386 */
491 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
492 /* FREEBSD, THREE86BSD, MSWIN32, */
493 /* BSDI,SUNOS5, NEXT, other variants) */
494 /* NS32K ==> Encore Multimax */
495 /* MIPS ==> R2000 or R3000 */
496 /* (RISCOS, ULTRIX variants) */
497 /* VAX ==> DEC VAX */
498 /* (BSD, ULTRIX variants) */
499 /* RS6000 ==> IBM RS/6000 AIX3.X */
500 /* RT ==> IBM PC/RT */
501 /* HP_PA ==> HP9000/700 & /800 */
502 /* HP/UX, LINUX */
503 /* SPARC ==> SPARC v7/v8/v9 */
504 /* (SUNOS4, SUNOS5, LINUX, */
505 /* DRSNX variants) */
506 /* ALPHA ==> DEC Alpha */
507 /* (OSF1 and LINUX variants) */
508 /* M88K ==> Motorola 88XX0 */
509 /* (CX_UX and DGUX) */
510 /* S370 ==> 370-like machine */
511 /* running Amdahl UTS4 */
512 /* S390 ==> 390-like machine */
513 /* running LINUX */
514 /* AARCH64 ==> ARM AArch64 */
515 /* ARM32 ==> Intel StrongARM */
516 /* IA64 ==> Intel IPF */
517 /* (e.g. Itanium) */
518 /* (LINUX and HPUX) */
519 /* SH ==> Hitachi SuperH */
520 /* (LINUX & MSWINCE) */
521 /* X86_64 ==> AMD x86-64 */
522 /* POWERPC ==> IBM/Apple PowerPC */
523 /* (MACOS(<=9),DARWIN(incl.MACOSX),*/
524 /* LINUX, NETBSD, NOSYS variants) */
525 /* Handles 32 and 64-bit variants. */
526 /* AIX should be handled here, but */
527 /* that's called an RS6000. */
528 /* CRIS ==> Axis Etrax */
529 /* M32R ==> Renesas M32R */
533 * For each architecture and OS, the following need to be defined:
535 * CPP_WORDSZ is a simple integer constant representing the word size.
536 * in bits. We assume byte addressibility, where a byte has 8 bits.
537 * We also assume CPP_WORDSZ is either 32 or 64.
538 * (We care about the length of pointers, not hardware
539 * bus widths. Thus a 64 bit processor with a C compiler that uses
540 * 32 bit pointers should use CPP_WORDSZ of 32, not 64. Default is 32.)
542 * MACH_TYPE is a string representation of the machine type.
543 * OS_TYPE is analogous for the OS.
545 * ALIGNMENT is the largest N, such that
546 * all pointer are guaranteed to be aligned on N byte boundaries.
547 * defining it to be 1 will always work, but perform poorly.
549 * DATASTART is the beginning of the data segment.
550 * On some platforms SEARCH_FOR_DATA_START is defined.
551 * SEARCH_FOR_DATASTART will cause GC_data_start to
552 * be set to an address determined by accessing data backwards from _end
553 * until an unmapped page is found. DATASTART will be defined to be
554 * GC_data_start.
555 * On UNIX-like systems, the collector will scan the area between DATASTART
556 * and DATAEND for root pointers.
558 * DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
559 * RTH suggests gaining access to linker script synth'd values with
560 * this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
561 * Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g.,
562 * cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-*
563 * without any special options.
565 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
566 * the pointer size.
568 * STACKBOTTOM is the cool end of the stack, which is usually the
569 * highest address in the stack.
570 * Under PCR or OS/2, we have other ways of finding thread stacks.
571 * For each machine, the following should:
572 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
573 * 2) define exactly one of
574 * STACKBOTTOM (should be defined to be an expression)
575 * LINUX_STACKBOTTOM
576 * HEURISTIC1
577 * HEURISTIC2
578 * If STACKBOTTOM is defined, then it's value will be used directly as the
579 * stack base. If LINUX_STACKBOTTOM is defined, then it will be determined
580 * with a method appropriate for most Linux systems. Currently we look
581 * first for __libc_stack_end, and if that fails read it from /proc.
582 * If either of the last two macros are defined, then STACKBOTTOM is computed
583 * during collector startup using one of the following two heuristics:
584 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
585 * the next multiple of STACK_GRAN.
586 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
587 * in small steps (decrement if STACK_GROWS_UP), and read the value
588 * at each location. Remember the value when the first
589 * Segmentation violation or Bus error is signalled. Round that
590 * to the nearest plausible page boundary, and use that instead
591 * of STACKBOTTOM.
593 * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
594 * the value of environ is a pointer that can serve as STACKBOTTOM.
595 * I expect that HEURISTIC2 can be replaced by this approach, which
596 * interferes far less with debugging. However it has the disadvantage
597 * that it's confused by a putenv call before the collector is initialized.
598 * This could be dealt with by intercepting putenv ...
600 * If no expression for STACKBOTTOM can be found, and neither of the above
601 * heuristics are usable, the collector can still be used with all of the above
602 * undefined, provided one of the following is done:
603 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
604 * without reference to STACKBOTTOM. This is appropriate for use in
605 * conjunction with thread packages, since there will be multiple stacks.
606 * (Allocating thread stacks in the heap, and treating them as ordinary
607 * heap data objects is also possible as a last resort. However, this is
608 * likely to introduce significant amounts of excess storage retention
609 * unless the dead parts of the thread stacks are periodically cleared.)
610 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
611 * If the author of the client code controls the main program, this is
612 * easily accomplished by introducing a new main program, setting
613 * GC_stackbottom to the address of a local variable, and then calling
614 * the original main program. The new main program would read something
615 * like:
617 * # include "gc_private.h"
619 * main(argc, argv, envp)
620 * int argc;
621 * char **argv, **envp;
623 * int dummy;
625 * GC_stackbottom = (ptr_t)(&dummy);
626 * return(real_main(argc, argv, envp));
630 * Each architecture may also define the style of virtual dirty bit
631 * implementation to be used:
632 * MPROTECT_VDB: Write protect the heap and catch faults.
633 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
635 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
636 * defined GC_register_dynamic_libraries() for the architecture.
638 * An architecture may define PREFETCH(x) to preload the cache with *x.
639 * This defaults to a no-op.
641 * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
643 * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
644 * clear the two words at GC_malloc-aligned address x. By default,
645 * word stores of 0 are used instead.
647 * HEAP_START may be defined as the initial address hint for mmap-based
648 * allocation.
651 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
652 * to push the relevant registers onto the stack. This generally makes
653 * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
655 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
656 (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
657 && !defined(__INTEL_COMPILER) \
658 && !defined(__PATHCC__)
659 # define HAVE_BUILTIN_UNWIND_INIT
660 # endif
662 # define STACK_GRAN 0x1000000
663 # ifdef M68K
664 # define MACH_TYPE "M68K"
665 # define ALIGNMENT 2
666 # ifdef OPENBSD
667 # define OS_TYPE "OPENBSD"
668 # define HEURISTIC2
669 # ifdef __ELF__
670 # define DATASTART GC_data_start
671 # define DYNAMIC_LOADING
672 # else
673 extern char etext[];
674 # define DATASTART ((ptr_t)(etext))
675 # endif
676 # define USE_GENERIC_PUSH_REGS
677 # endif
678 # ifdef NETBSD
679 # define OS_TYPE "NETBSD"
680 # define HEURISTIC2
681 # ifdef __ELF__
682 # define DATASTART GC_data_start
683 # define DYNAMIC_LOADING
684 # else
685 extern char etext[];
686 # define DATASTART ((ptr_t)(etext))
687 # endif
688 # define USE_GENERIC_PUSH_REGS
689 # endif
690 # ifdef LINUX
691 # define OS_TYPE "LINUX"
692 # define LINUX_STACKBOTTOM
693 # define USE_GENERIC_PUSH_REGS
694 /* We never got around to the assembly version. */
695 # define MPROTECT_VDB
696 # ifdef __ELF__
697 # define DYNAMIC_LOADING
698 # include <features.h>
699 # if defined(__GLIBC__)&& __GLIBC__>=2
700 # define SEARCH_FOR_DATA_START
701 # else /* !GLIBC2 */
702 extern char **__environ;
703 # define DATASTART ((ptr_t)(&__environ))
704 /* hideous kludge: __environ is the first */
705 /* word in crt0.o, and delimits the start */
706 /* of the data segment, no matter which */
707 /* ld options were passed through. */
708 /* We could use _etext instead, but that */
709 /* would include .rodata, which may */
710 /* contain large read-only data tables */
711 /* that we'd rather not scan. */
712 # endif /* !GLIBC2 */
713 extern int _end[];
714 # define DATAEND (_end)
715 # else
716 extern int etext[];
717 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
718 # endif
719 # endif
720 # ifdef SUNOS4
721 # define OS_TYPE "SUNOS4"
722 extern char etext[];
723 # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ffff) & ~0x1ffff))
724 # define HEURISTIC1 /* differs */
725 # define DYNAMIC_LOADING
726 # endif
727 # ifdef HP
728 # define OS_TYPE "HP"
729 extern char etext[];
730 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
731 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
732 /* empirically determined. seems to work. */
733 # include <unistd.h>
734 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
735 # endif
736 # ifdef SYSV
737 # define OS_TYPE "SYSV"
738 extern etext[];
739 # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
740 & ~0x3fffff) \
741 +((word)etext & 0x1fff))
742 /* This only works for shared-text binaries with magic number 0413.
743 The other sorts of SysV binaries put the data at the end of the text,
744 in which case the default of etext would work. Unfortunately,
745 handling both would require having the magic-number available.
746 -- Parag
748 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
749 /* The stack starts at the top of memory, but */
750 /* 0x0 cannot be used as setjump_test complains */
751 /* that the stack direction is incorrect. Two */
752 /* bytes down from 0x0 should be safe enough. */
753 /* --Parag */
754 # include <sys/mmu.h>
755 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
756 # endif
757 # ifdef AMIGA
758 # define OS_TYPE "AMIGA"
759 /* STACKBOTTOM and DATASTART handled specially */
760 /* in os_dep.c */
761 # define DATAEND /* not needed */
762 # define GETPAGESIZE() 4096
763 # endif
764 # ifdef MACOS
765 # ifndef __LOWMEM__
766 # include <LowMem.h>
767 # endif
768 # define OS_TYPE "MACOS"
769 /* see os_dep.c for details of global data segments. */
770 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
771 # define DATAEND /* not needed */
772 # define GETPAGESIZE() 4096
773 # endif
774 # ifdef NEXT
775 # define OS_TYPE "NEXT"
776 # define DATASTART ((ptr_t) get_etext())
777 # define STACKBOTTOM ((ptr_t) 0x4000000)
778 # define DATAEND /* not needed */
779 # endif
780 # endif
782 # if defined(POWERPC)
783 # define MACH_TYPE "POWERPC"
784 # ifdef MACOS
785 # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
786 # ifndef __LOWMEM__
787 # include <LowMem.h>
788 # endif
789 # define OS_TYPE "MACOS"
790 /* see os_dep.c for details of global data segments. */
791 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
792 # define DATAEND /* not needed */
793 # endif
794 # ifdef LINUX
795 # if defined(__powerpc64__)
796 # define ALIGNMENT 8
797 # define CPP_WORDSZ 64
798 # ifndef HBLKSIZE
799 # define HBLKSIZE 4096
800 # endif
801 # else
802 # define ALIGNMENT 4
803 # endif
804 # define OS_TYPE "LINUX"
805 /* HEURISTIC1 has been reliably reported to fail for a 32-bit */
806 /* executable on a 64 bit kernel. */
807 # define LINUX_STACKBOTTOM
808 # define DYNAMIC_LOADING
809 # define SEARCH_FOR_DATA_START
810 extern int _end[];
811 # define DATAEND (_end)
812 # endif
813 # ifdef DARWIN
814 # define OS_TYPE "DARWIN"
815 # define DYNAMIC_LOADING
816 # if defined(__ppc64__)
817 # define ALIGNMENT 8
818 # define CPP_WORDSZ 64
819 # define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
820 # define CACHE_LINE_SIZE 64
821 # ifndef HBLKSIZE
822 # define HBLKSIZE 4096
823 # endif
824 # else
825 # define ALIGNMENT 4
826 # define STACKBOTTOM ((ptr_t) 0xc0000000)
827 # endif
828 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
829 These aren't used when dyld support is enabled (it is by default) */
830 # define DATASTART ((ptr_t) get_etext())
831 # define DATAEND ((ptr_t) get_end())
832 # define USE_MMAP
833 # define USE_MMAP_ANON
834 # define USE_ASM_PUSH_REGS
835 # ifdef GC_DARWIN_THREADS
836 # define MPROTECT_VDB
837 # endif
838 # include <unistd.h>
839 # define GETPAGESIZE() getpagesize()
840 # if defined(USE_PPC_PREFETCH) && defined(__GNUC__)
841 /* The performance impact of prefetches is untested */
842 # define PREFETCH(x) \
843 __asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x)))
844 # define PREFETCH_FOR_WRITE(x) \
845 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
846 # endif
847 /* There seems to be some issues with trylock hanging on darwin. This
848 should be looked into some more */
849 # define NO_PTHREAD_TRYLOCK
850 # endif
851 # ifdef FREEBSD
852 # define ALIGNMENT 4
853 # define OS_TYPE "FREEBSD"
854 # ifndef GC_FREEBSD_THREADS
855 # define MPROTECT_VDB
856 # endif
857 # define SIG_SUSPEND SIGUSR1
858 # define SIG_THR_RESTART SIGUSR2
859 # define FREEBSD_STACKBOTTOM
860 # ifdef __ELF__
861 # define DYNAMIC_LOADING
862 # endif
863 extern char etext[];
864 extern char * GC_FreeBSDGetDataStart();
865 # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
866 # endif
867 # ifdef NETBSD
868 # define ALIGNMENT 4
869 # define OS_TYPE "NETBSD"
870 # define HEURISTIC2
871 extern char etext[];
872 # define DATASTART GC_data_start
873 # define DYNAMIC_LOADING
874 # endif
875 # ifdef NOSYS
876 # define ALIGNMENT 4
877 # define OS_TYPE "NOSYS"
878 extern void __end[], __dso_handle[];
879 # define DATASTART (__dso_handle) /* OK, that's ugly. */
880 # define DATAEND (__end)
881 /* Stack starts at 0xE0000000 for the simulator. */
882 # undef STACK_GRAN
883 # define STACK_GRAN 0x10000000
884 # define HEURISTIC1
885 # endif
886 # endif
888 # ifdef VAX
889 # define MACH_TYPE "VAX"
890 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
891 extern char etext[];
892 # define DATASTART ((ptr_t)(etext))
893 # ifdef BSD
894 # define OS_TYPE "BSD"
895 # define HEURISTIC1
896 /* HEURISTIC2 may be OK, but it's hard to test. */
897 # endif
898 # ifdef ULTRIX
899 # define OS_TYPE "ULTRIX"
900 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
901 # endif
902 # endif
904 # ifdef RT
905 # define MACH_TYPE "RT"
906 # define ALIGNMENT 4
907 # define DATASTART ((ptr_t) 0x10000000)
908 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
909 # endif
911 # ifdef SPARC
912 # define MACH_TYPE "SPARC"
913 # if defined(__arch64__) || defined(__sparcv9)
914 # define ALIGNMENT 8
915 # define CPP_WORDSZ 64
916 # define ELF_CLASS ELFCLASS64
917 # else
918 # define ALIGNMENT 4 /* Required by hardware */
919 # define CPP_WORDSZ 32
920 # endif
921 # define ALIGN_DOUBLE
922 # ifdef SUNOS5
923 # define OS_TYPE "SUNOS5"
924 extern int _etext[];
925 extern int _end[];
926 extern ptr_t GC_SysVGetDataStart();
927 # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
928 # define DATAEND (_end)
929 # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
930 # define USE_MMAP
931 /* Otherwise we now use calloc. Mmap may result in the */
932 /* heap interleaved with thread stacks, which can result in */
933 /* excessive blacklisting. Sbrk is unusable since it */
934 /* doesn't interact correctly with the system malloc. */
935 # endif
936 # ifdef USE_MMAP
937 # define HEAP_START (ptr_t)0x40000000
938 # else
939 # define HEAP_START DATAEND
940 # endif
941 # define PROC_VDB
942 # define SOLARIS_STACKBOTTOM
943 # include <unistd.h>
944 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
945 /* getpagesize() appeared to be missing from at least one */
946 /* Solaris 5.4 installation. Weird. */
947 # define DYNAMIC_LOADING
948 # endif
949 # ifdef SUNOS4
950 # define OS_TYPE "SUNOS4"
951 /* [If you have a weak stomach, don't read this.] */
952 /* We would like to use: */
953 /* # define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */
954 /* This fails occasionally, due to an ancient, but very */
955 /* persistent ld bug. etext is set 32 bytes too high. */
956 /* We instead read the text segment size from the a.out */
957 /* header, which happens to be mapped into our address space */
958 /* at the start of the text segment. The detective work here */
959 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
960 /* Serpette of INRIA. */
961 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
962 # define TEXTSTART 0x2000
963 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
964 # define MPROTECT_VDB
965 # define HEURISTIC1
966 # define DYNAMIC_LOADING
967 # endif
968 # ifdef DRSNX
969 # define OS_TYPE "DRSNX"
970 extern ptr_t GC_SysVGetDataStart();
971 extern int etext[];
972 # define DATASTART GC_SysVGetDataStart(0x10000, etext)
973 # define MPROTECT_VDB
974 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
975 # define DYNAMIC_LOADING
976 # endif
977 # ifdef LINUX
978 # define OS_TYPE "LINUX"
979 # ifdef __ELF__
980 # define DYNAMIC_LOADING
981 # else
982 Linux Sparc/a.out not supported
983 # endif
984 extern int _end[];
985 extern int _etext[];
986 # define DATAEND (_end)
987 # define SVR4
988 extern ptr_t GC_SysVGetDataStart();
989 # ifdef __arch64__
990 # define DATASTART GC_SysVGetDataStart(0x100000, _etext)
991 # else
992 # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
993 # endif
994 # define LINUX_STACKBOTTOM
995 # endif
996 # ifdef OPENBSD
997 # define OS_TYPE "OPENBSD"
998 # define STACKBOTTOM ((ptr_t) 0xf8000000)
999 extern int etext[];
1000 # define DATASTART ((ptr_t)(etext))
1001 # endif
1002 # ifdef NETBSD
1003 # define OS_TYPE "NETBSD"
1004 # define HEURISTIC2
1005 # ifdef __ELF__
1006 # define DATASTART GC_data_start
1007 # define DYNAMIC_LOADING
1008 # else
1009 extern char etext[];
1010 # define DATASTART ((ptr_t)(etext))
1011 # endif
1012 # endif
1013 # ifdef FREEBSD
1014 # define OS_TYPE "FREEBSD"
1015 # define SIG_SUSPEND SIGUSR1
1016 # define SIG_THR_RESTART SIGUSR2
1017 # define FREEBSD_STACKBOTTOM
1018 # ifdef __ELF__
1019 # define DYNAMIC_LOADING
1020 # endif
1021 extern char etext[];
1022 extern char edata[];
1023 extern char end[];
1024 # define NEED_FIND_LIMIT
1025 # define DATASTART ((ptr_t)(&etext))
1026 # define DATAEND (GC_find_limit (DATASTART, TRUE))
1027 # define DATASTART2 ((ptr_t)(&edata))
1028 # define DATAEND2 ((ptr_t)(&end))
1029 # endif
1030 # endif
1032 # ifdef I386
1033 # define MACH_TYPE "I386"
1034 # if defined(__LP64__) || defined(_WIN64)
1035 # define CPP_WORDSZ 64
1036 # define ALIGNMENT 8
1037 # else
1038 # define CPP_WORDSZ 32
1039 # define ALIGNMENT 4
1040 /* Appears to hold for all "32 bit" compilers */
1041 /* except Borland. The -a4 option fixes */
1042 /* Borland. */
1043 /* Ivan Demakov: For Watcom the option is -zp4. */
1044 # endif
1045 # ifndef SMALL_CONFIG
1046 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
1047 /* improvement on Pentiums. */
1048 # endif
1049 # ifdef HAVE_BUILTIN_UNWIND_INIT
1050 # define USE_GENERIC_PUSH_REGS
1051 # endif
1052 # ifdef SEQUENT
1053 # define OS_TYPE "SEQUENT"
1054 extern int etext[];
1055 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1056 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
1057 # endif
1058 # ifdef BEOS
1059 # define OS_TYPE "BEOS"
1060 # include <OS.h>
1061 # define GETPAGESIZE() B_PAGE_SIZE
1062 extern int etext[];
1063 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1064 # endif
1065 # ifdef SUNOS5
1066 # define OS_TYPE "SUNOS5"
1067 extern int _etext[], _end[];
1068 extern ptr_t GC_SysVGetDataStart();
1069 # define DATASTART GC_SysVGetDataStart(0x1000, _etext)
1070 # define DATAEND (_end)
1071 # define SOLARIS_STACKBOTTOM
1072 /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
1073 /* It appears to be fixed in 2.8 and 2.9. */
1074 # ifdef SOLARIS25_PROC_VDB_BUG_FIXED
1075 # define PROC_VDB
1076 # endif
1077 # define DYNAMIC_LOADING
1078 # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
1079 # define USE_MMAP
1080 /* Otherwise we now use calloc. Mmap may result in the */
1081 /* heap interleaved with thread stacks, which can result in */
1082 /* excessive blacklisting. Sbrk is unusable since it */
1083 /* doesn't interact correctly with the system malloc. */
1084 # endif
1085 # ifdef USE_MMAP
1086 # define HEAP_START (ptr_t)0x40000000
1087 # else
1088 # define HEAP_START DATAEND
1089 # endif
1090 # endif
1091 # ifdef SCO
1092 # define OS_TYPE "SCO"
1093 extern int etext[];
1094 # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
1095 & ~0x3fffff) \
1096 +((word)etext & 0xfff))
1097 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
1098 # endif
1099 # ifdef SCO_ELF
1100 # define OS_TYPE "SCO_ELF"
1101 extern int etext[];
1102 # define DATASTART ((ptr_t)(etext))
1103 # define STACKBOTTOM ((ptr_t) 0x08048000)
1104 # define DYNAMIC_LOADING
1105 # define ELF_CLASS ELFCLASS32
1106 # endif
1107 # ifdef DGUX
1108 # define OS_TYPE "DGUX"
1109 extern int _etext, _end;
1110 extern ptr_t GC_SysVGetDataStart();
1111 # define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
1112 # define DATAEND (&_end)
1113 # define STACK_GROWS_DOWN
1114 # define HEURISTIC2
1115 # include <unistd.h>
1116 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1117 # define DYNAMIC_LOADING
1118 # ifndef USE_MMAP
1119 # define USE_MMAP
1120 # endif /* USE_MMAP */
1121 # define MAP_FAILED (void *) -1
1122 # ifdef USE_MMAP
1123 # define HEAP_START (ptr_t)0x40000000
1124 # else /* USE_MMAP */
1125 # define HEAP_START DATAEND
1126 # endif /* USE_MMAP */
1127 # endif /* DGUX */
1129 # ifdef LINUX
1130 # ifndef __GNUC__
1131 /* The Intel compiler doesn't like inline assembly */
1132 # define USE_GENERIC_PUSH_REGS
1133 # endif
1134 # define OS_TYPE "LINUX"
1135 # define LINUX_STACKBOTTOM
1136 # if 0
1137 # define HEURISTIC1
1138 # undef STACK_GRAN
1139 # define STACK_GRAN 0x10000000
1140 /* STACKBOTTOM is usually 0xc0000000, but this changes with */
1141 /* different kernel configurations. In particular, systems */
1142 /* with 2GB physical memory will usually move the user */
1143 /* address space limit, and hence initial SP to 0x80000000. */
1144 # endif
1145 # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
1146 # define MPROTECT_VDB
1147 # else
1148 /* We seem to get random errors in incremental mode, */
1149 /* possibly because Linux threads is itself a malloc client */
1150 /* and can't deal with the signals. */
1151 # endif
1152 # define HEAP_START (ptr_t)0x1000
1153 /* This encourages mmap to give us low addresses, */
1154 /* thus allowing the heap to grow to ~3GB */
1155 # ifdef __ELF__
1156 # define DYNAMIC_LOADING
1157 # ifdef UNDEFINED /* includes ro data */
1158 extern int _etext[];
1159 # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
1160 # endif
1161 # include <features.h>
1162 # if defined(__GLIBC__) && __GLIBC__ >= 2
1163 # define SEARCH_FOR_DATA_START
1164 # else
1165 extern char **__environ;
1166 # define DATASTART ((ptr_t)(&__environ))
1167 /* hideous kludge: __environ is the first */
1168 /* word in crt0.o, and delimits the start */
1169 /* of the data segment, no matter which */
1170 /* ld options were passed through. */
1171 /* We could use _etext instead, but that */
1172 /* would include .rodata, which may */
1173 /* contain large read-only data tables */
1174 /* that we'd rather not scan. */
1175 # endif
1176 extern int _end[];
1177 # define DATAEND (_end)
1178 # else
1179 extern int etext[];
1180 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1181 # endif
1182 # ifdef USE_I686_PREFETCH
1183 /* FIXME: Thus should use __builtin_prefetch, but we'll leave that */
1184 /* for the next rtelease. */
1185 # define PREFETCH(x) \
1186 __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
1187 /* Empirically prefetcht0 is much more effective at reducing */
1188 /* cache miss stalls for the targetted load instructions. But it */
1189 /* seems to interfere enough with other cache traffic that the net */
1190 /* result is worse than prefetchnta. */
1191 # if 0
1192 /* Using prefetches for write seems to have a slight negative */
1193 /* impact on performance, at least for a PIII/500. */
1194 # define PREFETCH_FOR_WRITE(x) \
1195 __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
1196 # endif
1197 # endif
1198 # ifdef USE_3DNOW_PREFETCH
1199 # define PREFETCH(x) \
1200 __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
1201 # define PREFETCH_FOR_WRITE(x) \
1202 __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
1203 # endif
1204 # endif
1205 # ifdef CYGWIN32
1206 # define OS_TYPE "CYGWIN32"
1207 # define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */
1208 # define DATAEND ((ptr_t)GC_DATAEND)
1209 # undef STACK_GRAN
1210 # define STACK_GRAN 0x10000
1211 # define HEURISTIC1
1212 # endif
1213 # ifdef OS2
1214 # define OS_TYPE "OS2"
1215 /* STACKBOTTOM and DATASTART are handled specially in */
1216 /* os_dep.c. OS2 actually has the right */
1217 /* system call! */
1218 # define DATAEND /* not needed */
1219 # define USE_GENERIC_PUSH_REGS
1220 # endif
1221 # ifdef MSWIN32
1222 # define OS_TYPE "MSWIN32"
1223 /* STACKBOTTOM and DATASTART are handled specially in */
1224 /* os_dep.c. */
1225 # ifndef __WATCOMC__
1226 # define MPROTECT_VDB
1227 # endif
1228 # define DATAEND /* not needed */
1229 # endif
1230 # ifdef MSWINCE
1231 # define OS_TYPE "MSWINCE"
1232 # define DATAEND /* not needed */
1233 # endif
1234 # ifdef DJGPP
1235 # define OS_TYPE "DJGPP"
1236 # include "stubinfo.h"
1237 extern int etext[];
1238 extern int _stklen;
1239 extern int __djgpp_stack_limit;
1240 # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
1241 /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
1242 + _stklen)) */
1243 # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
1244 /* This may not be right. */
1245 # endif
1246 # ifdef OPENBSD
1247 # define OS_TYPE "OPENBSD"
1248 # endif
1249 # ifdef FREEBSD
1250 # define OS_TYPE "FREEBSD"
1251 # ifndef GC_FREEBSD_THREADS
1252 # define MPROTECT_VDB
1253 # endif
1254 # ifdef __GLIBC__
1255 # define SIG_SUSPEND (32+6)
1256 # define SIG_THR_RESTART (32+5)
1257 extern int _end[];
1258 # define DATAEND (_end)
1259 # else
1260 # define SIG_SUSPEND SIGUSR1
1261 # define SIG_THR_RESTART SIGUSR2
1262 # endif
1263 # define FREEBSD_STACKBOTTOM
1264 # ifdef __ELF__
1265 # define DYNAMIC_LOADING
1266 # endif
1267 extern char etext[];
1268 extern char * GC_FreeBSDGetDataStart();
1269 # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
1270 # endif
1271 # ifdef NETBSD
1272 # define OS_TYPE "NETBSD"
1273 # ifdef __ELF__
1274 # define DYNAMIC_LOADING
1275 # endif
1276 # endif
1277 # ifdef THREE86BSD
1278 # define OS_TYPE "THREE86BSD"
1279 # endif
1280 # ifdef BSDI
1281 # define OS_TYPE "BSDI"
1282 # endif
1283 # if defined(OPENBSD) || defined(NETBSD) \
1284 || defined(THREE86BSD) || defined(BSDI)
1285 # define HEURISTIC2
1286 extern char etext[];
1287 # define DATASTART ((ptr_t)(etext))
1288 # endif
1289 # ifdef NEXT
1290 # define OS_TYPE "NEXT"
1291 # define DATASTART ((ptr_t) get_etext())
1292 # define STACKBOTTOM ((ptr_t)0xc0000000)
1293 # define DATAEND /* not needed */
1294 # endif
1295 # ifdef DOS4GW
1296 # define OS_TYPE "DOS4GW"
1297 extern long __nullarea;
1298 extern char _end;
1299 extern char *_STACKTOP;
1300 /* Depending on calling conventions Watcom C either precedes
1301 or does not precedes with undescore names of C-variables.
1302 Make sure startup code variables always have the same names. */
1303 #pragma aux __nullarea "*";
1304 #pragma aux _end "*";
1305 # define STACKBOTTOM ((ptr_t) _STACKTOP)
1306 /* confused? me too. */
1307 # define DATASTART ((ptr_t) &__nullarea)
1308 # define DATAEND ((ptr_t) &_end)
1309 # endif
1310 # ifdef HURD
1311 # define OS_TYPE "HURD"
1312 # define STACK_GROWS_DOWN
1313 # define HEURISTIC2
1314 # define SIG_SUSPEND SIGUSR1
1315 # define SIG_THR_RESTART SIGUSR2
1316 # define SEARCH_FOR_DATA_START
1317 extern int _end[];
1318 # define DATAEND ( (ptr_t) (_end))
1319 /* # define MPROTECT_VDB Not quite working yet? */
1320 # define DYNAMIC_LOADING
1321 # endif
1322 # ifdef DARWIN
1323 # define OS_TYPE "DARWIN"
1324 # define DARWIN_DONT_PARSE_STACK
1325 # define DYNAMIC_LOADING
1326 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
1327 These aren't used when dyld support is enabled (it is by default) */
1328 # define DATASTART ((ptr_t) get_etext())
1329 # define DATAEND ((ptr_t) get_end())
1330 # ifdef HAVE_PTHREAD_GET_STACKADDR_NP
1331 # define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self())
1332 # else
1333 # define STACKBOTTOM ((ptr_t) 0xc0000000)
1334 # endif
1335 # define USE_MMAP
1336 # define USE_MMAP_ANON
1337 # define USE_ASM_PUSH_REGS
1338 # ifdef GC_DARWIN_THREADS
1339 # define MPROTECT_VDB
1340 # endif
1341 # include <unistd.h>
1342 # define GETPAGESIZE() getpagesize()
1343 /* There seems to be some issues with trylock hanging on darwin. This
1344 should be looked into some more */
1345 # define NO_PTHREAD_TRYLOCK
1346 # endif /* DARWIN */
1347 # endif
1349 # ifdef NS32K
1350 # define MACH_TYPE "NS32K"
1351 # define ALIGNMENT 4
1352 extern char **environ;
1353 # define DATASTART ((ptr_t)(&environ))
1354 /* hideous kludge: environ is the first */
1355 /* word in crt0.o, and delimits the start */
1356 /* of the data segment, no matter which */
1357 /* ld options were passed through. */
1358 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1359 # endif
1361 # ifdef MIPS
1362 # define MACH_TYPE "MIPS"
1363 # ifdef LINUX
1364 /* This was developed for a linuxce style platform. Probably */
1365 /* needs to be tweaked for workstation class machines. */
1366 # define OS_TYPE "LINUX"
1367 # define DYNAMIC_LOADING
1368 extern int _end[];
1369 # define DATAEND (_end)
1370 extern int __data_start[];
1371 # define DATASTART ((ptr_t)(__data_start))
1372 # ifdef _MIPS_SZPTR
1373 # define CPP_WORDSZ _MIPS_SZPTR
1374 # define ALIGNMENT (_MIPS_SZPTR/8)
1375 # else
1376 # define ALIGNMENT 4
1377 # endif
1378 # ifndef HBLKSIZE
1379 # define HBLKSIZE 4096
1380 # endif
1381 # define USE_GENERIC_PUSH_REGS
1382 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
1383 # define LINUX_STACKBOTTOM
1384 # else
1385 # define STACKBOTTOM 0x80000000
1386 # endif
1387 # endif /* Linux */
1388 # ifdef EWS4800
1389 # define HEURISTIC2
1390 # if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
1391 extern int _fdata[], _end[];
1392 # define DATASTART ((ptr_t)_fdata)
1393 # define DATAEND ((ptr_t)_end)
1394 # define CPP_WORDSZ _MIPS_SZPTR
1395 # define ALIGNMENT (_MIPS_SZPTR/8)
1396 # else
1397 extern int etext[], edata[], end[];
1398 extern int _DYNAMIC_LINKING[], _gp[];
1399 # define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \
1400 + ((word)etext & 0xffff)))
1401 # define DATAEND (edata)
1402 # define DATASTART2 (_DYNAMIC_LINKING \
1403 ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
1404 : (ptr_t)edata)
1405 # define DATAEND2 (end)
1406 # define ALIGNMENT 4
1407 # endif
1408 # define OS_TYPE "EWS4800"
1409 # define USE_GENERIC_PUSH_REGS 1
1410 # endif
1411 # ifdef ULTRIX
1412 # define HEURISTIC2
1413 # define DATASTART (ptr_t)0x10000000
1414 /* Could probably be slightly higher since */
1415 /* startup code allocates lots of stuff. */
1416 # define OS_TYPE "ULTRIX"
1417 # define ALIGNMENT 4
1418 # endif
1419 # ifdef RISCOS
1420 # define HEURISTIC2
1421 # define DATASTART (ptr_t)0x10000000
1422 # define OS_TYPE "RISCOS"
1423 # define ALIGNMENT 4 /* Required by hardware */
1424 # endif
1425 # ifdef IRIX5
1426 # define HEURISTIC2
1427 extern int _fdata[];
1428 # define DATASTART ((ptr_t)(_fdata))
1429 # ifdef USE_MMAP
1430 # define HEAP_START (ptr_t)0x30000000
1431 # else
1432 # define HEAP_START DATASTART
1433 # endif
1434 /* Lowest plausible heap address. */
1435 /* In the MMAP case, we map there. */
1436 /* In either case it is used to identify */
1437 /* heap sections so they're not */
1438 /* considered as roots. */
1439 # define OS_TYPE "IRIX5"
1440 /*# define MPROTECT_VDB DOB: this should work, but there is evidence */
1441 /* of recent breakage. */
1442 # ifdef _MIPS_SZPTR
1443 # define CPP_WORDSZ _MIPS_SZPTR
1444 # define ALIGNMENT (_MIPS_SZPTR/8)
1445 # if CPP_WORDSZ != 64
1446 # define ALIGN_DOUBLE
1447 # endif
1448 # if _MIPS_SZPTR == 64
1449 # define ELF_CLASS ELFCLASS64
1450 # endif
1451 # else
1452 # define ALIGNMENT 4
1453 # define ALIGN_DOUBLE
1454 # endif
1455 # define DYNAMIC_LOADING
1456 # endif
1457 # ifdef MSWINCE
1458 # define OS_TYPE "MSWINCE"
1459 # define ALIGNMENT 4
1460 # define DATAEND /* not needed */
1461 # endif
1462 # if defined(NETBSD)
1463 # define ALIGNMENT 4
1464 # define OS_TYPE "NETBSD"
1465 # define HEURISTIC2
1466 # define USE_GENERIC_PUSH_REGS
1467 # ifdef __ELF__
1468 extern int etext[];
1469 # define DATASTART GC_data_start
1470 # define NEED_FIND_LIMIT
1471 # define DYNAMIC_LOADING
1472 # else
1473 # define DATASTART ((ptr_t) 0x10000000)
1474 # define STACKBOTTOM ((ptr_t) 0x7ffff000)
1475 # endif /* _ELF_ */
1476 # endif
1477 # endif
1479 # ifdef RS6000
1480 # define MACH_TYPE "RS6000"
1481 # ifdef ALIGNMENT
1482 # undef ALIGNMENT
1483 # endif
1484 # ifdef IA64
1485 # undef IA64 /* DOB: some AIX installs stupidly define IA64 in /usr/include/sys/systemcfg.h */
1486 # endif
1487 # ifdef __64BIT__
1488 # define ALIGNMENT 8
1489 # define CPP_WORDSZ 64
1490 # define STACKBOTTOM ((ptr_t)0x1000000000000000)
1491 # else
1492 # define ALIGNMENT 4
1493 # define CPP_WORDSZ 32
1494 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
1495 # endif
1496 # define USE_MMAP
1497 # define USE_MMAP_ANON
1498 /* From AIX linker man page:
1499 _text Specifies the first location of the program.
1500 _etext Specifies the first location after the program.
1501 _data Specifies the first location of the data.
1502 _edata Specifies the first location after the initialized data
1503 _end or end Specifies the first location after all data.
1505 extern int _data[], _end[];
1506 # define DATASTART ((ptr_t)((ulong)_data))
1507 # define DATAEND ((ptr_t)((ulong)_end))
1508 extern int errno;
1509 # define USE_GENERIC_PUSH_REGS
1510 # define DYNAMIC_LOADING
1511 /* For really old versions of AIX, this may have to be removed. */
1512 # endif
1514 # ifdef HP_PA
1515 # define MACH_TYPE "HP_PA"
1516 # ifdef __LP64__
1517 # define CPP_WORDSZ 64
1518 # define ALIGNMENT 8
1519 # else
1520 # define CPP_WORDSZ 32
1521 # define ALIGNMENT 4
1522 # define ALIGN_DOUBLE
1523 # endif
1524 # if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
1525 # ifndef LINUX /* For now. */
1526 # define MPROTECT_VDB
1527 # endif
1528 # else
1529 # define GENERIC_COMPARE_AND_SWAP
1530 /* No compare-and-swap instruction. Use pthread mutexes */
1531 /* when we absolutely have to. */
1532 # ifdef PARALLEL_MARK
1533 # define USE_MARK_BYTES
1534 /* Minimize compare-and-swap usage. */
1535 # endif
1536 # endif
1537 # define STACK_GROWS_UP
1538 # ifdef HPUX
1539 # define OS_TYPE "HPUX"
1540 extern int __data_start[];
1541 # define DATASTART ((ptr_t)(__data_start))
1542 # if 0
1543 /* The following appears to work for 7xx systems running HP/UX */
1544 /* 9.xx Furthermore, it might result in much faster */
1545 /* collections than HEURISTIC2, which may involve scanning */
1546 /* segments that directly precede the stack. It is not the */
1547 /* default, since it may not work on older machine/OS */
1548 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1549 /* this.) */
1550 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
1551 # else
1552 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1553 /* to this. Note that the GC must be initialized before the */
1554 /* first putenv call. */
1555 extern char ** environ;
1556 # define STACKBOTTOM ((ptr_t)environ)
1557 # endif
1558 # define DYNAMIC_LOADING
1559 # include <unistd.h>
1560 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1561 # ifndef __GNUC__
1562 # define PREFETCH(x) { \
1563 register long addr = (long)(x); \
1564 (void) _asm ("LDW", 0, 0, addr, 0); \
1566 # endif
1567 # endif /* HPUX */
1568 # ifdef LINUX
1569 # define OS_TYPE "LINUX"
1570 # define LINUX_STACKBOTTOM
1571 # define DYNAMIC_LOADING
1572 # define SEARCH_FOR_DATA_START
1573 extern int _end[];
1574 # define DATAEND (&_end)
1575 # endif /* LINUX */
1576 # endif /* HP_PA */
1578 # ifdef ALPHA
1579 # define MACH_TYPE "ALPHA"
1580 # define ALIGNMENT 8
1581 # define CPP_WORDSZ 64
1582 # ifndef LINUX
1583 # define USE_GENERIC_PUSH_REGS
1584 /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
1585 /* fp registers in some cases when the target is a 21264. The assembly */
1586 /* code doesn't handle that yet, and version dependencies make that a */
1587 /* bit tricky. Do the easy thing for now. */
1588 # endif
1589 # ifdef NETBSD
1590 # define OS_TYPE "NETBSD"
1591 # define HEURISTIC2
1592 # define DATASTART GC_data_start
1593 # define ELFCLASS32 32
1594 # define ELFCLASS64 64
1595 # define ELF_CLASS ELFCLASS64
1596 # define DYNAMIC_LOADING
1597 # endif
1598 # ifdef OPENBSD
1599 # define OS_TYPE "OPENBSD"
1600 # define HEURISTIC2
1601 # ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
1602 # define DATASTART GC_data_start
1603 # define ELFCLASS32 32
1604 # define ELFCLASS64 64
1605 # define ELF_CLASS ELFCLASS64
1606 # else /* ECOFF, until OpenBSD/Alpha 2.7 */
1607 # define DATASTART ((ptr_t) 0x140000000)
1608 # endif
1609 # endif
1610 # ifdef FREEBSD
1611 # define OS_TYPE "FREEBSD"
1612 /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
1613 # define SIG_SUSPEND SIGUSR1
1614 # define SIG_THR_RESTART SIGUSR2
1615 # define FREEBSD_STACKBOTTOM
1616 # ifdef __ELF__
1617 # define DYNAMIC_LOADING
1618 # endif
1619 /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
1620 extern char etext[];
1621 extern char edata[];
1622 extern char end[];
1623 # define NEED_FIND_LIMIT
1624 # define DATASTART ((ptr_t)(&etext))
1625 # define DATAEND (GC_find_limit (DATASTART, TRUE))
1626 # define DATASTART2 ((ptr_t)(&edata))
1627 # define DATAEND2 ((ptr_t)(&end))
1628 # endif
1629 # ifdef OSF1
1630 # define OS_TYPE "OSF1"
1631 # define DATASTART ((ptr_t) 0x140000000)
1632 extern int _end[];
1633 # define DATAEND ((ptr_t) &_end)
1634 extern char ** environ;
1635 /* round up from the value of environ to the nearest page boundary */
1636 /* Probably breaks if putenv is called before collector */
1637 /* initialization. */
1638 # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
1639 /* # define HEURISTIC2 */
1640 /* Normally HEURISTIC2 is too conervative, since */
1641 /* the text segment immediately follows the stack. */
1642 /* Hence we give an upper pound. */
1643 /* This is currently unused, since we disabled HEURISTIC2 */
1644 extern int __start[];
1645 # define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))
1646 # ifndef GC_OSF1_THREADS
1647 /* Unresolved signal issues with threads. */
1648 # define MPROTECT_VDB
1649 # endif
1650 # define DYNAMIC_LOADING
1651 # endif
1652 # ifdef LINUX
1653 # define OS_TYPE "LINUX"
1654 # define LINUX_STACKBOTTOM
1655 # ifdef __ELF__
1656 # define SEARCH_FOR_DATA_START
1657 # define DYNAMIC_LOADING
1658 # else
1659 # define DATASTART ((ptr_t) 0x140000000)
1660 # endif
1661 extern int _end[];
1662 # define DATAEND (_end)
1663 # define MPROTECT_VDB
1664 /* Has only been superficially tested. May not */
1665 /* work on all versions. */
1666 # endif
1667 # endif
1669 # ifdef IA64
1670 # define MACH_TYPE "IA64"
1671 # define USE_GENERIC_PUSH_REGS
1672 /* We need to get preserved registers in addition to register */
1673 /* windows. That's easiest to do with setjmp. */
1674 # ifdef PARALLEL_MARK
1675 # define USE_MARK_BYTES
1676 /* Compare-and-exchange is too expensive to use for */
1677 /* setting mark bits. */
1678 # endif
1679 # ifdef HPUX
1680 # ifdef _ILP32
1681 # define CPP_WORDSZ 32
1682 # define ALIGN_DOUBLE
1683 /* Requires 8 byte alignment for malloc */
1684 # define ALIGNMENT 4
1685 # else
1686 # ifndef _LP64
1687 ---> unknown ABI
1688 # endif
1689 # define CPP_WORDSZ 64
1690 # define ALIGN_DOUBLE
1691 /* Requires 16 byte alignment for malloc */
1692 # define ALIGNMENT 8
1693 # endif
1694 # define OS_TYPE "HPUX"
1695 extern int __data_start[];
1696 # define DATASTART ((ptr_t)(__data_start))
1697 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1698 /* to this. Note that the GC must be initialized before the */
1699 /* first putenv call. */
1700 extern char ** environ;
1701 # define STACKBOTTOM ((ptr_t)environ)
1702 # define HPUX_STACKBOTTOM
1703 # define DYNAMIC_LOADING
1704 # include <unistd.h>
1705 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1706 /* The following was empirically determined, and is probably */
1707 /* not very robust. */
1708 /* Note that the backing store base seems to be at a nice */
1709 /* address minus one page. */
1710 # define BACKING_STORE_DISPLACEMENT 0x1000000
1711 # define BACKING_STORE_ALIGNMENT 0x1000
1712 extern ptr_t GC_register_stackbottom;
1713 # define BACKING_STORE_BASE GC_register_stackbottom
1714 /* Known to be wrong for recent HP/UX versions!!! */
1715 # endif
1716 # ifdef LINUX
1717 # define CPP_WORDSZ 64
1718 # define ALIGN_DOUBLE
1719 /* Requires 16 byte alignment for malloc */
1720 # define ALIGNMENT 8
1721 # define OS_TYPE "LINUX"
1722 /* The following works on NUE and older kernels: */
1723 /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
1724 /* This does not work on NUE: */
1725 # define LINUX_STACKBOTTOM
1726 /* We also need the base address of the register stack */
1727 /* backing store. This is computed in */
1728 /* GC_linux_register_stack_base based on the following */
1729 /* constants: */
1730 # define BACKING_STORE_ALIGNMENT 0x100000
1731 # define BACKING_STORE_DISPLACEMENT 0x80000000
1732 extern ptr_t GC_register_stackbottom;
1733 # define BACKING_STORE_BASE GC_register_stackbottom
1734 # define SEARCH_FOR_DATA_START
1735 # ifdef __GNUC__
1736 # define DYNAMIC_LOADING
1737 # else
1738 /* In the Intel compiler environment, we seem to end up with */
1739 /* statically linked executables and an undefined reference */
1740 /* to _DYNAMIC */
1741 # endif
1742 # define MPROTECT_VDB
1743 /* Requires Linux 2.3.47 or later. */
1744 extern int _end[];
1745 # define DATAEND (_end)
1746 # ifdef __GNUC__
1747 # ifndef __INTEL_COMPILER
1748 # define PREFETCH(x) \
1749 __asm__ (" lfetch [%0]": : "r"(x))
1750 # define PREFETCH_FOR_WRITE(x) \
1751 __asm__ (" lfetch.excl [%0]": : "r"(x))
1752 # define CLEAR_DOUBLE(x) \
1753 __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
1754 # else
1755 # include <ia64intrin.h>
1756 # define PREFETCH(x) \
1757 __lfetch(__lfhint_none, (x))
1758 # define PREFETCH_FOR_WRITE(x) \
1759 __lfetch(__lfhint_nta, (x))
1760 # define CLEAR_DOUBLE(x) \
1761 __stf_spill((void *)(x), 0)
1762 # endif // __INTEL_COMPILER
1763 # endif
1764 # endif
1765 # ifdef MSWIN32
1766 /* FIXME: This is a very partial guess. There is no port, yet. */
1767 # define OS_TYPE "MSWIN32"
1768 /* STACKBOTTOM and DATASTART are handled specially in */
1769 /* os_dep.c. */
1770 # define DATAEND /* not needed */
1771 # if defined(_WIN64)
1772 # define CPP_WORDSZ 64
1773 # else
1774 # define CPP_WORDSZ 32 /* Is this possible? */
1775 # endif
1776 # define ALIGNMENT 8
1777 # endif
1778 # endif
1780 # ifdef M88K
1781 # define MACH_TYPE "M88K"
1782 # define ALIGNMENT 4
1783 # define ALIGN_DOUBLE
1784 extern int etext[];
1785 # ifdef CX_UX
1786 # define OS_TYPE "CX_UX"
1787 # define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1788 # endif
1789 # ifdef DGUX
1790 # define OS_TYPE "DGUX"
1791 extern ptr_t GC_SysVGetDataStart();
1792 # define DATASTART GC_SysVGetDataStart(0x10000, etext)
1793 # endif
1794 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1795 # endif
1797 # ifdef S370
1798 /* If this still works, and if anyone cares, this should probably */
1799 /* be moved to the S390 category. */
1800 # define MACH_TYPE "S370"
1801 # define ALIGNMENT 4 /* Required by hardware */
1802 # define USE_GENERIC_PUSH_REGS
1803 # ifdef UTS4
1804 # define OS_TYPE "UTS4"
1805 extern int etext[];
1806 extern int _etext[];
1807 extern int _end[];
1808 extern ptr_t GC_SysVGetDataStart();
1809 # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
1810 # define DATAEND (_end)
1811 # define HEURISTIC2
1812 # endif
1813 # endif
1815 # ifdef S390
1816 # define MACH_TYPE "S390"
1817 # define USE_GENERIC_PUSH_REGS
1818 # ifndef __s390x__
1819 # define ALIGNMENT 4
1820 # define CPP_WORDSZ 32
1821 # else
1822 # define ALIGNMENT 8
1823 # define CPP_WORDSZ 64
1824 # endif
1825 # ifndef HBLKSIZE
1826 # define HBLKSIZE 4096
1827 # endif
1828 # ifdef LINUX
1829 # define OS_TYPE "LINUX"
1830 # define LINUX_STACKBOTTOM
1831 # define DYNAMIC_LOADING
1832 extern int __data_start[];
1833 # define DATASTART ((ptr_t)(__data_start))
1834 extern int _end[];
1835 # define DATAEND (_end)
1836 # define CACHE_LINE_SIZE 256
1837 # define GETPAGESIZE() 4096
1838 # endif
1839 # endif
1841 # if defined(PJ)
1842 # define ALIGNMENT 4
1843 extern int _etext[];
1844 # define DATASTART ((ptr_t)(_etext))
1845 # define HEURISTIC1
1846 # endif
1848 # ifdef AARCH64
1849 # define CPP_WORDSZ 64
1850 # define MACH_TYPE "AARCH64"
1851 # define ALIGNMENT 8
1852 # ifndef HBLKSIZE
1853 # define HBLKSIZE 4096
1854 # endif
1855 # ifdef LINUX
1856 # define OS_TYPE "LINUX"
1857 # define LINUX_STACKBOTTOM
1858 # define USE_GENERIC_PUSH_REGS
1859 # define DYNAMIC_LOADING
1860 extern int __data_start[];
1861 # define DATASTART ((ptr_t)__data_start)
1862 extern char _end[];
1863 # define DATAEND ((ptr_t)(&_end))
1864 # endif
1865 # ifdef NOSYS
1866 /* __data_start is usually defined in the target linker script. */
1867 extern int __data_start[];
1868 # define DATASTART ((ptr_t)__data_start)
1869 extern void *__stack_base__;
1870 # define STACKBOTTOM ((ptr_t)__stack_base__)
1871 # endif
1872 # endif
1874 # ifdef ARM32
1875 # define CPP_WORDSZ 32
1876 # define MACH_TYPE "ARM32"
1877 # define ALIGNMENT 4
1878 # ifdef NETBSD
1879 # define OS_TYPE "NETBSD"
1880 # define HEURISTIC2
1881 # ifdef __ELF__
1882 # define DATASTART GC_data_start
1883 # define DYNAMIC_LOADING
1884 # else
1885 extern char etext[];
1886 # define DATASTART ((ptr_t)(etext))
1887 # endif
1888 # define USE_GENERIC_PUSH_REGS
1889 # endif
1890 # ifdef LINUX
1891 # define OS_TYPE "LINUX"
1892 # define LINUX_STACKBOTTOM
1893 # undef STACK_GRAN
1894 # define STACK_GRAN 0x10000000
1895 # define USE_GENERIC_PUSH_REGS
1896 # ifdef __ELF__
1897 # define DYNAMIC_LOADING
1898 # include <features.h>
1899 # if defined(__GLIBC__) && __GLIBC__ >= 2
1900 # define SEARCH_FOR_DATA_START
1901 # else
1902 extern char **__environ;
1903 # define DATASTART ((ptr_t)(&__environ))
1904 /* hideous kludge: __environ is the first */
1905 /* word in crt0.o, and delimits the start */
1906 /* of the data segment, no matter which */
1907 /* ld options were passed through. */
1908 /* We could use _etext instead, but that */
1909 /* would include .rodata, which may */
1910 /* contain large read-only data tables */
1911 /* that we'd rather not scan. */
1912 # endif
1913 extern int _end[];
1914 # define DATAEND (_end)
1915 # else
1916 extern int etext[];
1917 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1918 # endif
1919 # endif
1920 # ifdef MSWINCE
1921 # define OS_TYPE "MSWINCE"
1922 # define DATAEND /* not needed */
1923 # endif
1924 # ifdef NOSYS
1925 /* __data_start is usually defined in the target linker script. */
1926 extern int __data_start[];
1927 # define DATASTART (ptr_t)(__data_start)
1928 # define USE_GENERIC_PUSH_REGS
1929 /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
1930 extern void *__stack_base__;
1931 # define STACKBOTTOM ((ptr_t) (__stack_base__))
1932 # endif
1933 #endif
1935 # ifdef CRIS
1936 # define MACH_TYPE "CRIS"
1937 # define CPP_WORDSZ 32
1938 # define ALIGNMENT 1
1939 # define OS_TYPE "LINUX"
1940 # define DYNAMIC_LOADING
1941 # define LINUX_STACKBOTTOM
1942 # define USE_GENERIC_PUSH_REGS
1943 # define SEARCH_FOR_DATA_START
1944 extern int _end[];
1945 # define DATAEND (_end)
1946 # endif
1948 # ifdef SH
1949 # define MACH_TYPE "SH"
1950 # define ALIGNMENT 4
1951 # ifdef MSWINCE
1952 # define OS_TYPE "MSWINCE"
1953 # define DATAEND /* not needed */
1954 # endif
1955 # ifdef LINUX
1956 # define OS_TYPE "LINUX"
1957 # define LINUX_STACKBOTTOM
1958 # define USE_GENERIC_PUSH_REGS
1959 # define DYNAMIC_LOADING
1960 # define SEARCH_FOR_DATA_START
1961 extern int _end[];
1962 # define DATAEND (_end)
1963 # endif
1964 # ifdef NETBSD
1965 # define OS_TYPE "NETBSD"
1966 # define HEURISTIC2
1967 # define DATASTART GC_data_start
1968 # define USE_GENERIC_PUSH_REGS
1969 # define DYNAMIC_LOADING
1970 # endif
1971 # endif
1973 # ifdef SH4
1974 # define MACH_TYPE "SH4"
1975 # define OS_TYPE "MSWINCE"
1976 # define ALIGNMENT 4
1977 # define DATAEND /* not needed */
1978 # endif
1980 # ifdef M32R
1981 # define CPP_WORDSZ 32
1982 # define MACH_TYPE "M32R"
1983 # define ALIGNMENT 4
1984 # ifdef LINUX
1985 # define OS_TYPE "LINUX"
1986 # define LINUX_STACKBOTTOM
1987 # undef STACK_GRAN
1988 # define STACK_GRAN 0x10000000
1989 # define USE_GENERIC_PUSH_REGS
1990 # define DYNAMIC_LOADING
1991 # define SEARCH_FOR_DATA_START
1992 extern int _end[];
1993 # define DATAEND (_end)
1994 # endif
1995 # endif
1997 # ifdef X86_64
1998 # define MACH_TYPE "X86_64"
1999 # ifdef __ILP32__
2000 # define ALIGNMENT 4
2001 # define CPP_WORDSZ 32
2002 # else
2003 # define ALIGNMENT 8
2004 # define CPP_WORDSZ 64
2005 # endif
2006 # ifndef HBLKSIZE
2007 # define HBLKSIZE 4096
2008 # endif
2009 # define CACHE_LINE_SIZE 64
2010 # define USE_GENERIC_PUSH_REGS
2011 # ifdef LINUX
2012 # define OS_TYPE "LINUX"
2013 # define LINUX_STACKBOTTOM
2014 # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
2015 # define MPROTECT_VDB
2016 # else
2017 /* We seem to get random errors in incremental mode, */
2018 /* possibly because Linux threads is itself a malloc client */
2019 /* and can't deal with the signals. */
2020 # endif
2021 # ifdef __ELF__
2022 # define DYNAMIC_LOADING
2023 # ifdef UNDEFINED /* includes ro data */
2024 extern int _etext[];
2025 # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
2026 # endif
2027 # include <features.h>
2028 # define SEARCH_FOR_DATA_START
2029 extern int _end[];
2030 # define DATAEND (_end)
2031 # else
2032 extern int etext[];
2033 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
2034 # endif
2035 # if defined(__GNUC__) && __GNUC >= 3
2036 # define PREFETCH(x) __builtin_prefetch((x), 0, 0)
2037 # define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
2038 # endif
2039 # endif
2040 # ifdef DARWIN
2041 # define OS_TYPE "DARWIN"
2042 # define DARWIN_DONT_PARSE_STACK
2043 # define DYNAMIC_LOADING
2044 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
2045 These aren't used when dyld support is enabled (it is by default) */
2046 # define DATASTART ((ptr_t) get_etext())
2047 # define DATAEND ((ptr_t) get_end())
2048 # ifdef HAVE_PTHREAD_GET_STACKADDR_NP
2049 # define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self())
2050 # else
2051 # define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
2052 # endif
2053 # define USE_MMAP
2054 # define USE_MMAP_ANON
2055 # ifdef GC_DARWIN_THREADS
2056 # define MPROTECT_VDB
2057 # endif
2058 # include <unistd.h>
2059 # define GETPAGESIZE() getpagesize()
2060 /* There seems to be some issues with trylock hanging on darwin. This
2061 should be looked into some more */
2062 # define NO_PTHREAD_TRYLOCK
2063 # endif
2064 # ifdef FREEBSD
2065 # define OS_TYPE "FREEBSD"
2066 # ifndef GC_FREEBSD_THREADS
2067 # define MPROTECT_VDB
2068 # endif
2069 # ifdef __GLIBC__
2070 # define SIG_SUSPEND (32+6)
2071 # define SIG_THR_RESTART (32+5)
2072 extern int _end[];
2073 # define DATAEND (_end)
2074 # else
2075 # define SIG_SUSPEND SIGUSR1
2076 # define SIG_THR_RESTART SIGUSR2
2077 # endif
2078 # define FREEBSD_STACKBOTTOM
2079 # ifdef __ELF__
2080 # define DYNAMIC_LOADING
2081 # endif
2082 extern char etext[];
2083 extern char * GC_FreeBSDGetDataStart();
2084 # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
2085 # endif
2086 # ifdef NETBSD
2087 # define OS_TYPE "NETBSD"
2088 # ifdef __ELF__
2089 # define DYNAMIC_LOADING
2090 # endif
2091 # define HEURISTIC2
2092 extern char etext[];
2093 # define SEARCH_FOR_DATA_START
2094 # endif
2095 # ifdef SUNOS5
2096 # define ELF_CLASS ELFCLASS64
2097 # define OS_TYPE "SUNOS5"
2098 extern int _etext[], _end[];
2099 extern ptr_t GC_SysVGetDataStart();
2100 # define DATASTART GC_SysVGetDataStart(0x1000, _etext)
2101 # define DATAEND (_end)
2102 /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
2103 /* but reportedly breaks under 2.8. It appears that the stack */
2104 /* base is a property of the executable, so this should not break */
2105 /* old executables. */
2106 /* HEURISTIC2 probably works, but this appears to be preferable. */
2107 /* # include <sys/vm.h> */
2108 /* # define STACKBOTTOM USRSTACK */
2109 # define HEURISTIC2
2110 # define PROC_VDB
2111 # define DYNAMIC_LOADING
2112 # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
2113 # define USE_MMAP
2114 /* Otherwise we now use calloc. Mmap may result in the */
2115 /* heap interleaved with thread stacks, which can result in */
2116 /* excessive blacklisting. Sbrk is unusable since it */
2117 /* doesn't interact correctly with the system malloc. */
2118 # endif
2119 # ifdef USE_MMAP
2120 # define HEAP_START (ptr_t)0x40000000
2121 # else
2122 # define HEAP_START DATAEND
2123 # endif
2124 # endif
2125 # endif
2127 #if defined(LINUX) && defined(USE_MMAP)
2128 /* The kernel may do a somewhat better job merging mappings etc. */
2129 /* with anonymous mappings. */
2130 # define USE_MMAP_ANON
2131 #endif
2133 #if defined(LINUX) && defined(REDIRECT_MALLOC)
2134 /* Rld appears to allocate some memory with its own allocator, and */
2135 /* some through malloc, which might be redirected. To make this */
2136 /* work with collectable memory, we have to scan memory allocated */
2137 /* by rld's internal malloc. */
2138 # define USE_PROC_FOR_LIBRARIES
2139 #endif
2141 # ifndef STACK_GROWS_UP
2142 # define STACK_GROWS_DOWN
2143 # endif
2145 # ifndef CPP_WORDSZ
2146 # define CPP_WORDSZ 32
2147 # endif
2149 # ifndef OS_TYPE
2150 # define OS_TYPE ""
2151 # endif
2153 # ifndef DATAEND
2154 extern int end[];
2155 # define DATAEND (end)
2156 # endif
2158 # if defined(SVR4) && !defined(GETPAGESIZE)
2159 # include <unistd.h>
2160 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
2161 # endif
2163 # ifndef GETPAGESIZE
2164 # if defined(SUNOS5) || defined(IRIX5)
2165 # include <unistd.h>
2166 # endif
2167 # define GETPAGESIZE() getpagesize()
2168 # endif
2170 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
2171 /* OS has SVR4 generic features. Probably others also qualify. */
2172 # define SVR4
2173 # endif
2175 # if defined(SUNOS5) || defined(DRSNX)
2176 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
2177 /* loader. */
2178 # define SUNOS5DL
2179 /* OS has SUNOS5 style signal handlers. */
2180 # define SUNOS5SIGS
2181 # endif
2183 # if defined(HPUX)
2184 # define SUNOS5SIGS
2185 # endif
2187 # if defined(FREEBSD) && ((__FreeBSD__ >= 4) || (__FreeBSD_kernel__ >= 4))
2188 # define SUNOS5SIGS
2189 # endif
2191 # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
2192 || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
2193 || defined(DGUX) || defined(BSD) || defined(SUNOS4) \
2194 || defined(_AIX) || defined(DARWIN) || defined(OSF1) \
2195 || defined(HURD)
2196 # define UNIX_LIKE /* Basic Unix-like system calls work. */
2197 # endif
2199 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
2200 -> bad word size
2201 # endif
2203 # ifdef PCR
2204 # undef DYNAMIC_LOADING
2205 # undef STACKBOTTOM
2206 # undef HEURISTIC1
2207 # undef HEURISTIC2
2208 # undef PROC_VDB
2209 # undef MPROTECT_VDB
2210 # define PCR_VDB
2211 # endif
2213 # ifdef SRC_M3
2214 /* Postponed for now. */
2215 # undef PROC_VDB
2216 # undef MPROTECT_VDB
2217 # endif
2219 # ifdef SMALL_CONFIG
2220 /* Presumably not worth the space it takes. */
2221 # undef PROC_VDB
2222 # undef MPROTECT_VDB
2223 # endif
2225 # ifdef USE_MUNMAP
2226 # undef MPROTECT_VDB /* Can't deal with address space holes. */
2227 # endif
2229 # ifdef PARALLEL_MARK
2230 # undef MPROTECT_VDB /* For now. */
2231 # endif
2233 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
2234 # define DEFAULT_VDB
2235 # endif
2237 # ifndef PREFETCH
2238 # define PREFETCH(x)
2239 # define NO_PREFETCH
2240 # endif
2242 # ifndef PREFETCH_FOR_WRITE
2243 # define PREFETCH_FOR_WRITE(x)
2244 # define NO_PREFETCH_FOR_WRITE
2245 # endif
2247 # ifndef CACHE_LINE_SIZE
2248 # define CACHE_LINE_SIZE 32 /* Wild guess */
2249 # endif
2251 # if defined(LINUX) || defined(HURD) || defined(__GLIBC__)
2252 # define REGISTER_LIBRARIES_EARLY
2253 /* We sometimes use dl_iterate_phdr, which may acquire an internal */
2254 /* lock. This isn't safe after the world has stopped. So we must */
2255 /* call GC_register_dynamic_libraries before stopping the world. */
2256 /* For performance reasons, this may be beneficial on other */
2257 /* platforms as well, though it should be avoided in win32. */
2258 # endif /* LINUX */
2260 # if defined(SEARCH_FOR_DATA_START)
2261 extern ptr_t GC_data_start;
2262 # define DATASTART GC_data_start
2263 # endif
2265 # ifndef CLEAR_DOUBLE
2266 # define CLEAR_DOUBLE(x) \
2267 ((word*)x)[0] = 0; \
2268 ((word*)x)[1] = 0;
2269 # endif /* CLEAR_DOUBLE */
2271 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
2272 --> inconsistent configuration
2273 # endif
2274 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
2275 --> inconsistent configuration
2276 # endif
2277 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
2278 --> inconsistent configuration
2279 # endif
2280 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
2281 --> inconsistent configuration
2282 # endif
2283 # if defined(GC_AIX_THREADS) && !defined(_AIX)
2284 --> inconsistent configuration
2285 # endif
2286 # if defined(GC_GNU_THREADS) && !defined(HURD)
2287 --> inconsistent configuration
2288 # endif
2289 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32)
2290 --> inconsistent configuration
2291 # endif
2293 # if defined(PCR) || defined(SRC_M3) || \
2294 defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
2295 defined(GC_PTHREADS)
2296 # define THREADS
2297 # endif
2299 # if defined(HP_PA) || defined(M88K) \
2300 || defined(POWERPC) && !defined(DARWIN) \
2301 || defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
2302 || (defined(I386) && defined(__LCC__))
2303 /* Use setjmp based hack to mark from callee-save registers. */
2304 /* The define should move to the individual platform */
2305 /* descriptions. */
2306 # define USE_GENERIC_PUSH_REGS
2307 # endif
2309 # if defined(MSWINCE)
2310 # define NO_GETENV
2311 # endif
2313 # if defined(SPARC)
2314 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
2315 /* include assembly code to do it well. */
2316 # endif
2318 /* Can we save call chain in objects for debugging? */
2319 /* SET NFRAMES (# of saved frames) and NARGS (#of args for each */
2320 /* frame) to reasonable values for the platform. */
2321 /* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified */
2322 /* at build time, though we feel free to adjust it slightly. */
2323 /* Define NEED_CALLINFO if we either save the call stack or */
2324 /* GC_ADD_CALLER is defined. */
2325 /* GC_CAN_SAVE_CALL_STACKS is set in gc.h. */
2327 #if defined(SPARC)
2328 # define CAN_SAVE_CALL_ARGS
2329 #endif
2330 #if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__))
2331 /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
2332 /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
2333 # define CAN_SAVE_CALL_ARGS
2334 #endif
2336 # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
2337 && defined(GC_CAN_SAVE_CALL_STACKS)
2338 # define SAVE_CALL_CHAIN
2339 # endif
2340 # ifdef SAVE_CALL_CHAIN
2341 # if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
2342 # define NARGS SAVE_CALL_NARGS
2343 # else
2344 # define NARGS 0 /* Number of arguments to save for each call. */
2345 # endif
2346 # endif
2347 # ifdef SAVE_CALL_CHAIN
2348 # ifndef SAVE_CALL_COUNT
2349 # define NFRAMES 6 /* Number of frames to save. Even for */
2350 /* alignment reasons. */
2351 # else
2352 # define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
2353 # endif
2354 # define NEED_CALLINFO
2355 # endif /* SAVE_CALL_CHAIN */
2356 # ifdef GC_ADD_CALLER
2357 # define NFRAMES 1
2358 # define NARGS 0
2359 # define NEED_CALLINFO
2360 # endif
2362 # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
2363 # define DBG_HDRS_ALL
2364 # endif
2366 # if defined(POINTER_MASK) && !defined(POINTER_SHIFT)
2367 # define POINTER_SHIFT 0
2368 # endif
2370 # if defined(POINTER_SHIFT) && !defined(POINTER_MASK)
2371 # define POINTER_MASK ((GC_word)(-1))
2372 # endif
2374 # if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
2375 # define FIXUP_POINTER(p) (p) = ((p) & (POINTER_MASK) << POINTER_SHIFT)
2376 # endif
2378 # if defined(FIXUP_POINTER)
2379 # define NEED_FIXUP_POINTER 1
2380 # else
2381 # define NEED_FIXUP_POINTER 0
2382 # define FIXUP_POINTER(p)
2383 # endif
2385 #ifdef GC_PRIVATE_H
2386 /* This relies on some type definitions from gc_priv.h, from */
2387 /* where it's normally included. */
2388 /* */
2389 /* How to get heap memory from the OS: */
2390 /* Note that sbrk()-like allocation is preferred, since it */
2391 /* usually makes it possible to merge consecutively allocated */
2392 /* chunks. It also avoids unintented recursion with */
2393 /* -DREDIRECT_MALLOC. */
2394 /* GET_MEM() returns a HLKSIZE aligned chunk. */
2395 /* 0 is taken to mean failure. */
2396 /* In the case os USE_MMAP, the argument must also be a */
2397 /* physical page size. */
2398 /* GET_MEM is currently not assumed to retrieve 0 filled space, */
2399 /* though we should perhaps take advantage of the case in which */
2400 /* does. */
2401 struct hblk; /* See gc_priv.h. */
2402 # ifdef PCR
2403 char * real_malloc();
2404 # define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
2405 + GC_page_size-1)
2406 # else
2407 # ifdef OS2
2408 void * os2_alloc(size_t bytes);
2409 # define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
2410 + GC_page_size) \
2411 + GC_page_size-1)
2412 # else
2413 # if defined(NEXT) || defined(DOS4GW) || \
2414 (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
2415 (defined(SUNOS5) && !defined(USE_MMAP))
2416 # define GET_MEM(bytes) HBLKPTR((size_t) \
2417 calloc(1, (size_t)bytes + GC_page_size) \
2418 + GC_page_size-1)
2419 # else
2420 # if defined(MSWIN32) || defined(CYGWIN32)
2421 extern ptr_t GC_win32_get_mem();
2422 # define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
2423 # else
2424 # ifdef MACOS
2425 # if defined(USE_TEMPORARY_MEMORY)
2426 extern Ptr GC_MacTemporaryNewPtr(size_t size,
2427 Boolean clearMemory);
2428 # define GET_MEM(bytes) HBLKPTR( \
2429 GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
2430 + GC_page_size-1)
2431 # else
2432 # define GET_MEM(bytes) HBLKPTR( \
2433 NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
2434 # endif
2435 # else
2436 # ifdef MSWINCE
2437 extern ptr_t GC_wince_get_mem();
2438 # define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
2439 # else
2440 # if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
2441 extern void *GC_amiga_get_mem(size_t size);
2442 # define GET_MEM(bytes) HBLKPTR((size_t) \
2443 GC_amiga_get_mem((size_t)bytes + GC_page_size) \
2444 + GC_page_size-1)
2445 # else
2446 extern ptr_t GC_unix_get_mem();
2447 # define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
2448 # endif
2449 # endif
2450 # endif
2451 # endif
2452 # endif
2453 # endif
2454 # endif
2456 #endif /* GC_PRIVATE_H */
2458 #if defined(_AIX) && !defined(__GNUC__) && !defined(__STDC__)
2459 /* IBMs xlc compiler doesn't appear to follow the convention of */
2460 /* defining __STDC__ to be zero in extended mode. */
2461 # define __STDC__ 0
2462 #endif
2464 # endif /* GCCONFIG_H */