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