Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / config / sparc / freebsd.h
blobc032d644be0d19928ece2b6b07615b7b266c138b
1 /* Definitions for Sun SPARC64 running FreeBSD using the ELF format
2 Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
3 Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #undef SUBTARGET_EXTRA_SPECS
23 #define SUBTARGET_EXTRA_SPECS \
24 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
26 /* FreeBSD needs the platform name (sparc64) defined.
27 Emacs needs to know if the arch is 64 or 32-bits. */
29 #undef CPP_CPU64_DEFAULT_SPEC
30 #define CPP_CPU64_DEFAULT_SPEC \
31 "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__"
33 #define LINK_SPEC "%(link_arch) \
34 %{!mno-relax:%{!r:-relax}} \
35 %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
36 %{Wl,*:%*} \
37 %{assert*} %{R*} %{rpath*} %{defsym*} \
38 %{shared:-Bshareable %{h*} %{soname*}} \
39 %{symbolic:-Bsymbolic} \
40 %{!shared: \
41 %{!static: \
42 %{rdynamic:-export-dynamic} \
43 %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
44 %{static:-Bstatic}}"
47 /************************[ Target stuff ]***********************************/
49 /* Define the actual types of some ANSI-mandated types.
50 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
51 c-common.c, and config/<arch>/<arch>.h. */
53 /* Earlier headers may get this wrong for FreeBSD.
54 We use the GCC defaults instead. */
55 #undef WCHAR_TYPE
57 #undef WCHAR_TYPE_SIZE
58 #define WCHAR_TYPE_SIZE 32
60 /* Define for support of TFmode long double.
61 SPARC ABI says that long double is 4 words. */
62 #undef LONG_DOUBLE_TYPE_SIZE
63 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
65 /* Define this to set long double type size to use in libgcc2.c, which can
66 not depend on target_flags. */
67 #if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
68 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
69 #else
70 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
71 #endif
73 /* Definitions for 64-bit SPARC running systems with ELF. */
75 #undef SUBTARGET_SWITCHES
76 #define SUBTARGET_SWITCHES \
77 {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
78 {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
80 #undef TARGET_VERSION
81 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/sparc64 ELF)");
83 #define TARGET_ELF 1
85 /* XXX */
86 /* A 64 bit v9 compiler with stack-bias,
87 in a Medium/mid code model environment. */
89 #undef TARGET_DEFAULT
90 #define TARGET_DEFAULT \
91 (MASK_V9 + MASK_64BIT + MASK_PTR64 /* + MASK_FASTER_STRUCTS */ \
92 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU \
93 + MASK_LONG_DOUBLE_128 /* + MASK_HARD_QUAD */)
95 /* The default code model. */
96 #undef SPARC_DEFAULT_CMODEL
97 #define SPARC_DEFAULT_CMODEL CM_MEDLOW
99 #define ENABLE_EXECUTE_STACK \
100 static int need_enable_exec_stack; \
101 static void check_enabling(void) __attribute__ ((constructor)); \
102 static void check_enabling(void) \
104 extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\
105 int prot = 0; \
106 size_t len = sizeof(prot); \
108 sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \
109 if (prot != 7) \
110 need_enable_exec_stack = 1; \
112 extern void __enable_execute_stack (void *); \
113 void __enable_execute_stack (void *addr) \
115 if (!need_enable_exec_stack) \
116 return; \
117 else { \
118 /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
119 if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \
120 perror ("mprotect of trampoline code"); \
125 /************************[ Assembler stuff ]********************************/
127 #undef LOCAL_LABEL_PREFIX
128 #define LOCAL_LABEL_PREFIX "."
130 /* XXX2 */
131 /* This is how to store into the string LABEL
132 the symbol_ref name of an internal numbered label where
133 PREFIX is the class of label and NUM is the number within the class.
134 This is suitable for output with `assemble_name'. */
136 #undef ASM_GENERATE_INTERNAL_LABEL
137 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
138 sprintf (LABEL, "*.L%s%lu", PREFIX, (unsigned long)(NUM))
141 /************************[ Debugger stuff ]*********************************/
143 /* This is the char to use for continuation (in case we need to turn
144 continuation back on). */
146 #undef DBX_CONTIN_CHAR
147 #define DBX_CONTIN_CHAR '?'
149 /* DWARF bits. */
151 /* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
152 Obviously the Dwarf2 folks havn't tried to actually build systems
153 with their spec. On a 64-bit system, only 64-bit relocs become
154 RELATIVE relocations. */
156 /* #define DWARF_OFFSET_SIZE PTR_SIZE */
158 #undef ENDFILE_SPEC
159 #define ENDFILE_SPEC \
160 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" \
161 FBSD_ENDFILE_SPEC
163 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
164 #undef CTORS_SECTION_ASM_OP
165 #undef DTORS_SECTION_ASM_OP