2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / config / sparc / sol2-bi.h
blob91d5e130be54f5d16178e9ac9c9e99693188c468
1 /* Definitions of target machine for GCC, for bi-arch SPARC
2 running Solaris 2 using the system assembler and linker. */
4 /* The default code model used to be CM_MEDANY on Solaris
5 but even Sun eventually found it to be quite wasteful
6 and changed it to CM_MEDMID in the Studio 9 compiler. */
7 #undef SPARC_DEFAULT_CMODEL
8 #define SPARC_DEFAULT_CMODEL CM_MEDMID
10 #define AS_SPARC64_FLAG "-xarch=v9"
12 #undef ASM_CPU32_DEFAULT_SPEC
13 #define ASM_CPU32_DEFAULT_SPEC ""
14 #undef ASM_CPU64_DEFAULT_SPEC
15 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG
17 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
18 #undef CPP_CPU64_DEFAULT_SPEC
19 #define CPP_CPU64_DEFAULT_SPEC ""
20 #undef ASM_CPU32_DEFAULT_SPEC
21 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
22 #endif
24 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
25 #undef CPP_CPU64_DEFAULT_SPEC
26 #define CPP_CPU64_DEFAULT_SPEC ""
27 #undef ASM_CPU32_DEFAULT_SPEC
28 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
29 #undef ASM_CPU64_DEFAULT_SPEC
30 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
31 #endif
33 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
34 #undef CPP_CPU64_DEFAULT_SPEC
35 #define CPP_CPU64_DEFAULT_SPEC ""
36 #undef ASM_CPU32_DEFAULT_SPEC
37 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
38 #undef ASM_CPU64_DEFAULT_SPEC
39 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
40 #endif
42 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
43 #undef CPP_CPU64_DEFAULT_SPEC
44 #define CPP_CPU64_DEFAULT_SPEC ""
45 #undef ASM_CPU32_DEFAULT_SPEC
46 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
47 #undef ASM_CPU64_DEFAULT_SPEC
48 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
49 #endif
51 #if TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
52 #undef CPP_CPU64_DEFAULT_SPEC
53 #define CPP_CPU64_DEFAULT_SPEC ""
54 #undef ASM_CPU32_DEFAULT_SPEC
55 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
56 #undef ASM_CPU64_DEFAULT_SPEC
57 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
58 #endif
60 #if DEFAULT_ARCH32_P
61 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
62 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
63 #else
64 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
65 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
66 #endif
68 #undef CPP_CPU_SPEC
69 #define CPP_CPU_SPEC "\
70 %{mcypress:} \
71 %{msparclite|mf930|mf934:-D__sparclite__} \
72 %{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
73 %{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
74 %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
75 %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
76 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
77 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
78 %{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara|mcpu=niagara2:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
79 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
82 #undef ASM_CPU_SPEC
83 #define ASM_CPU_SPEC "\
84 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
85 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
86 %{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
87 %{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
88 %{mcpu=niagara2:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
89 %{!mcpu=niagara2:%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}}} \
90 %{!mcpu*:%(asm_cpu_default)} \
93 #undef CPP_CPU_DEFAULT_SPEC
94 #define CPP_CPU_DEFAULT_SPEC \
95 (DEFAULT_ARCH32_P ? "\
96 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
97 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
98 " : "\
99 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
100 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
103 #undef ASM_CPU_DEFAULT_SPEC
104 #define ASM_CPU_DEFAULT_SPEC \
105 (DEFAULT_ARCH32_P ? "\
106 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
107 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
108 " : "\
109 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
110 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
113 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
114 compilations. This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
115 (32-bit) and p. 6P-10, Figure 6.38 (64-bit). */
117 #undef WCHAR_TYPE
118 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
120 #undef WCHAR_TYPE_SIZE
121 #define WCHAR_TYPE_SIZE 32
123 /* Same for wint_t. See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit). There's
124 no corresponding 64-bit definition, but this is what Solaris 8
125 <iso/wchar_iso.h> uses. */
127 #undef WINT_TYPE
128 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
130 #undef WINT_TYPE_SIZE
131 #define WINT_TYPE_SIZE 32
133 #undef CPP_ARCH32_SPEC
134 #define CPP_ARCH32_SPEC ""
135 #undef CPP_ARCH64_SPEC
136 #define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
138 #undef CPP_ARCH_SPEC
139 #define CPP_ARCH_SPEC "\
140 %{m32:%(cpp_arch32)} \
141 %{m64:%(cpp_arch64)} \
142 %{!m32:%{!m64:%(cpp_arch_default)}} \
145 #undef ASM_ARCH_SPEC
146 #define ASM_ARCH_SPEC ""
148 #undef ASM_ARCH32_SPEC
149 #define ASM_ARCH32_SPEC ""
151 #undef ASM_ARCH64_SPEC
152 #define ASM_ARCH64_SPEC ""
154 #undef ASM_ARCH_DEFAULT_SPEC
155 #define ASM_ARCH_DEFAULT_SPEC ""
157 #undef SUBTARGET_EXTRA_SPECS
158 #define SUBTARGET_EXTRA_SPECS \
159 { "startfile_arch", STARTFILE_ARCH_SPEC }, \
160 { "link_arch32", LINK_ARCH32_SPEC }, \
161 { "link_arch64", LINK_ARCH64_SPEC }, \
162 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
163 { "link_arch", LINK_ARCH_SPEC },
166 * This should be the same as in sol2.h, except with "/sparcv9"
167 * appended to the paths and /usr/ccs/lib is no longer necessary
169 #define LINK_ARCH64_SPEC_BASE \
170 "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
171 %{G:-G} \
172 %{YP,*} \
173 %{R*} \
174 %{compat-bsd: \
175 %{!YP,*:%{p|pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
176 %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
177 -R /usr/ucblib/sparcv9} \
178 %{!compat-bsd: \
179 %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
180 %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
182 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
184 #undef LINK_ARCH_SPEC
185 #if DISABLE_MULTILIB
186 #if DEFAULT_ARCH32_P
187 #define LINK_ARCH_SPEC "\
188 %{m32:%(link_arch32)} \
189 %{m64:%edoes not support multilib} \
190 %{!m32:%{!m64:%(link_arch_default)}} \
192 #else
193 #define LINK_ARCH_SPEC "\
194 %{m32:%edoes not support multilib} \
195 %{m64:%(link_arch64)} \
196 %{!m32:%{!m64:%(link_arch_default)}} \
198 #endif
199 #else
200 #define LINK_ARCH_SPEC "\
201 %{m32:%(link_arch32)} \
202 %{m64:%(link_arch64)} \
203 %{!m32:%{!m64:%(link_arch_default)}} \
205 #endif
207 #define LINK_ARCH_DEFAULT_SPEC \
208 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
210 #undef CC1_SPEC
211 #if DEFAULT_ARCH32_P
212 #define CC1_SPEC "\
213 %{sun4:} %{target:} \
214 %{mcypress:-mcpu=cypress} \
215 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
216 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
217 %{m32:%{m64:%emay not use both -m32 and -m64}} \
218 %{m64:-mptr64 -mstack-bias -mno-v8plus \
219 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
221 #else
222 #define CC1_SPEC "\
223 %{sun4:} %{target:} \
224 %{mcypress:-mcpu=cypress} \
225 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
226 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
227 %{m32:%{m64:%emay not use both -m32 and -m64}} \
228 %{m32:-mptr32 -mno-stack-bias \
229 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
230 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
231 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
233 #endif
235 /* Support for a compile-time default CPU, et cetera. The rules are:
236 --with-cpu is ignored if -mcpu is specified.
237 --with-tune is ignored if -mtune is specified.
238 --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
239 are specified.
240 In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
241 here, otherwise say -mcpu=v7 would be passed even when -m64.
242 CC1_SPEC above takes care of this instead. */
243 #undef OPTION_DEFAULT_SPECS
244 #if DEFAULT_ARCH32_P
245 #define OPTION_DEFAULT_SPECS \
246 {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
247 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
248 {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
249 #else
250 #define OPTION_DEFAULT_SPECS \
251 {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
252 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
253 {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
254 #endif
256 #if DEFAULT_ARCH32_P
257 #define MULTILIB_DEFAULTS { "m32" }
258 #else
259 #define MULTILIB_DEFAULTS { "m64" }
260 #endif