1/* Definitions of target machine for GCC, for bi-arch SPARC
2   running Solaris 2 using the system assembler and linker.  */
3
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
9
10#define AS_SPARC64_FLAG	"-xarch=v9"
11
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
16
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
23
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
32
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
41
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
50
51#if DEFAULT_ARCH32_P
52#define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
53#define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
54#else
55#define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
56#define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
57#endif
58
59#undef CPP_CPU_SPEC
60#define CPP_CPU_SPEC "\
61%{mcypress:} \
62%{msparclite|mf930|mf934:-D__sparclite__} \
63%{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
64%{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
65%{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
66%{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
67%{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
68%{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
69%{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
70%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
71"
72
73#undef ASM_CPU_SPEC
74#define ASM_CPU_SPEC "\
75%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
76%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
77%{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
78%{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
79%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}} \
80%{!mcpu*:%(asm_cpu_default)} \
81"
82
83#undef CPP_CPU_DEFAULT_SPEC
84#define CPP_CPU_DEFAULT_SPEC \
85(DEFAULT_ARCH32_P ? "\
86%{m64:" CPP_CPU64_DEFAULT_SPEC "} \
87%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
88" : "\
89%{m32:" CPP_CPU32_DEFAULT_SPEC "} \
90%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
91")
92
93#undef ASM_CPU_DEFAULT_SPEC
94#define ASM_CPU_DEFAULT_SPEC \
95(DEFAULT_ARCH32_P ? "\
96%{m64:" ASM_CPU64_DEFAULT_SPEC "} \
97%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
98" : "\
99%{m32:" ASM_CPU32_DEFAULT_SPEC "} \
100%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
101")
102
103/* wchar_t is called differently in <wchar.h> for 32 and 64-bit
104   compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
105   (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */
106
107#undef WCHAR_TYPE
108#define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
109
110#undef WCHAR_TYPE_SIZE
111#define WCHAR_TYPE_SIZE 32
112
113/* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
114   no corresponding 64-bit definition, but this is what Solaris 8
115   <iso/wchar_iso.h> uses.  */
116
117#undef WINT_TYPE
118#define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
119
120#undef WINT_TYPE_SIZE
121#define WINT_TYPE_SIZE 32
122
123#undef CPP_ARCH32_SPEC
124#define CPP_ARCH32_SPEC ""
125#undef CPP_ARCH64_SPEC
126#define CPP_ARCH64_SPEC "-D__arch64__ -D__sparcv9"
127
128#undef CPP_ARCH_SPEC
129#define CPP_ARCH_SPEC "\
130%{m32:%(cpp_arch32)} \
131%{m64:%(cpp_arch64)} \
132%{!m32:%{!m64:%(cpp_arch_default)}} \
133"
134
135#undef ASM_ARCH_SPEC
136#define ASM_ARCH_SPEC ""
137
138#undef ASM_ARCH32_SPEC
139#define ASM_ARCH32_SPEC ""
140
141#undef ASM_ARCH64_SPEC
142#define ASM_ARCH64_SPEC ""
143
144#undef ASM_ARCH_DEFAULT_SPEC
145#define ASM_ARCH_DEFAULT_SPEC ""
146
147#undef SUBTARGET_EXTRA_SPECS
148#define SUBTARGET_EXTRA_SPECS \
149  { "startfile_arch",	 STARTFILE_ARCH_SPEC },		  \
150  { "link_arch32",       LINK_ARCH32_SPEC },              \
151  { "link_arch64",       LINK_ARCH64_SPEC },              \
152  { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },	  \
153  { "link_arch",	 LINK_ARCH_SPEC },
154
155/*
156 * This should be the same as in sol2.h, except with "/sparcv9"
157 * appended to the paths and /usr/ccs/lib is no longer necessary
158 */
159#define LINK_ARCH64_SPEC_BASE \
160  "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
161   %{G:-G} \
162   %{YP,*} \
163   %{R*} \
164   %{compat-bsd: \
165     %{!YP,*:%{p|pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
166       %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
167     -R /usr/ucblib/sparcv9} \
168   %{!compat-bsd: \
169     %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
170       %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
171
172#define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
173
174#undef LINK_ARCH_SPEC
175#if DISABLE_MULTILIB
176#if DEFAULT_ARCH32_P
177#define LINK_ARCH_SPEC "\
178%{m32:%(link_arch32)} \
179%{m64:%edoes not support multilib} \
180%{!m32:%{!m64:%(link_arch_default)}} \
181"
182#else
183#define LINK_ARCH_SPEC "\
184%{m32:%edoes not support multilib} \
185%{m64:%(link_arch64)} \
186%{!m32:%{!m64:%(link_arch_default)}} \
187"
188#endif
189#else
190#define LINK_ARCH_SPEC "\
191%{m32:%(link_arch32)} \
192%{m64:%(link_arch64)} \
193%{!m32:%{!m64:%(link_arch_default)}} \
194"
195#endif
196
197#define LINK_ARCH_DEFAULT_SPEC \
198(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
199
200#undef	CC1_SPEC
201#if DEFAULT_ARCH32_P
202#define CC1_SPEC "\
203%{sun4:} %{target:} \
204%{mcypress:-mcpu=cypress} \
205%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
206%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
207%{m32:%{m64:%emay not use both -m32 and -m64}} \
208%{m64:-mptr64 -mstack-bias -mno-v8plus \
209  %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
210"
211#else
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%{m32:-mptr32 -mno-stack-bias \
219  %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
220%{mv8plus:-m32 -mptr32 -mno-stack-bias \
221  %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
222"
223#endif
224
225/* Support for a compile-time default CPU, et cetera.  The rules are:
226   --with-cpu is ignored if -mcpu is specified.
227   --with-tune is ignored if -mtune is specified.
228   --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
229     are specified.
230   In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
231   here, otherwise say -mcpu=v7 would be passed even when -m64.
232   CC1_SPEC above takes care of this instead.  */
233#undef OPTION_DEFAULT_SPECS
234#if DEFAULT_ARCH32_P
235#define OPTION_DEFAULT_SPECS \
236  {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
237  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
238  {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
239#else
240#define OPTION_DEFAULT_SPECS \
241  {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
242  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
243  {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
244#endif
245
246#if DEFAULT_ARCH32_P
247#define MULTILIB_DEFAULTS { "m32" }
248#else
249#define MULTILIB_DEFAULTS { "m64" }
250#endif
251