]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gcc/config/sparc/netbsd-elf.h
This commit was generated by cvs2svn to compensate for changes in r168616,
[FreeBSD/FreeBSD.git] / contrib / gcc / config / sparc / netbsd-elf.h
1 /* Definitions of target machine for GCC, for ELF on NetBSD/sparc
2    and NetBSD/sparc64.
3    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4    Contributed by Matthew Green (mrg@eterna.com.au).
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 #define TARGET_OS_CPP_BUILTINS()                        \
24   do                                                    \
25     {                                                   \
26       NETBSD_OS_CPP_BUILTINS_ELF();                     \
27       if (TARGET_ARCH64)                                \
28         {                                               \
29           builtin_define ("__sparc64__");               \
30           builtin_define ("__sparc_v9__");              \
31           builtin_define ("__sparcv9");                 \
32         }                                               \
33       else                                              \
34         builtin_define ("__sparc");                     \
35       builtin_define ("__sparc__");                     \
36     }                                                   \
37   while (0)
38
39 /* Make sure these are undefined.  */
40 #undef MD_EXEC_PREFIX
41 #undef MD_STARTFILE_PREFIX
42
43 /* CPP defines used by all NetBSD targets.  */
44 #undef CPP_SUBTARGET_SPEC
45 #define CPP_SUBTARGET_SPEC "%(netbsd_cpp_spec)"
46
47 /* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h.  */
48 #undef SIZE_TYPE
49 #define SIZE_TYPE "long unsigned int"
50
51 #undef PTRDIFF_TYPE
52 #define PTRDIFF_TYPE "long int"
53
54 #undef PREFERRED_DEBUGGING_TYPE
55 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
56
57 /* This is the char to use for continuation (in case we need to turn
58    continuation back on).  */
59 #undef DBX_CONTIN_CHAR
60 #define DBX_CONTIN_CHAR '?'
61
62 #undef DBX_REGISTER_NUMBER
63 #define DBX_REGISTER_NUMBER(REGNO) \
64   (TARGET_FLAT && REGNO == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO)
65
66 #undef  LOCAL_LABEL_PREFIX
67 #define LOCAL_LABEL_PREFIX  "."
68
69 /* This is how to output a reference to an internal numbered label where
70    PREFIX is the class of label and NUM is the number within the class.  */
71
72 #undef  ASM_OUTPUT_INTERNAL_LABELREF
73 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM)   \
74   fprintf (FILE, ".L%s%d", PREFIX, NUM)
75
76 /* This is how to store into the string LABEL
77    the symbol_ref name of an internal numbered label where
78    PREFIX is the class of label and NUM is the number within the class.
79    This is suitable for output with `assemble_name'.  */
80
81 #undef  ASM_GENERATE_INTERNAL_LABEL
82 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
83   sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
84
85 #undef USER_LABEL_PREFIX
86 #define USER_LABEL_PREFIX ""
87
88 #undef ASM_SPEC
89 #define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %{V} %{v:%{!V:-V}} \
90 %{mlittle-endian:-EL} \
91 %(asm_cpu) %(asm_arch) %(asm_relax)"
92
93 #undef STDC_0_IN_SYSTEM_HEADERS
94
95 /* Attempt to enable execute permissions on the stack.  */
96 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
97
98 #undef TARGET_VERSION
99 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
100
101 /* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
102    description, allowing one to build 32 bit or 64 bit applications
103    on either.  We define the sparc & sparc64 versions of things,
104    occasionally a neutral version (should be the same as "netbsd-elf.h")
105    and then based on SPARC_BI_ARCH, DEFAULT_ARCH32_P, and TARGET_CPU_DEFAULT,
106    we choose the correct version.  */
107
108 /* We use the default NetBSD ELF STARTFILE_SPEC and ENDFILE_SPEC
109    definitions, even for the SPARC_BI_ARCH compiler, because NetBSD does
110    not have a default place to find these libraries..  */
111
112 /* Name the port(s).  */
113 #define TARGET_NAME64     "NetBSD/sparc64 ELF"
114 #define TARGET_NAME32     "NetBSD/sparc ELF"
115
116 /* TARGET_CPU_DEFAULT is set in Makefile.in.  We test for 64-bit default
117    platform here.  */
118
119 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
120  || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
121 /* A 64 bit v9 compiler with stack-bias,
122    in a Medium/Low code model environment.  */
123
124 #undef TARGET_DEFAULT
125 #define TARGET_DEFAULT \
126   (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
127    + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
128
129 #undef SPARC_DEFAULT_CMODEL
130 #define SPARC_DEFAULT_CMODEL CM_MEDANY
131
132 #endif
133
134 /* CC1_SPEC for NetBSD/sparc.  */
135 #define CC1_SPEC32 \
136  "%{sun4:} %{target:} \
137   %{mcypress:-mcpu=cypress} \
138   %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
139   %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
140   %{m32:%{m64:%emay not use both -m32 and -m64}} \
141   %{m64: \
142     -mptr64 -mstack-bias -mno-v8plus -mlong-double-128 \
143     %{!mcpu*: \
144       %{!mcypress: \
145         %{!msparclite: \
146           %{!mf930: \
147             %{!mf934: \
148               %{!mv8*: \
149                 %{!msupersparc:-mcpu=ultrasparc}}}}}}} \
150     %{!mno-vis:%{!mcpu=v9:-mvis}} \
151     %{p:-mcmodel=medlow} \
152     %{pg:-mcmodel=medlow}}"
153
154 #define CC1_SPEC64 \
155  "%{sun4:} %{target:} \
156   %{mcypress:-mcpu=cypress} \
157   %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
158   %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
159   %{m32:%{m64:%emay not use both -m32 and -m64}} \
160   %{m32: \
161     -mptr32 -mno-stack-bias \
162     %{!mlong-double-128:-mlong-double-64} \
163     %{!mcpu*: \
164       %{!mcypress: \
165         %{!msparclite: \
166           %{!mf930: \
167             %{!mf934: \
168               %{!mv8*: \
169                 %{!msupersparc:-mcpu=cypress}}}}}}}} \
170   %{!m32: \
171     %{p:-mcmodel=medlow} \
172     %{pg:-mcmodel=medlow}}"
173
174 /* Make sure we use the right output format.  Pick a default and then
175    make sure -m32/-m64 switch to the right one.  */
176
177 #define LINK_ARCH32_SPEC "-m elf32_sparc"
178
179 #define LINK_ARCH64_SPEC "-m elf64_sparc"
180
181 #define LINK_ARCH_SPEC \
182  "%{m32:%(link_arch32)} \
183   %{m64:%(link_arch64)} \
184   %{!m32:%{!m64:%(link_arch_default)}}"
185
186 #undef LINK_SPEC
187 #define LINK_SPEC \
188  "%(link_arch) \
189   %{!mno-relax:%{!r:-relax}} \
190   %(netbsd_link_spec)"
191
192 #define NETBSD_ENTRY_POINT "__start"
193
194 #if DEFAULT_ARCH32_P
195 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH32_SPEC
196 #else
197 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH64_SPEC
198 #endif
199
200 /* What extra spec entries do we need?  */
201 #undef SUBTARGET_EXTRA_SPECS
202 #define SUBTARGET_EXTRA_SPECS \
203   { "link_arch32",              LINK_ARCH32_SPEC }, \
204   { "link_arch64",              LINK_ARCH64_SPEC }, \
205   { "link_arch_default",        LINK_ARCH_DEFAULT_SPEC }, \
206   { "link_arch",                LINK_ARCH_SPEC }, \
207   { "netbsd_cpp_spec",          NETBSD_CPP_SPEC }, \
208   { "netbsd_link_spec",         NETBSD_LINK_SPEC_ELF }, \
209   { "netbsd_entry_point",       NETBSD_ENTRY_POINT },
210
211
212 /* What extra switches do we need?  */
213 #undef  SUBTARGET_SWITCHES
214 #define SUBTARGET_SWITCHES \
215   {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
216   {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
217
218
219 /* Build a compiler that supports -m32 and -m64?  */
220
221 #ifdef SPARC_BI_ARCH
222
223 #undef LONG_DOUBLE_TYPE_SIZE
224 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
225
226 #undef MAX_LONG_DOUBLE_TYPE_SIZE
227 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
228
229 #if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
230 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
231 #else
232 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
233 #endif
234
235 #undef  CC1_SPEC
236 #if DEFAULT_ARCH32_P
237 #define CC1_SPEC CC1_SPEC32
238 #else
239 #define CC1_SPEC CC1_SPEC64
240 #endif
241
242 #if DEFAULT_ARCH32_P
243 #define MULTILIB_DEFAULTS { "m32" }
244 #else
245 #define MULTILIB_DEFAULTS { "m64" }
246 #endif
247
248 /* Name the port. */
249 #undef TARGET_NAME
250 #define TARGET_NAME     (DEFAULT_ARCH32_P ? TARGET_NAME32 : TARGET_NAME64)
251
252 #else   /* SPARC_BI_ARCH */
253
254 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
255  || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
256
257 #undef LONG_DOUBLE_TYPE_SIZE
258 #define LONG_DOUBLE_TYPE_SIZE 128
259
260 #undef MAX_LONG_DOUBLE_TYPE_SIZE
261 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
262
263 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
264 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
265
266 #undef  CC1_SPEC
267 #define CC1_SPEC CC1_SPEC64
268
269 #undef TARGET_NAME
270 #define TARGET_NAME     TARGET_NAME64
271
272 #else   /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
273         || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
274
275 /* A 32-bit only compiler.  NetBSD don't support 128 bit `long double'
276    for 32-bit code, unlike Solaris.  */
277
278 #undef LONG_DOUBLE_TYPE_SIZE
279 #define LONG_DOUBLE_TYPE_SIZE 64
280
281 #undef MAX_LONG_DOUBLE_TYPE_SIZE
282 #define MAX_LONG_DOUBLE_TYPE_SIZE 64
283
284 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
285 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
286
287 #undef  CC1_SPEC
288 #define CC1_SPEC CC1_SPEC32
289
290 #undef TARGET_NAME
291 #define TARGET_NAME     TARGET_NAME32
292
293 #endif  /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
294         || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
295
296 #endif  /* SPARC_BI_ARCH */
297
298 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
299 #undef CTORS_SECTION_ASM_OP
300 #undef DTORS_SECTION_ASM_OP