1 /* Definitions of target machine for GNU compiler, for 64-bit SPARC
2 running Solaris 2 using the system linker. */
5 #include "sparc/sparc_bi.h"
8 #include "sparc/sol2.h"
10 #ifdef AS_SPARC64_FLAG
12 /* At least up through Solaris 2.6,
13 the system linker does not work with DWARF or DWARF2,
14 since it does not have working support for relocations
17 #define LINKER_DOES_NOT_WORK_WITH_DWARF2
19 /* A 64 bit v9 compiler with stack-bias */
21 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
23 #define TARGET_DEFAULT \
24 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \
25 MASK_STACK_BIAS + MASK_EPILOGUE + MASK_FPU + MASK_LONG_DOUBLE_128)
28 /* The default code model. */
29 #undef SPARC_DEFAULT_CMODEL
30 #define SPARC_DEFAULT_CMODEL CM_MEDANY
32 #undef LONG_DOUBLE_TYPE_SIZE
33 #define LONG_DOUBLE_TYPE_SIZE 128
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
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"
46 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
47 #undef CPP_CPU64_DEFAULT_SPEC
48 #define CPP_CPU64_DEFAULT_SPEC ""
49 #undef ASM_CPU32_DEFAULT_SPEC
50 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
51 #undef ASM_CPU64_DEFAULT_SPEC
52 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
55 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
56 It's safe to pass -s always, even if -g is not used. */
59 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
60 %{fpic:-K PIC} %{fPIC:-K PIC} \
65 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
66 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
68 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
69 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
73 #define CPP_CPU_SPEC "\
75 %{msparclite:-D__sparclite__} \
76 %{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
77 %{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
78 %{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
79 %{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
80 %{mcpu=sparclite:-D__sparclite__} \
81 %{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
82 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
83 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
84 %{mcpu=v9:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
85 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
86 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
90 #define ASM_CPU_SPEC "\
91 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
92 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
93 %{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}} \
94 %{!mcpu*:%(asm_cpu_default)} \
97 #define STARTFILE_SPEC32 "\
98 %{ansi:values-Xc.o%s} \
100 %{traditional:values-Xt.o%s} \
101 %{!traditional:values-Xa.o%s}}"
103 #define STARTFILE_SPEC64 "\
104 %{ansi:/usr/lib/sparcv9/values-Xc.o%s} \
106 %{traditional:/usr/lib/sparcv9/values-Xt.o%s} \
107 %{!traditional:/usr/lib/sparcv9/values-Xa.o%s}}"
112 #define STARTFILE_ARCH_SPEC "\
113 %{m32:" STARTFILE_SPEC32 "} \
114 %{m64:" STARTFILE_SPEC64 "} \
115 %{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
117 #define STARTFILE_ARCH_SPEC "\
118 %{m32:" STARTFILE_SPEC32 "} \
119 %{m64:" STARTFILE_SPEC64 "} \
120 %{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
123 #else /* !SPARC_BI_ARCH */
125 /* In this case we define MD_STARTFILE_PREFIX to /usr/lib/sparcv9/ */
126 #define STARTFILE_ARCH_SPEC STARTFILE_SPEC32
128 #endif /* !SPARC_BI_ARCH */
130 #undef STARTFILE_SPEC
131 #define STARTFILE_SPEC "%{!shared: \
135 %{pg:gcrt1.o%s gmon.o%s} \
137 crti.o%s " STARTFILE_ARCH_SPEC " \
142 #undef CPP_CPU_DEFAULT_SPEC
143 #define CPP_CPU_DEFAULT_SPEC \
144 (DEFAULT_ARCH32_P ? "\
145 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
146 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
148 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
149 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
152 #undef ASM_CPU_DEFAULT_SPEC
153 #define ASM_CPU_DEFAULT_SPEC \
154 (DEFAULT_ARCH32_P ? "\
155 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
156 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
158 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
159 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
162 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
163 compilations. This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
164 (32-bit) and p. 6P-10, Figure 6.38 (64-bit). */
165 #define NO_BUILTIN_WCHAR_TYPE
168 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
170 #undef WCHAR_TYPE_SIZE
171 #define WCHAR_TYPE_SIZE 32
173 /* Same for wint_t. See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit). There's
174 no corresponding 64-bit definition, but this is what Solaris 8
175 <iso/wchar_iso.h> uses. */
176 #define NO_BUILTIN_WINT_TYPE
179 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
181 #undef WINT_TYPE_SIZE
182 #define WINT_TYPE_SIZE 32
184 #undef CPP_ARCH32_SPEC
185 #define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
186 -D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int \
187 -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
188 #undef CPP_ARCH64_SPEC
189 #define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
190 -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int \
191 -D__arch64__ -Acpu=sparc64 -Amachine=sparcv9 -D__sparcv9"
194 #define CPP_ARCH_SPEC "\
195 %{m32:%(cpp_arch32)} \
196 %{m64:%(cpp_arch64)} \
197 %{!m32:%{!m64:%(cpp_arch_default)}} \
201 #define ASM_ARCH_SPEC ""
203 #undef ASM_ARCH32_SPEC
204 #define ASM_ARCH32_SPEC ""
206 #undef ASM_ARCH64_SPEC
207 #define ASM_ARCH64_SPEC ""
209 #undef ASM_ARCH_DEFAULT_SPEC
210 #define ASM_ARCH_DEFAULT_SPEC ""
212 #undef SUBTARGET_EXTRA_SPECS
213 #define SUBTARGET_EXTRA_SPECS \
214 { "link_arch32", LINK_ARCH32_SPEC }, \
215 { "link_arch64", LINK_ARCH64_SPEC }, \
216 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
217 { "link_arch", LINK_ARCH_SPEC },
219 /* This should be the same as in svr4.h, except with -R added. */
220 #define LINK_ARCH32_SPEC \
225 %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
226 %{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
227 %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
230 %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
231 %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
232 %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}"
234 #define LINK_ARCH64_SPEC \
235 "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
240 %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
241 %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
242 %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
245 %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
246 %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
247 %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
249 #define LINK_ARCH_SPEC "\
250 %{m32:%(link_arch32)} \
251 %{m64:%(link_arch64)} \
252 %{!m32:%{!m64:%(link_arch_default)}} \
255 #define LINK_ARCH_DEFAULT_SPEC \
256 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
262 %{static:-dn -Bstatic} \
263 %{shared:-G -dy %{!mimpure-text:-z text}} \
264 %{symbolic:-Bsymbolic -G -dy -z text} \
271 %{sun4:} %{target:} \
272 %{mcypress:-mcpu=cypress} \
273 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
274 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
275 %{m64:-mptr64 -mstack-bias -mno-v8plus \
276 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
280 %{sun4:} %{target:} \
281 %{mcypress:-mcpu=cypress} \
282 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
283 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
284 %{m32:-mptr32 -mno-stack-bias \
285 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
286 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
287 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
292 #define MULTILIB_DEFAULTS { "m32" }
294 #define MULTILIB_DEFAULTS { "m64" }
297 #else /* !SPARC_BI_ARCH */
300 * This should be the same as in sol2-sld.h, except with "/sparcv9"
301 * appended to the paths and /usr/ccs/lib is no longer necessary
307 %{static:-dn -Bstatic} \
308 %{shared:-G -dy %{!mimpure-text:-z text}} \
309 %{symbolic:-Bsymbolic -G -dy -z text} \
310 %{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
315 %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
316 %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
317 %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
320 %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
321 %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
322 %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}} \
325 #undef MD_STARTFILE_PREFIX
326 #define MD_STARTFILE_PREFIX "/usr/lib/sparcv9/"
328 #endif /* ! SPARC_BI_ARCH */