]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF. |
047142d3 | 2 | Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc. |
bfe87013 DE |
3 | Contributed by David S. Miller (davem@caip.rutgers.edu) |
4 | ||
5 | This file is part of GNU CC. | |
6 | ||
7 | GNU CC is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | GNU CC is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GNU CC; see the file COPYING. If not, write to | |
19 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
20 | Boston, MA 02111-1307, USA. */ | |
21 | ||
a0a301fc | 22 | #define LINUX_DEFAULT_ELF |
bfe87013 | 23 | |
17720332 AM |
24 | #define HANDLE_PRAGMA_PACK_PUSH_POP |
25 | ||
80ffc95e | 26 | /* Don't assume anything about the header files. */ |
bfe87013 DE |
27 | #define NO_IMPLICIT_EXTERN_C |
28 | ||
bfe87013 DE |
29 | #undef MD_EXEC_PREFIX |
30 | #undef MD_STARTFILE_PREFIX | |
31 | ||
345a6161 DM |
32 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc |
33 | /* A 64 bit v9 compiler with stack-bias, | |
34 | in a Medium/Low code model environment. */ | |
35 | ||
36 | #undef TARGET_DEFAULT | |
37 | #define TARGET_DEFAULT \ | |
38 | (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ | |
33074e5f | 39 | + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128) |
345a6161 DM |
40 | #endif |
41 | ||
a0a301fc DE |
42 | #undef ASM_CPU_DEFAULT_SPEC |
43 | #define ASM_CPU_DEFAULT_SPEC "-Av9a" | |
bfe87013 | 44 | |
4710d3eb JJ |
45 | #ifdef SPARC_BI_ARCH |
46 | ||
47 | #undef CPP_ARCH32_SPEC | |
48 | #define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__} \ | |
49 | -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \ | |
2b57e919 | 50 | -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc" |
4710d3eb JJ |
51 | |
52 | #endif | |
53 | ||
956d6950 JL |
54 | /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add |
55 | the GNU/Linux magical crtbegin.o file (see crtstuff.c) which | |
bfe87013 | 56 | provides part of the support for getting C++ file-scope static |
80ffc95e | 57 | object constructed before entering `main'. */ |
bfe87013 DE |
58 | |
59 | #undef STARTFILE_SPEC | |
345a6161 DM |
60 | |
61 | #define STARTFILE_SPEC32 \ | |
bfe87013 DE |
62 | "%{!shared: \ |
63 | %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ | |
275b60d6 JJ |
64 | crti.o%s %{static:crtbeginT.o%s}\ |
65 | %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" | |
bfe87013 | 66 | |
345a6161 DM |
67 | #define STARTFILE_SPEC64 \ |
68 | "%{!shared: \ | |
69 | %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} %{!p:/usr/lib64/crt1.o%s}}}\ | |
275b60d6 JJ |
70 | /usr/lib64/crti.o%s %{static:crtbeginT.o%s}\ |
71 | %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" | |
72 | ||
345a6161 DM |
73 | #ifdef SPARC_BI_ARCH |
74 | ||
75 | #if DEFAULT_ARCH32_P | |
76 | #define STARTFILE_SPEC "\ | |
77 | %{m32:" STARTFILE_SPEC32 "} \ | |
78 | %{m64:" STARTFILE_SPEC64 "} \ | |
79 | %{!m32:%{!m64:" STARTFILE_SPEC32 "}}" | |
80 | #else | |
81 | #define STARTFILE_SPEC "\ | |
82 | %{m32:" STARTFILE_SPEC32 "} \ | |
83 | %{m64:" STARTFILE_SPEC64 "} \ | |
84 | %{!m32:%{!m64:" STARTFILE_SPEC64 "}}" | |
85 | #endif | |
86 | ||
87 | #else | |
88 | ||
89 | #define STARTFILE_SPEC STARTFILE_SPEC64 | |
90 | ||
91 | #endif | |
92 | ||
956d6950 JL |
93 | /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on |
94 | the GNU/Linux magical crtend.o file (see crtstuff.c) which | |
bfe87013 DE |
95 | provides part of the support for getting C++ file-scope static |
96 | object constructed before entering `main', followed by a normal | |
956d6950 | 97 | GNU/Linux "finalizer" file, `crtn.o'. */ |
bfe87013 DE |
98 | |
99 | #undef ENDFILE_SPEC | |
345a6161 DM |
100 | |
101 | #define ENDFILE_SPEC32 \ | |
bfe87013 DE |
102 | "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" |
103 | ||
345a6161 DM |
104 | #define ENDFILE_SPEC64 \ |
105 | "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s" | |
106 | ||
107 | #ifdef SPARC_BI_ARCH | |
bfe87013 | 108 | |
345a6161 DM |
109 | #if DEFAULT_ARCH32_P |
110 | #define ENDFILE_SPEC "\ | |
111 | %{m32:" ENDFILE_SPEC32 "} \ | |
112 | %{m64:" ENDFILE_SPEC64 "} \ | |
113 | %{!m32:%{!m64:" ENDFILE_SPEC32 "}}" | |
114 | #else | |
115 | #define ENDFILE_SPEC "\ | |
116 | %{m32:" ENDFILE_SPEC32 "} \ | |
117 | %{m64:" ENDFILE_SPEC64 "} \ | |
118 | %{!m32:%{!m64:" ENDFILE_SPEC64 "}}" | |
119 | #endif | |
bfe87013 | 120 | |
345a6161 DM |
121 | #else |
122 | ||
123 | #define ENDFILE_SPEC ENDFILE_SPEC64 | |
124 | ||
125 | #endif | |
126 | ||
2be1602e DM |
127 | /* The GNU C++ standard library requires that these macros be defined. */ |
128 | #undef CPLUSPLUS_CPP_SPEC | |
129 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | |
130 | ||
345a6161 DM |
131 | #undef TARGET_VERSION |
132 | #define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)"); | |
a0a301fc DE |
133 | |
134 | /* The default code model. */ | |
135 | #undef SPARC_DEFAULT_CMODEL | |
be3f1ff5 | 136 | #define SPARC_DEFAULT_CMODEL CM_MEDLOW |
bfe87013 | 137 | |
4710d3eb | 138 | #undef SUBTARGET_SWITCHES |
047142d3 PT |
139 | #define SUBTARGET_SWITCHES \ |
140 | {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \ | |
141 | {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") }, | |
4710d3eb | 142 | |
bfe87013 | 143 | #undef WCHAR_TYPE |
247cfc5c JJ |
144 | #define WCHAR_TYPE "int" |
145 | ||
bfe87013 | 146 | #undef WCHAR_TYPE_SIZE |
247cfc5c JJ |
147 | #define WCHAR_TYPE_SIZE 32 |
148 | ||
ba31d94e | 149 | /* Define for support of TFmode long double. |
4710d3eb | 150 | Sparc ABI says that long double is 4 words. */ |
a0a301fc | 151 | #undef LONG_DOUBLE_TYPE_SIZE |
4710d3eb JJ |
152 | #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) |
153 | ||
154 | /* Constant which presents upper bound of the above value. */ | |
155 | #undef MAX_LONG_DOUBLE_TYPE_SIZE | |
156 | #define MAX_LONG_DOUBLE_TYPE_SIZE 128 | |
157 | ||
158 | /* Define this to set long double type size to use in libgcc2.c, which can | |
159 | not depend on target_flags. */ | |
160 | #if defined(__arch64__) || defined(__LONG_DOUBLE_128__) | |
161 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 | |
162 | #else | |
163 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 | |
164 | #endif | |
345a6161 | 165 | |
bfe87013 | 166 | #undef CPP_PREDEFINES |
2b57e919 | 167 | #define CPP_PREDEFINES "-D__ELF__ -Dunix -D_LONGLONG -D__sparc__ -Dlinux -Asystem=unix -Asystem=posix" |
bfe87013 | 168 | |
a0a301fc DE |
169 | #undef CPP_SUBTARGET_SPEC |
170 | #define CPP_SUBTARGET_SPEC "\ | |
bfe87013 DE |
171 | %{fPIC:-D__PIC__ -D__pic__} \ |
172 | %{fpic:-D__PIC__ -D__pic__} \ | |
bfe87013 | 173 | %{posix:-D_POSIX_SOURCE} \ |
afc96791 | 174 | %{pthread:-D_REENTRANT} \ |
bfe87013 | 175 | " |
afc96791 | 176 | |
bfe87013 DE |
177 | #undef LIB_SPEC |
178 | #define LIB_SPEC \ | |
1398405b L |
179 | "%{shared: -lc} \ |
180 | %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \ | |
afc96791 | 181 | %{profile:-lc_p} %{!profile: -lc}}" |
bfe87013 | 182 | |
956d6950 | 183 | /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support |
bfe87013 DE |
184 | for the special GCC options -static and -shared, which allow us to |
185 | link things in one of these three modes by applying the appropriate | |
186 | combinations of options at link-time. We like to support here for | |
187 | as many of the other GNU linker options as possible. But I don't | |
188 | have the time to search for those flags. I am sure how to add | |
189 | support for -soname shared_object_name. H.J. | |
190 | ||
191 | I took out %{v:%{!V:-V}}. It is too much :-(. They can use | |
192 | -Wl,-V. | |
193 | ||
194 | When the -shared link option is used a final link is not being | |
195 | done. */ | |
196 | ||
80ffc95e | 197 | /* If ELF is the default format, we should not use /lib/elf. */ |
bfe87013 | 198 | |
345a6161 DM |
199 | #ifdef SPARC_BI_ARCH |
200 | ||
201 | #undef SUBTARGET_EXTRA_SPECS | |
202 | #define SUBTARGET_EXTRA_SPECS \ | |
203 | { "link_arch32", LINK_ARCH32_SPEC }, \ | |
204 | { "link_arch64", LINK_ARCH64_SPEC }, \ | |
205 | { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ | |
206 | { "link_arch", LINK_ARCH_SPEC }, | |
207 | ||
208 | #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | |
209 | %{!shared: \ | |
210 | %{!ibcs: \ | |
211 | %{!static: \ | |
212 | %{rdynamic:-export-dynamic} \ | |
213 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | |
214 | %{static:-static}}} \ | |
215 | " | |
216 | ||
217 | #define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ | |
218 | %{!shared: \ | |
219 | %{!ibcs: \ | |
220 | %{!static: \ | |
221 | %{rdynamic:-export-dynamic} \ | |
222 | %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ | |
223 | %{static:-static}}} \ | |
224 | " | |
225 | ||
226 | #define LINK_ARCH_SPEC "\ | |
227 | %{m32:%(link_arch32)} \ | |
228 | %{m64:%(link_arch64)} \ | |
229 | %{!m32:%{!m64:%(link_arch_default)}} \ | |
230 | " | |
231 | ||
232 | #define LINK_ARCH_DEFAULT_SPEC \ | |
233 | (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) | |
234 | ||
bfe87013 | 235 | #undef LINK_SPEC |
345a6161 DM |
236 | #define LINK_SPEC "\ |
237 | %(link_arch) \ | |
238 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 239 | %{!mno-relax:%{!r:-relax}} \ |
345a6161 DM |
240 | " |
241 | ||
242 | #undef CC1_SPEC | |
243 | #if DEFAULT_ARCH32_P | |
244 | #define CC1_SPEC "\ | |
245 | %{sun4:} %{target:} \ | |
246 | %{mcypress:-mcpu=cypress} \ | |
247 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
248 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
4710d3eb | 249 | %{m64:-mptr64 -mstack-bias -mlong-double-128 \ |
247cfc5c JJ |
250 | %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=ultrasparc}}}}}}} \ |
251 | %{!mno-vis:%{!mcpu=v9:-mvis}}} \ | |
345a6161 DM |
252 | " |
253 | #else | |
254 | #define CC1_SPEC "\ | |
255 | %{sun4:} %{target:} \ | |
256 | %{mcypress:-mcpu=cypress} \ | |
257 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
258 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
4710d3eb | 259 | %{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \ |
b25c3a22 | 260 | %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=cypress}}}}}}}} \ |
9ce13279 | 261 | %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \ |
247cfc5c | 262 | %{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \ |
345a6161 DM |
263 | " |
264 | #endif | |
265 | ||
266 | #if DEFAULT_ARCH32_P | |
267 | #define MULTILIB_DEFAULTS { "m32" } | |
268 | #else | |
269 | #define MULTILIB_DEFAULTS { "m64" } | |
270 | #endif | |
271 | ||
272 | #else /* !SPARC_BI_ARCH */ | |
273 | ||
274 | #undef LINK_SPEC | |
e95b1e6a | 275 | #define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ |
bfe87013 DE |
276 | %{!shared: \ |
277 | %{!ibcs: \ | |
278 | %{!static: \ | |
279 | %{rdynamic:-export-dynamic} \ | |
345a6161 | 280 | %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ |
bfe87013 DE |
281 | %{static:-static}}} \ |
282 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 283 | %{!mno-relax:%{!r:-relax}} \ |
bfe87013 DE |
284 | " |
285 | ||
345a6161 DM |
286 | #endif /* !SPARC_BI_ARCH */ |
287 | ||
bfe87013 | 288 | /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). |
80ffc95e | 289 | It's safe to pass -s always, even if -g is not used. */ |
bfe87013 DE |
290 | #undef ASM_SPEC |
291 | #define ASM_SPEC "\ | |
292 | %{V} \ | |
293 | %{v:%{!V:-V}} \ | |
294 | %{!Qn:-Qy} \ | |
295 | %{n} \ | |
296 | %{T} \ | |
297 | %{Ym,*} \ | |
298 | %{Wa,*:%*} \ | |
299 | -s %{fpic:-K PIC} %{fPIC:-K PIC} \ | |
300 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 301 | %(asm_cpu) %(asm_arch) %(asm_relax)" |
bfe87013 DE |
302 | |
303 | /* Same as sparc.h */ | |
304 | #undef DBX_REGISTER_NUMBER | |
305 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) | |
306 | ||
307 | /* System V Release 4 uses DWARF debugging info. Buf DWARF1 doesn't do | |
308 | 64-bit anything, so we use DWARF2. */ | |
309 | ||
310 | #undef DWARF2_DEBUGGING_INFO | |
311 | #undef DWARF_DEBUGGING_INFO | |
312 | #undef DBX_DEBUGGING_INFO | |
313 | #define DWARF2_DEBUGGING_INFO | |
314 | #define DBX_DEBUGGING_INFO | |
315 | ||
bfe87013 DE |
316 | #undef ASM_OUTPUT_ALIGNED_LOCAL |
317 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
318 | do { \ | |
319 | fputs ("\t.local\t", (FILE)); \ | |
320 | assemble_name ((FILE), (NAME)); \ | |
321 | putc ('\n', (FILE)); \ | |
322 | ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ | |
323 | } while (0) | |
324 | ||
325 | #undef COMMON_ASM_OP | |
471b6f1b | 326 | #define COMMON_ASM_OP "\t.common\t" |
bfe87013 | 327 | |
59f96879 RH |
328 | #undef LOCAL_LABEL_PREFIX |
329 | #define LOCAL_LABEL_PREFIX "." | |
330 | ||
bfe87013 DE |
331 | /* This is how to output a definition of an internal numbered label where |
332 | PREFIX is the class of label and NUM is the number within the class. */ | |
333 | ||
334 | #undef ASM_OUTPUT_INTERNAL_LABEL | |
335 | #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ | |
336 | fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) | |
337 | ||
338 | /* This is how to output a reference to an internal numbered label where | |
339 | PREFIX is the class of label and NUM is the number within the class. */ | |
340 | ||
341 | #undef ASM_OUTPUT_INTERNAL_LABELREF | |
342 | #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ | |
343 | fprintf (FILE, ".L%s%d", PREFIX, NUM) | |
344 | ||
345 | /* This is how to store into the string LABEL | |
346 | the symbol_ref name of an internal numbered label where | |
347 | PREFIX is the class of label and NUM is the number within the class. | |
348 | This is suitable for output with `assemble_name'. */ | |
349 | ||
350 | #undef ASM_GENERATE_INTERNAL_LABEL | |
351 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
e59f7d3d | 352 | sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM)) |
bfe87013 | 353 | |
bfe87013 DE |
354 | /* DWARF bits. */ |
355 | ||
356 | /* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. | |
d6a7951f | 357 | Obviously the Dwarf2 folks haven't tried to actually build systems |
bfe87013 DE |
358 | with their spec. On a 64-bit system, only 64-bit relocs become |
359 | RELATIVE relocations. */ | |
360 | ||
361 | /* #define DWARF_OFFSET_SIZE PTR_SIZE */ | |
275b60d6 JJ |
362 | |
363 | #if defined(HAVE_LD_EH_FRAME_HDR) | |
364 | #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " | |
365 | #endif | |
f7e0e539 | 366 | \f |