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