OSDN Git Service

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