OSDN Git Service

b46912293510700fe9b3a133b216b8ad4a88759f
[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/biarch64.h"
6 #endif
7
8 #include "sparc/sparc.h"
9 #include "dbxelf.h"
10 #include "elfos.h"
11 #include "svr4.h"
12 #include "sparc/sysv4.h"
13 #include "sparc/sol2.h"
14
15 #ifdef AS_SPARC64_FLAG
16
17 /* At least up through Solaris 2.6,
18    the system linker does not work with DWARF or DWARF2,
19    since it does not have working support for relocations
20    to unaligned data.  */
21
22 #define LINKER_DOES_NOT_WORK_WITH_DWARF2
23
24 /* A 64 bit v9 compiler with stack-bias */
25
26 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
27 #undef TARGET_DEFAULT
28 #define TARGET_DEFAULT \
29   (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \
30    MASK_STACK_BIAS + MASK_EPILOGUE + MASK_FPU + MASK_LONG_DOUBLE_128)
31 #endif
32
33 /* The default code model.  */
34 #undef SPARC_DEFAULT_CMODEL
35 #define SPARC_DEFAULT_CMODEL CM_MEDANY
36
37 #undef LONG_DOUBLE_TYPE_SIZE
38 #define LONG_DOUBLE_TYPE_SIZE 128
39
40 #undef ASM_CPU32_DEFAULT_SPEC
41 #define ASM_CPU32_DEFAULT_SPEC  ""
42 #undef ASM_CPU64_DEFAULT_SPEC
43 #define ASM_CPU64_DEFAULT_SPEC  AS_SPARC64_FLAG
44
45 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
46 #undef CPP_CPU64_DEFAULT_SPEC
47 #define CPP_CPU64_DEFAULT_SPEC ""
48 #undef ASM_CPU32_DEFAULT_SPEC
49 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus"
50 #endif
51 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
52 #undef CPP_CPU64_DEFAULT_SPEC
53 #define CPP_CPU64_DEFAULT_SPEC ""
54 #undef ASM_CPU32_DEFAULT_SPEC
55 #define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa"
56 #undef ASM_CPU64_DEFAULT_SPEC
57 #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
58 #endif
59
60 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
61    It's safe to pass -s always, even if -g is not used.  */
62 #undef ASM_SPEC
63 #define ASM_SPEC "\
64 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
65 %{fpic:-K PIC} %{fPIC:-K PIC} \
66 %(asm_cpu)\
67 "
68
69 #if DEFAULT_ARCH32_P
70 #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
71 #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
72 #else
73 #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}"
74 #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}"
75 #endif
76
77 #undef CPP_CPU_SPEC
78 #define CPP_CPU_SPEC "\
79 %{mcypress:} \
80 %{msparclite:-D__sparclite__} \
81 %{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
82 %{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
83 %{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
84 %{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
85 %{mcpu=sparclite:-D__sparclite__} \
86 %{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
87 %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
88 %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
89 %{mcpu=v9:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
90 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
91 %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
92 "
93
94 #undef ASM_CPU_SPEC
95 #define ASM_CPU_SPEC "\
96 %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
97 %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
98 %{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}} \
99 %{!mcpu*:%(asm_cpu_default)} \
100 "
101
102 #define STARTFILE_SPEC32 "\
103 %{ansi:values-Xc.o%s} \
104 %{!ansi: \
105  %{traditional:values-Xt.o%s} \
106  %{!traditional:values-Xa.o%s}}"
107
108 #define STARTFILE_SPEC64 "\
109 %{ansi:/usr/lib/sparcv9/values-Xc.o%s} \
110 %{!ansi: \
111  %{traditional:/usr/lib/sparcv9/values-Xt.o%s} \
112  %{!traditional:/usr/lib/sparcv9/values-Xa.o%s}}"
113  
114 #ifdef SPARC_BI_ARCH
115
116 #if DEFAULT_ARCH32_P
117 #define STARTFILE_ARCH_SPEC "\
118 %{m32:" STARTFILE_SPEC32 "} \
119 %{m64:" STARTFILE_SPEC64 "} \
120 %{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
121 #else
122 #define STARTFILE_ARCH_SPEC "\
123 %{m32:" STARTFILE_SPEC32 "} \
124 %{m64:" STARTFILE_SPEC64 "} \
125 %{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
126 #endif
127
128 #else /* !SPARC_BI_ARCH */
129
130 /* In this case we define MD_STARTFILE_PREFIX to /usr/lib/sparcv9/ */
131 #define STARTFILE_ARCH_SPEC STARTFILE_SPEC32
132
133 #endif /* !SPARC_BI_ARCH */
134
135 #undef STARTFILE_SPEC
136 #define STARTFILE_SPEC "%{!shared: \
137                          %{!symbolic: \
138                           %{p:mcrt1.o%s} \
139                           %{!p: \
140                             %{pg:gcrt1.o%s gmon.o%s} \
141                             %{!pg:crt1.o%s}}}} \
142                         crti.o%s " STARTFILE_ARCH_SPEC " \
143                         crtbegin.o%s"
144
145 #ifdef SPARC_BI_ARCH
146
147 #undef CPP_CPU_DEFAULT_SPEC
148 #define CPP_CPU_DEFAULT_SPEC \
149 (DEFAULT_ARCH32_P ? "\
150 %{m64:" CPP_CPU64_DEFAULT_SPEC "} \
151 %{!m64:" CPP_CPU32_DEFAULT_SPEC "} \
152 " : "\
153 %{m32:" CPP_CPU32_DEFAULT_SPEC "} \
154 %{!m32:" CPP_CPU64_DEFAULT_SPEC "} \
155 ")
156
157 #undef ASM_CPU_DEFAULT_SPEC
158 #define ASM_CPU_DEFAULT_SPEC \
159 (DEFAULT_ARCH32_P ? "\
160 %{m64:" ASM_CPU64_DEFAULT_SPEC "} \
161 %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \
162 " : "\
163 %{m32:" ASM_CPU32_DEFAULT_SPEC "} \
164 %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \
165 ")
166
167 /* wchar_t is called differently in <wchar.h> for 32 and 64-bit
168    compilations.  This is called for by SCD 2.4.1, p. 6-83, Figure 6-65
169    (32-bit) and p. 6P-10, Figure 6.38 (64-bit).  */
170 #define NO_BUILTIN_WCHAR_TYPE
171
172 #undef WCHAR_TYPE
173 #define WCHAR_TYPE (TARGET_ARCH64 ? "int" : "long int")
174
175 #undef WCHAR_TYPE_SIZE
176 #define WCHAR_TYPE_SIZE 32
177
178 /* Same for wint_t.  See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit).  There's
179    no corresponding 64-bit definition, but this is what Solaris 8
180    <iso/wchar_iso.h> uses.  */
181 #define NO_BUILTIN_WINT_TYPE
182
183 #undef WINT_TYPE
184 #define WINT_TYPE (TARGET_ARCH64 ? "int" : "long int")
185
186 #undef WINT_TYPE_SIZE
187 #define WINT_TYPE_SIZE 32
188
189 #undef CPP_ARCH32_SPEC
190 #define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \
191 -D__WCHAR_TYPE__=long\\ int -D__WINT_TYPE__=long\\ int \
192 -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
193 #undef CPP_ARCH64_SPEC
194 #define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
195 -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int \
196 -D__arch64__ -Acpu=sparc64 -Amachine=sparcv9 -D__sparcv9"
197
198 #undef CPP_ARCH_SPEC
199 #define CPP_ARCH_SPEC "\
200 %{m32:%(cpp_arch32)} \
201 %{m64:%(cpp_arch64)} \
202 %{!m32:%{!m64:%(cpp_arch_default)}} \
203 "
204
205 #undef ASM_ARCH_SPEC
206 #define ASM_ARCH_SPEC ""
207
208 #undef ASM_ARCH32_SPEC
209 #define ASM_ARCH32_SPEC ""
210
211 #undef ASM_ARCH64_SPEC
212 #define ASM_ARCH64_SPEC ""
213
214 #undef ASM_ARCH_DEFAULT_SPEC
215 #define ASM_ARCH_DEFAULT_SPEC ""
216
217 #undef SUBTARGET_EXTRA_SPECS
218 #define SUBTARGET_EXTRA_SPECS \
219   { "link_arch32",       LINK_ARCH32_SPEC },              \
220   { "link_arch64",       LINK_ARCH64_SPEC },              \
221   { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },        \
222   { "link_arch",         LINK_ARCH_SPEC },
223     
224 /* This should be the same as in svr4.h, except with -R added.  */
225 #define LINK_ARCH32_SPEC \
226   "%{G:-G} \
227    %{YP,*} \
228    %{R*} \
229    %{compat-bsd: \
230      %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
231        %{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
232        %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
233      -R /usr/ucblib} \
234    %{!compat-bsd: \
235      %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
236        %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
237        %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}"
238
239 #define LINK_ARCH64_SPEC \
240   "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
241    %{G:-G} \
242    %{YP,*} \
243    %{R*} \
244    %{compat-bsd: \
245      %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
246        %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
247        %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
248      -R /usr/ucblib} \
249    %{!compat-bsd: \
250      %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
251        %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
252        %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
253
254 #define LINK_ARCH_SPEC "\
255 %{m32:%(link_arch32)} \
256 %{m64:%(link_arch64)} \
257 %{!m32:%{!m64:%(link_arch_default)}} \
258 "
259
260 #define LINK_ARCH_DEFAULT_SPEC \
261 (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
262
263 #undef  LINK_SPEC
264 #define LINK_SPEC \
265   "%{h*} %{v:-V} \
266    %{b} %{Wl,*:%*} \
267    %{static:-dn -Bstatic} \
268    %{shared:-G -dy %{!mimpure-text:-z text}} \
269    %{symbolic:-Bsymbolic -G -dy -z text} \
270    %(link_arch) \
271    %{Qy:} %{!Qn:-Qy}"
272
273 #undef  CC1_SPEC
274 #if DEFAULT_ARCH32_P
275 #define CC1_SPEC "\
276 %{sun4:} %{target:} \
277 %{mcypress:-mcpu=cypress} \
278 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
279 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
280 %{m64:-mptr64 -mstack-bias -mno-v8plus \
281   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=v9}}}}}}}} \
282 "
283 #else
284 #define CC1_SPEC "\
285 %{sun4:} %{target:} \
286 %{mcypress:-mcpu=cypress} \
287 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
288 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
289 %{m32:-mptr32 -mno-stack-bias \
290   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8*:%{!msupersparc:-mcpu=cypress}}}}}}}} \
291 %{mv8plus:-m32 -mptr32 -mno-stack-bias \
292   %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=v9}}}}}}}} \
293 "
294 #endif
295
296 #if DEFAULT_ARCH32_P
297 #define MULTILIB_DEFAULTS { "m32" }
298 #else
299 #define MULTILIB_DEFAULTS { "m64" }
300 #endif
301
302 #else /* !SPARC_BI_ARCH */
303
304 /*
305  * This should be the same as in sol2-sld.h, except with "/sparcv9"
306  * appended to the paths and /usr/ccs/lib is no longer necessary
307  */
308 #undef LINK_SPEC
309 #define LINK_SPEC \
310   "%{h*} %{v:-V} \
311    %{b} %{Wl,*:%*} \
312    %{static:-dn -Bstatic} \
313    %{shared:-G -dy %{!mimpure-text:-z text}} \
314    %{symbolic:-Bsymbolic -G -dy -z text} \
315    %{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
316    %{G:-G} \
317    %{YP,*} \
318    %{R*} \
319    %{compat-bsd: \
320      %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
321        %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
322        %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
323      -R /usr/ucblib} \
324    %{!compat-bsd: \
325      %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
326        %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
327        %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}} \
328    %{Qy:} %{!Qn:-Qy}"
329    
330 #undef MD_STARTFILE_PREFIX
331 #define MD_STARTFILE_PREFIX "/usr/lib/sparcv9/"
332  
333 #endif /* ! SPARC_BI_ARCH */
334
335 #endif