OSDN Git Service

2001-11-12 David O'Brien <obrien@FreeBSD.org>
[pf3gnuchains/gcc-fork.git] / gcc / config / sparc / sol2-sld-64.h
1 /* Definitions of target machine for GNU compiler, for 64-bit SPARC
2    running Solaris 2 using the system linker.  */
3
4 #ifdef AS_SPARC64_FLAG
5 #include "sparc/sparc_bi.h"
6 #endif
7
8 #include "sparc/sol2.h"
9
10 #ifdef AS_SPARC64_FLAG
11
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
15    to unaligned data.  */
16
17 #define LINKER_DOES_NOT_WORK_WITH_DWARF2
18
19 /* A 64 bit v9 compiler with stack-bias */
20
21 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
22 #undef TARGET_DEFAULT
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)
26 #endif
27
28 /* The default code model.  */
29 #undef SPARC_DEFAULT_CMODEL
30 #define SPARC_DEFAULT_CMODEL CM_MEDANY
31
32 #undef LONG_DOUBLE_TYPE_SIZE
33 #define LONG_DOUBLE_TYPE_SIZE 128
34
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
39
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"
45 #endif
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"
53 #endif
54
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.  */
57 #undef ASM_SPEC
58 #define ASM_SPEC "\
59 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
60 %{fpic:-K PIC} %{fPIC:-K PIC} \
61 %(asm_cpu)\
62 "
63
64 #if DEFAULT_ARCH32_P
65 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
66 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
67 #else
68 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
69 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
70 #endif
71
72 #undef CPP_CPU_SPEC
73 #define CPP_CPU_SPEC "\
74 %{mcypress:} \
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)}}}}}}} \
87 "
88
89 #undef ASM_CPU_SPEC
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)} \
95 "
96
97 #define STARTFILE_SPEC32 "\
98 %{ansi:values-Xc.o%s} \
99 %{!ansi: \
100  %{traditional:values-Xt.o%s} \
101  %{!traditional:values-Xa.o%s}}"
102
103 #define STARTFILE_SPEC64 "\
104 %{ansi:/usr/lib/sparcv9/values-Xc.o%s} \
105 %{!ansi: \
106  %{traditional:/usr/lib/sparcv9/values-Xt.o%s} \
107  %{!traditional:/usr/lib/sparcv9/values-Xa.o%s}}"
108  
109 #ifdef SPARC_BI_ARCH
110
111 #if DEFAULT_ARCH32_P
112 #define STARTFILE_ARCH_SPEC "\
113 %{m32:" STARTFILE_SPEC32 "} \
114 %{m64:" STARTFILE_SPEC64 "} \
115 %{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
116 #else
117 #define STARTFILE_ARCH_SPEC "\
118 %{m32:" STARTFILE_SPEC32 "} \
119 %{m64:" STARTFILE_SPEC64 "} \
120 %{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
121 #endif
122
123 #else /* !SPARC_BI_ARCH */
124
125 /* In this case we define MD_STARTFILE_PREFIX to /usr/lib/sparcv9/ */
126 #define STARTFILE_ARCH_SPEC STARTFILE_SPEC32
127
128 #endif /* !SPARC_BI_ARCH */
129
130 #undef STARTFILE_SPEC
131 #define STARTFILE_SPEC "%{!shared: \
132                          %{!symbolic: \
133                           %{p:mcrt1.o%s} \
134                           %{!p: \
135                             %{pg:gcrt1.o%s gmon.o%s} \
136                             %{!pg:crt1.o%s}}}} \
137                         crti.o%s " STARTFILE_ARCH_SPEC " \
138                         crtbegin.o%s"
139
140 #ifdef SPARC_BI_ARCH
141
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 "} \
147 " : "\
148 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
149 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
150 ")
151
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 "} \
157 " : "\
158 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
159 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
160 ")
161
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
166
167 #undef WCHAR_TYPE
168 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
169
170 #undef WCHAR_TYPE_SIZE
171 #define WCHAR_TYPE_SIZE 32
172
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
177
178 #undef WINT_TYPE
179 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
180
181 #undef WINT_TYPE_SIZE
182 #define WINT_TYPE_SIZE 32
183
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"
192
193 #undef CPP_ARCH_SPEC
194 #define CPP_ARCH_SPEC "\
195 %{m32:%(cpp_arch32)} \
196 %{m64:%(cpp_arch64)} \
197 %{!m32:%{!m64:%(cpp_arch_default)}} \
198 "
199
200 #undef ASM_ARCH_SPEC
201 #define ASM_ARCH_SPEC ""
202
203 #undef ASM_ARCH32_SPEC
204 #define ASM_ARCH32_SPEC ""
205
206 #undef ASM_ARCH64_SPEC
207 #define ASM_ARCH64_SPEC ""
208
209 #undef ASM_ARCH_DEFAULT_SPEC
210 #define ASM_ARCH_DEFAULT_SPEC ""
211
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 },
218     
219 /* This should be the same as in svr4.h, except with -R added.  */
220 #define LINK_ARCH32_SPEC \
221   "%{G:-G} \
222    %{YP,*} \
223    %{R*} \
224    %{compat-bsd: \
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}}} \
228      -R /usr/ucblib} \
229    %{!compat-bsd: \
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}}}}"
233
234 #define LINK_ARCH64_SPEC \
235   "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
236    %{G:-G} \
237    %{YP,*} \
238    %{R*} \
239    %{compat-bsd: \
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}}} \
243      -R /usr/ucblib} \
244    %{!compat-bsd: \
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}}}}"
248
249 #define LINK_ARCH_SPEC "\
250 %{m32:%(link_arch32)} \
251 %{m64:%(link_arch64)} \
252 %{!m32:%{!m64:%(link_arch_default)}} \
253 "
254
255 #define LINK_ARCH_DEFAULT_SPEC \
256 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
257
258 #undef  LINK_SPEC
259 #define LINK_SPEC \
260   "%{h*} %{v:-V} \
261    %{b} %{Wl,*:%*} \
262    %{static:-dn -Bstatic} \
263    %{shared:-G -dy %{!mimpure-text:-z text}} \
264    %{symbolic:-Bsymbolic -G -dy -z text} \
265    %(link_arch) \
266    %{Qy:} %{!Qn:-Qy}"
267
268 #undef  CC1_SPEC
269 #if DEFAULT_ARCH32_P
270 #define CC1_SPEC "\
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}}}}}}}} \
277 "
278 #else
279 #define CC1_SPEC "\
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}}}}}}}} \
288 "
289 #endif
290
291 #if DEFAULT_ARCH32_P
292 #define MULTILIB_DEFAULTS { "m32" }
293 #else
294 #define MULTILIB_DEFAULTS { "m64" }
295 #endif
296
297 #else /* !SPARC_BI_ARCH */
298
299 /*
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
302  */
303 #undef LINK_SPEC
304 #define LINK_SPEC \
305   "%{h*} %{v:-V} \
306    %{b} %{Wl,*:%*} \
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} \
311    %{G:-G} \
312    %{YP,*} \
313    %{R*} \
314    %{compat-bsd: \
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}}} \
318      -R /usr/ucblib} \
319    %{!compat-bsd: \
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}}}} \
323    %{Qy:} %{!Qn:-Qy}"
324    
325 #undef MD_STARTFILE_PREFIX
326 #define MD_STARTFILE_PREFIX "/usr/lib/sparcv9/"
327  
328 #endif /* ! SPARC_BI_ARCH */
329
330 #endif