]> gcc.gnu.org Git - gcc.git/blob - gcc/config/sparc/sol2-bi.h
d1d62ebbea79fb89b24e26b56b6a5d8b83d675fc
[gcc.git] / gcc / config / sparc / sol2-bi.h
1 /* Definitions of target machine for GCC, for bi-arch SPARC
2 running Solaris 2 using the system assembler and linker.
3 Copyright (C) 2002, 2003, 2004, 2006, 2007, 2009, 2010, 2011
4 Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
26
27 /* The default code model used to be CM_MEDANY on Solaris
28 but even Sun eventually found it to be quite wasteful
29 and changed it to CM_MEDMID in the Studio 9 compiler. */
30 #undef SPARC_DEFAULT_CMODEL
31 #define SPARC_DEFAULT_CMODEL CM_MEDMID
32
33 #define AS_SPARC64_FLAG "-xarch=v9"
34
35 #undef ASM_CPU32_DEFAULT_SPEC
36 #define ASM_CPU32_DEFAULT_SPEC ""
37 #undef ASM_CPU64_DEFAULT_SPEC
38 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG
39
40 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
41 #undef CPP_CPU64_DEFAULT_SPEC
42 #define CPP_CPU64_DEFAULT_SPEC ""
43 #undef ASM_CPU32_DEFAULT_SPEC
44 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
45 #endif
46
47 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
48 #undef CPP_CPU64_DEFAULT_SPEC
49 #define CPP_CPU64_DEFAULT_SPEC ""
50 #undef ASM_CPU32_DEFAULT_SPEC
51 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
52 #undef ASM_CPU64_DEFAULT_SPEC
53 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
54 #endif
55
56 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
57 #undef CPP_CPU64_DEFAULT_SPEC
58 #define CPP_CPU64_DEFAULT_SPEC ""
59 #undef ASM_CPU32_DEFAULT_SPEC
60 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
61 #undef ASM_CPU64_DEFAULT_SPEC
62 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
63 #endif
64
65 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
66 #undef CPP_CPU64_DEFAULT_SPEC
67 #define CPP_CPU64_DEFAULT_SPEC ""
68 #undef ASM_CPU32_DEFAULT_SPEC
69 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
70 #undef ASM_CPU64_DEFAULT_SPEC
71 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
72 #endif
73
74 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
75 #undef CPP_CPU64_DEFAULT_SPEC
76 #define CPP_CPU64_DEFAULT_SPEC ""
77 #undef ASM_CPU32_DEFAULT_SPEC
78 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
79 #undef ASM_CPU64_DEFAULT_SPEC
80 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
81 #endif
82
83 #if DEFAULT_ARCH32_P
84 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
85 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
86 #else
87 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
88 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
89 #endif
90
91 #undef CPP_CPU_SPEC
92 #define CPP_CPU_SPEC "\
93 %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
94 %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
95 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
96 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
97 %{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara|mcpu=niagara2:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
98 %{!mcpu*:%(cpp_cpu_default)} \
99 "
100
101 #undef ASM_CPU_SPEC
102 #define ASM_CPU_SPEC "\
103 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
104 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
105 %{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
106 %{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
107 %{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
108 %{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}}} \
109 %{!mcpu*:%(asm_cpu_default)} \
110 "
111
112 #undef CPP_CPU_DEFAULT_SPEC
113 #define CPP_CPU_DEFAULT_SPEC \
114 (DEFAULT_ARCH32_P ? "\
115 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
116 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
117 " : "\
118 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
119 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
120 ")
121
122 #undef ASM_CPU_DEFAULT_SPEC
123 #define ASM_CPU_DEFAULT_SPEC \
124 (DEFAULT_ARCH32_P ? "\
125 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
126 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
127 " : "\
128 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
129 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
130 ")
131
132 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
133 compilations. This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
134 (32-bit) and p. 6P-10, Figure 6.38 (64-bit). */
135
136 #undef WCHAR_TYPE
137 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
138
139 #undef WCHAR_TYPE_SIZE
140 #define WCHAR_TYPE_SIZE 32
141
142 /* Same for wint_t. See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit). There's
143 no corresponding 64-bit definition, but this is what Solaris 8
144 <iso/wchar_iso.h> uses. */
145
146 #undef WINT_TYPE
147 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
148
149 #undef WINT_TYPE_SIZE
150 #define WINT_TYPE_SIZE 32
151
152 #undef CPP_ARCH32_SPEC
153 #define CPP_ARCH32_SPEC ""
154 #undef CPP_ARCH64_SPEC
155 #define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
156
157 #undef CPP_ARCH_SPEC
158 #define CPP_ARCH_SPEC "\
159 %{m32:%(cpp_arch32)} \
160 %{m64:%(cpp_arch64)} \
161 %{!m32:%{!m64:%(cpp_arch_default)}} \
162 "
163
164 #undef ASM_ARCH_SPEC
165 #define ASM_ARCH_SPEC ""
166
167 #undef ASM_ARCH32_SPEC
168 #define ASM_ARCH32_SPEC ""
169
170 #undef ASM_ARCH64_SPEC
171 #define ASM_ARCH64_SPEC ""
172
173 #undef ASM_ARCH_DEFAULT_SPEC
174 #define ASM_ARCH_DEFAULT_SPEC ""
175
176 #undef SUBTARGET_EXTRA_SPECS
177 #define SUBTARGET_EXTRA_SPECS \
178 { "startfile_arch", STARTFILE_ARCH_SPEC }, \
179 { "link_arch32", LINK_ARCH32_SPEC }, \
180 { "link_arch64", LINK_ARCH64_SPEC }, \
181 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
182 { "link_arch", LINK_ARCH_SPEC },
183
184 /*
185 * This should be the same as in sol2.h, except with "/sparcv9"
186 * appended to the paths and /usr/ccs/lib is no longer necessary
187 */
188 #define LINK_ARCH64_SPEC_BASE \
189 "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
190 %{G:-G} \
191 %{YP,*} \
192 %{R*} \
193 %{compat-bsd: \
194 %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
195 %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9}}} \
196 -R %R/usr/ucblib/sparcv9} \
197 %{!compat-bsd: \
198 %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
199 %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9}}}}"
200
201 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
202
203 #undef LINK_ARCH_SPEC
204 #if DISABLE_MULTILIB
205 #if DEFAULT_ARCH32_P
206 #define LINK_ARCH_SPEC "\
207 %{m32:%(link_arch32)} \
208 %{m64:%edoes not support multilib} \
209 %{!m32:%{!m64:%(link_arch_default)}} \
210 "
211 #else
212 #define LINK_ARCH_SPEC "\
213 %{m32:%edoes not support multilib} \
214 %{m64:%(link_arch64)} \
215 %{!m32:%{!m64:%(link_arch_default)}} \
216 "
217 #endif
218 #else
219 #define LINK_ARCH_SPEC "\
220 %{m32:%(link_arch32)} \
221 %{m64:%(link_arch64)} \
222 %{!m32:%{!m64:%(link_arch_default)}} \
223 "
224 #endif
225
226 #define LINK_ARCH_DEFAULT_SPEC \
227 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
228
229 #undef CC1_SPEC
230 #if DEFAULT_ARCH32_P
231 #define CC1_SPEC "\
232 %{m64:%{m32:%emay not use both -m32 and -m64}} \
233 %{m64:-mptr64 -mstack-bias -mno-v8plus \
234 %{!mcpu*:-%{!mv8plus:mcpu=v9}}} \
235 "
236 #else
237 #define CC1_SPEC "\
238 %{m32:%{m64:%emay not use both -m32 and -m64}} \
239 %{m32:-mptr32 -mno-stack-bias \
240 %{!mcpu*:%{!mv8plus:-mcpu=v9}}} \
241 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
242 %{!mcpu*:-mcpu=v9}} \
243 "
244 #endif
245
246 /* Support for a compile-time default CPU, et cetera. The rules are:
247 --with-cpu is ignored if -mcpu is specified.
248 --with-tune is ignored if -mtune is specified.
249 --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
250 are specified.
251 In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
252 here, otherwise say -mcpu=v7 would be passed even when -m64.
253 CC1_SPEC above takes care of this instead. */
254 #undef OPTION_DEFAULT_SPECS
255 #if DEFAULT_ARCH32_P
256 #define OPTION_DEFAULT_SPECS \
257 {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
258 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
259 {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
260 #else
261 #define OPTION_DEFAULT_SPECS \
262 {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
263 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
264 {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
265 #endif
266
267 #if DEFAULT_ARCH32_P
268 #define MULTILIB_DEFAULTS { "m32" }
269 #else
270 #define MULTILIB_DEFAULTS { "m64" }
271 #endif
This page took 0.049698 seconds and 4 git commands to generate.