xref: /openbsd-src/gnu/usr.bin/gcc/gcc/config/sparc/sol2-bi.h (revision 4e43c760ad4cd5f644ec700462679d05749498d8)
1 /* Definitions of target machine for GNU compiler, for bi-arch SPARC
2    running Solaris 2 using the system assembler and linker.  */
3 
4 /* The default code model.  */
5 #undef SPARC_DEFAULT_CMODEL
6 #define SPARC_DEFAULT_CMODEL CM_MEDANY
7 
8 #define AS_SPARC64_FLAG	"-xarch=v9"
9 
10 #undef ASM_CPU32_DEFAULT_SPEC
11 #define ASM_CPU32_DEFAULT_SPEC	""
12 #undef ASM_CPU64_DEFAULT_SPEC
13 #define ASM_CPU64_DEFAULT_SPEC	AS_SPARC64_FLAG
14 
15 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
16 #undef CPP_CPU64_DEFAULT_SPEC
17 #define CPP_CPU64_DEFAULT_SPEC ""
18 #undef ASM_CPU32_DEFAULT_SPEC
19 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
20 #endif
21 
22 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
23 #undef CPP_CPU64_DEFAULT_SPEC
24 #define CPP_CPU64_DEFAULT_SPEC ""
25 #undef ASM_CPU32_DEFAULT_SPEC
26 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
27 #undef ASM_CPU64_DEFAULT_SPEC
28 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
29 #endif
30 
31 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
32 #undef CPP_CPU64_DEFAULT_SPEC
33 #define CPP_CPU64_DEFAULT_SPEC ""
34 #undef ASM_CPU32_DEFAULT_SPEC
35 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
36 #undef ASM_CPU64_DEFAULT_SPEC
37 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
38 #endif
39 
40 #if DEFAULT_ARCH32_P
41 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
42 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
43 #else
44 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
45 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
46 #endif
47 
48 #undef CPP_CPU_SPEC
49 #define CPP_CPU_SPEC "\
50 %{mcypress:} \
51 %{msparclite|mf930|mf934:-D__sparclite__} \
52 %{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
53 %{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
54 %{mcpu=sparclet|mcpu=tsc701:-D__sparclet__} \
55 %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
56 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
57 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
58 %{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
59 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
60 "
61 
62 #undef ASM_CPU_SPEC
63 #define ASM_CPU_SPEC "\
64 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
65 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
66 %{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
67 %{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}} \
68 %{!mcpu*:%(asm_cpu_default)} \
69 "
70 
71 #undef CPP_CPU_DEFAULT_SPEC
72 #define CPP_CPU_DEFAULT_SPEC \
73 (DEFAULT_ARCH32_P ? "\
74 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
75 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
76 " : "\
77 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
78 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
79 ")
80 
81 #undef ASM_CPU_DEFAULT_SPEC
82 #define ASM_CPU_DEFAULT_SPEC \
83 (DEFAULT_ARCH32_P ? "\
84 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
85 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
86 " : "\
87 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
88 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
89 ")
90 
91 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
92    compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
93    (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */
94 
95 #undef WCHAR_TYPE
96 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
97 
98 #undef WCHAR_TYPE_SIZE
99 #define WCHAR_TYPE_SIZE 32
100 
101 /* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
102    no corresponding 64-bit definition, but this is what Solaris 8
103    <iso/wchar_iso.h> uses.  */
104 
105 #undef WINT_TYPE
106 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
107 
108 #undef WINT_TYPE_SIZE
109 #define WINT_TYPE_SIZE 32
110 
111 #undef CPP_ARCH32_SPEC
112 #define CPP_ARCH32_SPEC "\
113 -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
114 #undef CPP_ARCH64_SPEC
115 #define CPP_ARCH64_SPEC "\
116 -D__arch64__ -Acpu=sparc64 -Amachine=sparcv9 -D__sparcv9"
117 
118 #undef CPP_ARCH_SPEC
119 #define CPP_ARCH_SPEC "\
120 %{m32:%(cpp_arch32)} \
121 %{m64:%(cpp_arch64)} \
122 %{!m32:%{!m64:%(cpp_arch_default)}} \
123 "
124 
125 #undef ASM_ARCH_SPEC
126 #define ASM_ARCH_SPEC ""
127 
128 #undef ASM_ARCH32_SPEC
129 #define ASM_ARCH32_SPEC ""
130 
131 #undef ASM_ARCH64_SPEC
132 #define ASM_ARCH64_SPEC ""
133 
134 #undef ASM_ARCH_DEFAULT_SPEC
135 #define ASM_ARCH_DEFAULT_SPEC ""
136 
137 #undef SUBTARGET_EXTRA_SPECS
138 #define SUBTARGET_EXTRA_SPECS \
139   { "startfile_arch",	 STARTFILE_ARCH_SPEC },		  \
140   { "link_arch32",       LINK_ARCH32_SPEC },              \
141   { "link_arch64",       LINK_ARCH64_SPEC },              \
142   { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },	  \
143   { "link_arch",	 LINK_ARCH_SPEC },
144 
145 /*
146  * This should be the same as in sol2.h, except with "/sparcv9"
147  * appended to the paths and /usr/ccs/lib is no longer necessary
148  */
149 #define LINK_ARCH64_SPEC_BASE \
150   "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
151    %{G:-G} \
152    %{YP,*} \
153    %{R*} \
154    %{compat-bsd: \
155      %{!YP,*:%{p|pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
156        %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
157      -R /usr/ucblib/sparcv9} \
158    %{!compat-bsd: \
159      %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
160        %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
161 
162 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
163 
164 #undef LINK_ARCH_SPEC
165 #define LINK_ARCH_SPEC "\
166 %{m32:%(link_arch32)} \
167 %{m64:%(link_arch64)} \
168 %{!m32:%{!m64:%(link_arch_default)}} \
169 "
170 
171 #define LINK_ARCH_DEFAULT_SPEC \
172 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
173 
174 #undef	CC1_SPEC
175 #if DEFAULT_ARCH32_P
176 #define CC1_SPEC "\
177 %{sun4:} %{target:} \
178 %{mcypress:-mcpu=cypress} \
179 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
180 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
181 %{m32:%{m64:%emay not use both -m32 and -m64}} \
182 %{m64:-mptr64 -mstack-bias -mno-v8plus \
183   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
184 "
185 #else
186 #define CC1_SPEC "\
187 %{sun4:} %{target:} \
188 %{mcypress:-mcpu=cypress} \
189 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
190 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
191 %{m32:%{m64:%emay not use both -m32 and -m64}} \
192 %{m32:-mptr32 -mno-stack-bias \
193   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
194 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
195   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
196 "
197 #endif
198 
199 #if DEFAULT_ARCH32_P
200 #define MULTILIB_DEFAULTS { "m32" }
201 #else
202 #define MULTILIB_DEFAULTS { "m64" }
203 #endif
204 
205 /* We use stabs-in-elf in 32-bit mode, because that is what the native
206    toolchain uses.  But gdb can't handle truncated 32-bit stabs so we
207    use dwarf2 in 64-bit mode.  */
208 #undef PREFERRED_DEBUGGING_TYPE
209 #define PREFERRED_DEBUGGING_TYPE (TARGET_ARCH32 ? DBX_DEBUG : DWARF2_DEBUG)
210 
211 /* We can't use the above definition for the purposes of specs.  */
212 #if defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
213 # if DEFAULT_ARCH32_P
214 #  define ASM_DEBUG_SPEC "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}"
215 # else
216 #  define ASM_DEBUG_SPEC "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}"
217 # endif
218 #endif
219