]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF. |
5b86a469 | 2 | Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005 |
aa335b76 | 3 | Free Software Foundation, Inc. |
bfe87013 DE |
4 | Contributed by David S. Miller (davem@caip.rutgers.edu) |
5 | ||
de0a398e | 6 | This file is part of GCC. |
bfe87013 | 7 | |
de0a398e | 8 | GCC is free software; you can redistribute it and/or modify |
bfe87013 DE |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
de0a398e | 13 | GCC is distributed in the hope that it will be useful, |
bfe87013 DE |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
de0a398e | 19 | along with GCC; see the file COPYING. If not, write to |
39d14dda KC |
20 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
21 | Boston, MA 02110-1301, USA. */ | |
bfe87013 | 22 | |
9b8466f4 NB |
23 | #define TARGET_OS_CPP_BUILTINS() \ |
24 | do \ | |
25 | { \ | |
26 | builtin_define_std ("unix"); \ | |
27 | builtin_define_std ("linux"); \ | |
28 | builtin_define ("_LONGLONG"); \ | |
29 | builtin_define ("__gnu_linux__"); \ | |
26b0ad13 | 30 | builtin_assert ("system=linux"); \ |
9b8466f4 NB |
31 | builtin_assert ("system=unix"); \ |
32 | builtin_assert ("system=posix"); \ | |
dc316086 PM |
33 | if (flag_pic) \ |
34 | { \ | |
35 | builtin_define ("__PIC__"); \ | |
36 | builtin_define ("__pic__"); \ | |
37 | } \ | |
9b8466f4 NB |
38 | } \ |
39 | while (0) | |
40 | ||
80ffc95e | 41 | /* Don't assume anything about the header files. */ |
bfe87013 DE |
42 | #define NO_IMPLICIT_EXTERN_C |
43 | ||
bfe87013 DE |
44 | #undef MD_EXEC_PREFIX |
45 | #undef MD_STARTFILE_PREFIX | |
46 | ||
f2c0cb15 JJ |
47 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \ |
48 | || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \ | |
49 | || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 | |
345a6161 DM |
50 | /* A 64 bit v9 compiler with stack-bias, |
51 | in a Medium/Low code model environment. */ | |
52 | ||
53 | #undef TARGET_DEFAULT | |
54 | #define TARGET_DEFAULT \ | |
55 | (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ | |
33074e5f | 56 | + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128) |
345a6161 DM |
57 | #endif |
58 | ||
a0a301fc DE |
59 | #undef ASM_CPU_DEFAULT_SPEC |
60 | #define ASM_CPU_DEFAULT_SPEC "-Av9a" | |
bfe87013 | 61 | |
4710d3eb JJ |
62 | #ifdef SPARC_BI_ARCH |
63 | ||
64 | #undef CPP_ARCH32_SPEC | |
9b8466f4 | 65 | #define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__}" |
4710d3eb JJ |
66 | |
67 | #endif | |
68 | ||
956d6950 JL |
69 | /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add |
70 | the GNU/Linux magical crtbegin.o file (see crtstuff.c) which | |
bfe87013 | 71 | provides part of the support for getting C++ file-scope static |
80ffc95e | 72 | object constructed before entering `main'. */ |
bfe87013 DE |
73 | |
74 | #undef STARTFILE_SPEC | |
345a6161 | 75 | |
24a4dd31 | 76 | #ifdef HAVE_LD_PIE |
5bbcd587 | 77 | #define STARTFILE_SPEC \ |
24a4dd31 JJ |
78 | "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ |
79 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}" | |
80 | #else | |
81 | #define STARTFILE_SPEC \ | |
82 | "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\ | |
83 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}" | |
84 | #endif | |
bfe87013 | 85 | |
956d6950 JL |
86 | /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on |
87 | the GNU/Linux magical crtend.o file (see crtstuff.c) which | |
bfe87013 DE |
88 | provides part of the support for getting C++ file-scope static |
89 | object constructed before entering `main', followed by a normal | |
956d6950 | 90 | GNU/Linux "finalizer" file, `crtn.o'. */ |
bfe87013 DE |
91 | |
92 | #undef ENDFILE_SPEC | |
345a6161 | 93 | |
5bbcd587 | 94 | #define ENDFILE_SPEC \ |
24a4dd31 | 95 | "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ |
5bbcd587 | 96 | %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" |
345a6161 | 97 | |
2be1602e DM |
98 | /* The GNU C++ standard library requires that these macros be defined. */ |
99 | #undef CPLUSPLUS_CPP_SPEC | |
100 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | |
101 | ||
345a6161 DM |
102 | #undef TARGET_VERSION |
103 | #define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)"); | |
a0a301fc DE |
104 | |
105 | /* The default code model. */ | |
106 | #undef SPARC_DEFAULT_CMODEL | |
be3f1ff5 | 107 | #define SPARC_DEFAULT_CMODEL CM_MEDLOW |
bfe87013 | 108 | |
bfe87013 | 109 | #undef WCHAR_TYPE |
247cfc5c JJ |
110 | #define WCHAR_TYPE "int" |
111 | ||
bfe87013 | 112 | #undef WCHAR_TYPE_SIZE |
247cfc5c JJ |
113 | #define WCHAR_TYPE_SIZE 32 |
114 | ||
ba31d94e | 115 | /* Define for support of TFmode long double. |
56149abc | 116 | SPARC ABI says that long double is 4 words. */ |
a0a301fc | 117 | #undef LONG_DOUBLE_TYPE_SIZE |
4710d3eb JJ |
118 | #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) |
119 | ||
4710d3eb JJ |
120 | /* Define this to set long double type size to use in libgcc2.c, which can |
121 | not depend on target_flags. */ | |
122 | #if defined(__arch64__) || defined(__LONG_DOUBLE_128__) | |
123 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 | |
124 | #else | |
125 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 | |
126 | #endif | |
345a6161 | 127 | |
a0a301fc DE |
128 | #undef CPP_SUBTARGET_SPEC |
129 | #define CPP_SUBTARGET_SPEC "\ | |
bfe87013 | 130 | %{posix:-D_POSIX_SOURCE} \ |
afc96791 | 131 | %{pthread:-D_REENTRANT} \ |
bfe87013 | 132 | " |
afc96791 | 133 | |
bfe87013 DE |
134 | #undef LIB_SPEC |
135 | #define LIB_SPEC \ | |
17772b2a JJ |
136 | "%{pthread:-lpthread} \ |
137 | %{shared:-lc} \ | |
138 | %{!shared: %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" | |
bfe87013 | 139 | |
956d6950 | 140 | /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support |
bfe87013 DE |
141 | for the special GCC options -static and -shared, which allow us to |
142 | link things in one of these three modes by applying the appropriate | |
143 | combinations of options at link-time. We like to support here for | |
144 | as many of the other GNU linker options as possible. But I don't | |
145 | have the time to search for those flags. I am sure how to add | |
146 | support for -soname shared_object_name. H.J. | |
147 | ||
148 | I took out %{v:%{!V:-V}}. It is too much :-(. They can use | |
149 | -Wl,-V. | |
150 | ||
151 | When the -shared link option is used a final link is not being | |
152 | done. */ | |
153 | ||
80ffc95e | 154 | /* If ELF is the default format, we should not use /lib/elf. */ |
bfe87013 | 155 | |
345a6161 DM |
156 | #ifdef SPARC_BI_ARCH |
157 | ||
158 | #undef SUBTARGET_EXTRA_SPECS | |
159 | #define SUBTARGET_EXTRA_SPECS \ | |
160 | { "link_arch32", LINK_ARCH32_SPEC }, \ | |
161 | { "link_arch64", LINK_ARCH64_SPEC }, \ | |
162 | { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ | |
163 | { "link_arch", LINK_ARCH_SPEC }, | |
164 | ||
165 | #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | |
166 | %{!shared: \ | |
167 | %{!ibcs: \ | |
168 | %{!static: \ | |
169 | %{rdynamic:-export-dynamic} \ | |
170 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | |
171 | %{static:-static}}} \ | |
172 | " | |
173 | ||
174 | #define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ | |
175 | %{!shared: \ | |
176 | %{!ibcs: \ | |
177 | %{!static: \ | |
178 | %{rdynamic:-export-dynamic} \ | |
179 | %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ | |
180 | %{static:-static}}} \ | |
181 | " | |
182 | ||
183 | #define LINK_ARCH_SPEC "\ | |
184 | %{m32:%(link_arch32)} \ | |
185 | %{m64:%(link_arch64)} \ | |
186 | %{!m32:%{!m64:%(link_arch_default)}} \ | |
187 | " | |
188 | ||
189 | #define LINK_ARCH_DEFAULT_SPEC \ | |
190 | (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) | |
191 | ||
bfe87013 | 192 | #undef LINK_SPEC |
345a6161 DM |
193 | #define LINK_SPEC "\ |
194 | %(link_arch) \ | |
195 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 196 | %{!mno-relax:%{!r:-relax}} \ |
345a6161 DM |
197 | " |
198 | ||
199 | #undef CC1_SPEC | |
200 | #if DEFAULT_ARCH32_P | |
201 | #define CC1_SPEC "\ | |
202 | %{sun4:} %{target:} \ | |
203 | %{mcypress:-mcpu=cypress} \ | |
204 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
205 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
d6964c30 | 206 | %{m32:%{m64:%emay not use both -m32 and -m64}} \ |
4710d3eb | 207 | %{m64:-mptr64 -mstack-bias -mlong-double-128 \ |
247cfc5c JJ |
208 | %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=ultrasparc}}}}}}} \ |
209 | %{!mno-vis:%{!mcpu=v9:-mvis}}} \ | |
345a6161 DM |
210 | " |
211 | #else | |
212 | #define CC1_SPEC "\ | |
213 | %{sun4:} %{target:} \ | |
214 | %{mcypress:-mcpu=cypress} \ | |
215 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
216 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
d6964c30 | 217 | %{m32:%{m64:%emay not use both -m32 and -m64}} \ |
4710d3eb | 218 | %{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \ |
b25c3a22 | 219 | %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=cypress}}}}}}}} \ |
9ce13279 | 220 | %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \ |
247cfc5c | 221 | %{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \ |
345a6161 DM |
222 | " |
223 | #endif | |
224 | ||
942e0f44 JJ |
225 | /* Support for a compile-time default CPU, et cetera. The rules are: |
226 | --with-cpu is ignored if -mcpu is specified. | |
227 | --with-tune is ignored if -mtune is specified. | |
228 | --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu | |
229 | are specified. | |
230 | In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)} | |
231 | here, otherwise say -mcpu=v7 would be passed even when -m64. | |
232 | CC1_SPEC above takes care of this instead. */ | |
233 | #undef OPTION_DEFAULT_SPECS | |
234 | #if DEFAULT_ARCH32_P | |
235 | #define OPTION_DEFAULT_SPECS \ | |
236 | {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ | |
237 | {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ | |
238 | {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" } | |
239 | #else | |
240 | #define OPTION_DEFAULT_SPECS \ | |
241 | {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ | |
242 | {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ | |
243 | {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" } | |
244 | #endif | |
245 | ||
345a6161 DM |
246 | #if DEFAULT_ARCH32_P |
247 | #define MULTILIB_DEFAULTS { "m32" } | |
248 | #else | |
249 | #define MULTILIB_DEFAULTS { "m64" } | |
250 | #endif | |
251 | ||
252 | #else /* !SPARC_BI_ARCH */ | |
253 | ||
254 | #undef LINK_SPEC | |
e95b1e6a | 255 | #define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ |
bfe87013 DE |
256 | %{!shared: \ |
257 | %{!ibcs: \ | |
258 | %{!static: \ | |
259 | %{rdynamic:-export-dynamic} \ | |
345a6161 | 260 | %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ |
bfe87013 DE |
261 | %{static:-static}}} \ |
262 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 263 | %{!mno-relax:%{!r:-relax}} \ |
bfe87013 DE |
264 | " |
265 | ||
345a6161 DM |
266 | #endif /* !SPARC_BI_ARCH */ |
267 | ||
bfe87013 | 268 | /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). |
80ffc95e | 269 | It's safe to pass -s always, even if -g is not used. */ |
bfe87013 DE |
270 | #undef ASM_SPEC |
271 | #define ASM_SPEC "\ | |
272 | %{V} \ | |
273 | %{v:%{!V:-V}} \ | |
274 | %{!Qn:-Qy} \ | |
275 | %{n} \ | |
276 | %{T} \ | |
277 | %{Ym,*} \ | |
278 | %{Wa,*:%*} \ | |
24a4dd31 | 279 | -s %{fpic|fPIC|fpie|fPIE:-K PIC} \ |
bfe87013 | 280 | %{mlittle-endian:-EL} \ |
e95b1e6a | 281 | %(asm_cpu) %(asm_arch) %(asm_relax)" |
bfe87013 DE |
282 | |
283 | /* Same as sparc.h */ | |
284 | #undef DBX_REGISTER_NUMBER | |
285 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) | |
286 | ||
bfe87013 DE |
287 | #undef ASM_OUTPUT_ALIGNED_LOCAL |
288 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
289 | do { \ | |
290 | fputs ("\t.local\t", (FILE)); \ | |
291 | assemble_name ((FILE), (NAME)); \ | |
292 | putc ('\n', (FILE)); \ | |
293 | ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ | |
294 | } while (0) | |
295 | ||
296 | #undef COMMON_ASM_OP | |
471b6f1b | 297 | #define COMMON_ASM_OP "\t.common\t" |
bfe87013 | 298 | |
59f96879 RH |
299 | #undef LOCAL_LABEL_PREFIX |
300 | #define LOCAL_LABEL_PREFIX "." | |
301 | ||
bfe87013 DE |
302 | /* This is how to store into the string LABEL |
303 | the symbol_ref name of an internal numbered label where | |
304 | PREFIX is the class of label and NUM is the number within the class. | |
305 | This is suitable for output with `assemble_name'. */ | |
306 | ||
307 | #undef ASM_GENERATE_INTERNAL_LABEL | |
308 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
e59f7d3d | 309 | sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM)) |
bfe87013 | 310 | |
bfe87013 DE |
311 | /* DWARF bits. */ |
312 | ||
313 | /* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. | |
d6a7951f | 314 | Obviously the Dwarf2 folks haven't tried to actually build systems |
bfe87013 DE |
315 | with their spec. On a 64-bit system, only 64-bit relocs become |
316 | RELATIVE relocations. */ | |
317 | ||
318 | /* #define DWARF_OFFSET_SIZE PTR_SIZE */ | |
275b60d6 | 319 | |
45dcc026 JJ |
320 | #undef DITF_CONVERSION_LIBFUNCS |
321 | #define DITF_CONVERSION_LIBFUNCS 1 | |
322 | ||
275b60d6 JJ |
323 | #if defined(HAVE_LD_EH_FRAME_HDR) |
324 | #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " | |
325 | #endif | |
f7e0e539 | 326 | \f |
5751a10b JJ |
327 | #ifdef HAVE_AS_TLS |
328 | #undef TARGET_SUN_TLS | |
329 | #undef TARGET_GNU_TLS | |
330 | #define TARGET_SUN_TLS 0 | |
331 | #define TARGET_GNU_TLS 1 | |
332 | #endif | |
333 | \f | |
b5de1a27 DM |
334 | /* Don't be different from other Linux platforms in this regard. */ |
335 | #define HANDLE_PRAGMA_PACK_PUSH_POP | |
7a31a340 DM |
336 | |
337 | /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ | |
338 | #undef CTORS_SECTION_ASM_OP | |
339 | #undef DTORS_SECTION_ASM_OP | |
db430d26 | 340 | |
3017c534 DM |
341 | /* Determine whether the the entire c99 runtime is present in the |
342 | runtime library. */ | |
343 | #define TARGET_C99_FUNCTIONS 1 | |
344 | ||
c2cd64b5 JJ |
345 | #define TARGET_HAS_F_SETLKW |
346 | ||
d00eacab | 347 | #undef LINK_GCC_C_SEQUENCE_SPEC |
42df2193 JJ |
348 | #define LINK_GCC_C_SEQUENCE_SPEC \ |
349 | "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" | |
350 | ||
8efcd34f AM |
351 | /* Use --as-needed -lgcc_s for eh support. */ |
352 | #ifdef HAVE_LD_AS_NEEDED | |
353 | #define USE_LD_AS_NEEDED 1 | |
354 | #endif | |
355 | ||
8662eb14 | 356 | #define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h" |
548a6c4f EB |
357 | |
358 | /* Linux currently uses RMO in uniprocessor mode, which is equivalent to | |
359 | TMO, and TMO in multiprocessor mode. But they reserve the right to | |
360 | change their minds. */ | |
361 | #undef SPARC_RELAXED_ORDERING | |
362 | #define SPARC_RELAXED_ORDERING true | |
5e77eb53 EB |
363 | |
364 | #undef NEED_INDICATE_EXEC_STACK | |
365 | #define NEED_INDICATE_EXEC_STACK 1 | |
8ec11fe9 JJ |
366 | |
367 | #ifdef TARGET_LIBC_PROVIDES_SSP | |
368 | /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], | |
369 | sparc64 glibc provides it at [%g7 + 0x28]. */ | |
370 | #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14) | |
371 | #endif |