]> gcc.gnu.org Git - gcc.git/blob - gcc/config/sparc/sol2.h
24c7ade0177a48147f1c1fbd0f2920fedc831be2
[gcc.git] / gcc / config / sparc / sol2.h
1 /* Definitions of target machine for GCC, for SPARC running Solaris 2
2 Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
3 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
4 Contributed by Ron Guilmette (rfg@netcom.com).
5 Additional changes by David V. Henkel-Wallace (gumby@cygnus.com).
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
22
23 #undef TARGET_DEFAULT
24 #ifdef TARGET_64BIT_DEFAULT
25 #define TARGET_DEFAULT \
26 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \
27 MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
28 #else
29 /* Solaris allows 64 bit out and global registers in 32 bit mode.
30 sparc_override_options will disable V8+ if not generating V9 code. */
31 #define TARGET_DEFAULT (MASK_V8PLUS + MASK_APP_REGS + MASK_FPU \
32 + MASK_LONG_DOUBLE_128)
33 #endif
34
35 /* The default code model used to be CM_MEDANY on Solaris
36 but even Sun eventually found it to be quite wasteful
37 and changed it to CM_MEDMID in the Studio 9 compiler. */
38 #undef SPARC_DEFAULT_CMODEL
39 #define SPARC_DEFAULT_CMODEL CM_MEDMID
40
41 /* Select a format to encode pointers in exception handling data. CODE
42 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
43 true if the symbol may be affected by dynamic relocations.
44
45 Some Solaris dynamic linkers don't handle unaligned section relative
46 relocs properly, so force them to be aligned. */
47 #ifndef HAVE_AS_SPARC_UA_PCREL
48 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
49 ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
50 #endif
51
52 \f
53
54 /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
55
56 /* This is here rather than in sparc.h because it's not known what
57 other assemblers will accept. */
58
59 #ifndef USE_GAS
60 #define AS_SPARC64_FLAG "-xarch=v9"
61 #else
62 #define AS_SPARC64_FLAG "-TSO -64 -Av9"
63 #endif
64
65 #undef ASM_CPU32_DEFAULT_SPEC
66 #define ASM_CPU32_DEFAULT_SPEC ""
67 #undef ASM_CPU64_DEFAULT_SPEC
68 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG
69
70 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
71 #undef CPP_CPU64_DEFAULT_SPEC
72 #define CPP_CPU64_DEFAULT_SPEC ""
73 #undef ASM_CPU32_DEFAULT_SPEC
74 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
75 #undef ASM_CPU_DEFAULT_SPEC
76 #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
77 #endif
78
79 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
80 #undef CPP_CPU64_DEFAULT_SPEC
81 #define CPP_CPU64_DEFAULT_SPEC ""
82 #undef ASM_CPU32_DEFAULT_SPEC
83 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
84 #undef ASM_CPU64_DEFAULT_SPEC
85 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
86 #undef ASM_CPU_DEFAULT_SPEC
87 #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
88 #endif
89
90 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
91 #undef CPP_CPU64_DEFAULT_SPEC
92 #define CPP_CPU64_DEFAULT_SPEC ""
93 #undef ASM_CPU32_DEFAULT_SPEC
94 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
95 #undef ASM_CPU64_DEFAULT_SPEC
96 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
97 #undef ASM_CPU_DEFAULT_SPEC
98 #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
99 #endif
100
101 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
102 #undef CPP_CPU64_DEFAULT_SPEC
103 #define CPP_CPU64_DEFAULT_SPEC ""
104 #undef ASM_CPU32_DEFAULT_SPEC
105 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
106 #undef ASM_CPU64_DEFAULT_SPEC
107 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
108 #undef ASM_CPU_DEFAULT_SPEC
109 #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
110 #endif
111
112 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
113 #undef CPP_CPU64_DEFAULT_SPEC
114 #define CPP_CPU64_DEFAULT_SPEC ""
115 #undef ASM_CPU32_DEFAULT_SPEC
116 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
117 #undef ASM_CPU64_DEFAULT_SPEC
118 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
119 #undef ASM_CPU_DEFAULT_SPEC
120 #define ASM_CPU_DEFAULT_SPEC ASM_CPU32_DEFAULT_SPEC
121 #endif
122
123 #undef CPP_CPU_SPEC
124 #define CPP_CPU_SPEC "\
125 %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
126 %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
127 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
128 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
129 %{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara|mcpu=niagara2:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
130 %{!mcpu*:%(cpp_cpu_default)} \
131 "
132
133 #undef CPP_CPU_DEFAULT_SPEC
134 #define CPP_CPU_DEFAULT_SPEC \
135 (DEFAULT_ARCH32_P ? "\
136 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
137 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
138 " : "\
139 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
140 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
141 ")
142
143 #undef CPP_ARCH32_SPEC
144 #define CPP_ARCH32_SPEC ""
145 #undef CPP_ARCH64_SPEC
146 #define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
147
148 #undef CPP_ARCH_SPEC
149 #define CPP_ARCH_SPEC "\
150 %{m32:%(cpp_arch32)} \
151 %{m64:%(cpp_arch64)} \
152 %{!m32:%{!m64:%(cpp_arch_default)}} \
153 "
154
155 #undef CC1_SPEC
156 #if DEFAULT_ARCH32_P
157 #define CC1_SPEC "\
158 %{m64:%{m32:%emay not use both -m32 and -m64}} \
159 %{m64:-mptr64 -mstack-bias -mno-v8plus \
160 %{!mcpu*:-%{!mv8plus:mcpu=v9}}} \
161 "
162 #else
163 #define CC1_SPEC "\
164 %{m32:%{m64:%emay not use both -m32 and -m64}} \
165 %{m32:-mptr32 -mno-stack-bias \
166 %{!mcpu*:%{!mv8plus:-mcpu=v9}}} \
167 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
168 %{!mcpu*:-mcpu=v9}} \
169 "
170 #endif
171
172 /* Support for a compile-time default CPU, et cetera. The rules are:
173 --with-cpu is ignored if -mcpu is specified.
174 --with-tune is ignored if -mtune is specified.
175 --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
176 are specified.
177 In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
178 here, otherwise say -mcpu=v7 would be passed even when -m64.
179 CC1_SPEC above takes care of this instead. */
180 #undef OPTION_DEFAULT_SPECS
181 #if DEFAULT_ARCH32_P
182 #define OPTION_DEFAULT_SPECS \
183 {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
184 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
185 {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
186 #else
187 #define OPTION_DEFAULT_SPECS \
188 {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
189 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
190 {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
191 #endif
192
193 #undef ASM_CPU_SPEC
194 #define ASM_CPU_SPEC "\
195 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
196 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
197 %{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
198 %{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
199 %{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
200 %{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}}} \
201 %{!mcpu*:%(asm_cpu_default)} \
202 "
203
204 #undef ASM_CPU_DEFAULT_SPEC
205 #define ASM_CPU_DEFAULT_SPEC \
206 (DEFAULT_ARCH32_P ? "\
207 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
208 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
209 " : "\
210 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
211 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
212 ")
213
214 #undef ASM_ARCH32_SPEC
215 #define ASM_ARCH32_SPEC ""
216
217 #undef ASM_ARCH64_SPEC
218 #define ASM_ARCH64_SPEC ""
219
220 #undef ASM_ARCH_DEFAULT_SPEC
221 #define ASM_ARCH_DEFAULT_SPEC ""
222
223 #undef ASM_ARCH_SPEC
224 #define ASM_ARCH_SPEC ""
225
226 #ifdef USE_GLD
227 /* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
228 follow the Solaris 2 ABI. Prefer them if present. */
229 #ifdef HAVE_LD_SOL2_EMULATION
230 #define ARCH32_EMULATION "elf32_sparc_sol2"
231 #define ARCH64_EMULATION "elf64_sparc_sol2"
232 #else
233 #define ARCH32_EMULATION "elf32_sparc"
234 #define ARCH64_EMULATION "elf64_sparc"
235 #endif
236 #endif
237
238 #define ARCH64_SUBDIR "sparcv9"
239
240 #define SUBTARGET_CPU_EXTRA_SPECS
241
242 \f
243
244 /* Register the Solaris-specific #pragma directives. */
245 #define REGISTER_TARGET_PRAGMAS() solaris_register_pragmas ()
246
247 #if defined(USE_GAS) && defined(HAVE_AS_TLS)
248 /* Use GNU extensions to TLS support. */
249 #undef TARGET_SUN_TLS
250 #undef TARGET_GNU_TLS
251 #define TARGET_SUN_TLS 0
252 #define TARGET_GNU_TLS 1
253 #endif
254
255 #undef LOCAL_LABEL_PREFIX
256 #define LOCAL_LABEL_PREFIX "."
257
258 /* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
259 #undef ASM_OUTPUT_SKIP
260 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
261 fprintf (FILE, "\t.skip %u\n", (int)(SIZE))
262
263 /* This is how to store into the string LABEL
264 the symbol_ref name of an internal numbered label where
265 PREFIX is the class of label and NUM is the number within the class.
266 This is suitable for output with `assemble_name'. */
267
268 #undef ASM_GENERATE_INTERNAL_LABEL
269 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
270 sprintf ((LABEL), "*.L%s%lu", (PREFIX), (unsigned long)(NUM))
271
272 /* The native TLS-enabled assembler requires the directive #tls_object
273 to be put on objects in TLS sections (as of v7.1). This is not
274 required by GNU as but supported on SPARC. */
275 #undef ASM_DECLARE_OBJECT_NAME
276 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
277 do \
278 { \
279 HOST_WIDE_INT size; \
280 \
281 if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
282 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_object"); \
283 else \
284 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
285 \
286 size_directive_output = 0; \
287 if (!flag_inhibit_size_directive \
288 && (DECL) && DECL_SIZE (DECL)) \
289 { \
290 size_directive_output = 1; \
291 size = int_size_in_bytes (TREE_TYPE (DECL)); \
292 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
293 } \
294 \
295 ASM_OUTPUT_LABEL (FILE, NAME); \
296 } \
297 while (0)
298
299 /* Output a simple call for .init/.fini. */
300 #define ASM_OUTPUT_CALL(FILE, FN) \
301 do \
302 { \
303 fprintf (FILE, "\tcall\t"); \
304 targetm.asm_out.print_operand (FILE, XEXP (DECL_RTL (FN), 0), 0); \
305 fprintf (FILE, "\n\tnop\n"); \
306 } \
307 while (0)
308
309 #ifndef USE_GAS
310 /* This is how to output an assembler line that says to advance
311 the location counter to a multiple of 2**LOG bytes using the
312 NOP instruction as padding. The filler pattern doesn't work
313 with GNU as. */
314 #define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \
315 if ((LOG) != 0) \
316 fprintf (FILE, "\t.align %d,0x1000000\n", (1<<(LOG)))
317
318 /* Use Solaris ELF section syntax with Sun as. */
319 #undef TARGET_ASM_NAMED_SECTION
320 #define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section
321
322 /* Emit COMDAT group signature symbols for Sun as. */
323 #undef TARGET_ASM_CODE_END
324 #define TARGET_ASM_CODE_END solaris_code_end
325
326 /* Sun as requires doublequoted section names on SPARC. While GNU as
327 supports that, too, we prefer the standard variant. */
328 #undef SECTION_NAME_FORMAT
329 #define SECTION_NAME_FORMAT "\"%s\""
330 #endif /* !USE_GAS */
331
332 /* Undefine this so that attribute((init_priority)) works with GNU ld. */
333 #ifdef USE_GLD
334 #undef CTORS_SECTION_ASM_OP
335 #undef DTORS_SECTION_ASM_OP
336 #endif
337
338 \f
339
340 /* Define for support of TFmode long double.
341 SPARC ABI says that long double is 4 words. */
342 #define LONG_DOUBLE_TYPE_SIZE 128
343
344 /* Solaris's _Qp_* library routine implementation clobbers the output
345 memory before the inputs are fully consumed. */
346
347 #undef TARGET_BUGGY_QP_LIB
348 #define TARGET_BUGGY_QP_LIB 1
349
350 #undef SUN_CONVERSION_LIBFUNCS
351 #define SUN_CONVERSION_LIBFUNCS 1
352
353 #undef DITF_CONVERSION_LIBFUNCS
354 #define DITF_CONVERSION_LIBFUNCS 1
355
356 #undef SUN_INTEGER_MULTIPLY_64
357 #define SUN_INTEGER_MULTIPLY_64 1
This page took 0.046432 seconds and 4 git commands to generate.