]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions for SPARC running Linux-based GNU systems with ELF. |
c063dc98 | 2 | Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
1583720a DE |
3 | Contributed by Eddie C. Dost (ecd@skynet.be) |
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 | ||
22 | #define LINUX_DEFAULT_ELF | |
23 | ||
24 | /* Don't assume anything about the header files. */ | |
25 | #define NO_IMPLICIT_EXTERN_C | |
26 | ||
956d6950 | 27 | /* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is. |
1583720a DE |
28 | For now, we play safe. It may change later. */ |
29 | ||
30 | #if 0 | |
31 | #undef MULTIBYTE_CHARS | |
32 | #define MULTIBYTE_CHARS 1 | |
33 | #endif | |
34 | ||
bba17b29 L |
35 | #ifndef USE_GNULIBC_1 |
36 | #undef DEFAULT_VTABLE_THUNKS | |
37 | #define DEFAULT_VTABLE_THUNKS 1 | |
38 | #endif | |
39 | ||
1583720a DE |
40 | /* Use stabs instead of DWARF debug format. */ |
41 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
a0a301fc | 42 | |
1583720a DE |
43 | #include <sparc/sysv4.h> |
44 | ||
45 | #undef MD_EXEC_PREFIX | |
46 | #undef MD_STARTFILE_PREFIX | |
47 | ||
48 | /* Output at beginning of assembler file. */ | |
49 | /* The .file command should always begin the output. */ | |
50 | #undef ASM_FILE_START | |
51 | #define ASM_FILE_START(FILE) \ | |
52 | do { \ | |
53 | output_file_directive (FILE, main_input_filename); \ | |
54 | fprintf (FILE, "\t.version\t\"01.01\"\n"); \ | |
55 | } while (0) | |
56 | ||
956d6950 JL |
57 | /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add |
58 | the GNU/Linux magical crtbegin.o file (see crtstuff.c) which | |
1583720a DE |
59 | provides part of the support for getting C++ file-scope static |
60 | object constructed before entering `main'. */ | |
61 | ||
62 | #undef STARTFILE_SPEC | |
63 | #define STARTFILE_SPEC \ | |
64 | "%{!shared: \ | |
65 | %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ | |
66 | crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" | |
67 | ||
956d6950 JL |
68 | /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on |
69 | the GNU/Linux magical crtend.o file (see crtstuff.c) which | |
1583720a DE |
70 | provides part of the support for getting C++ file-scope static |
71 | object constructed before entering `main', followed by a normal | |
956d6950 | 72 | GNU/Linux "finalizer" file, `crtn.o'. */ |
1583720a DE |
73 | |
74 | #undef ENDFILE_SPEC | |
75 | #define ENDFILE_SPEC \ | |
76 | "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" | |
77 | ||
985c5e5b RK |
78 | /* This is for -profile to use -lc_p instead of -lc. */ |
79 | #undef CC1_SPEC | |
80 | #define CC1_SPEC "%{profile:-p} \ | |
81 | %{sun4:} %{target:} \ | |
82 | %{mcypress:-mcpu=cypress} \ | |
83 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
84 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
85 | " | |
86 | ||
1583720a | 87 | #undef TARGET_VERSION |
956d6950 | 88 | #define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)"); |
1583720a | 89 | |
4710d3eb JJ |
90 | #undef SUBTARGET_SWITCHES |
91 | #define SUBTARGET_SWITCHES \ | |
92 | {"long-double-64", -MASK_LONG_DOUBLE_128, "Use 64 bit long doubles" }, \ | |
93 | {"long-double-128", MASK_LONG_DOUBLE_128, "Use 128 bit long doubles" }, | |
94 | ||
1583720a DE |
95 | #undef SIZE_TYPE |
96 | #define SIZE_TYPE "unsigned int" | |
97 | ||
98 | #undef PTRDIFF_TYPE | |
99 | #define PTRDIFF_TYPE "int" | |
100 | ||
101 | #undef WCHAR_TYPE | |
247cfc5c | 102 | #define WCHAR_TYPE "int" |
1583720a DE |
103 | |
104 | #undef WCHAR_TYPE_SIZE | |
247cfc5c JJ |
105 | #define WCHAR_TYPE_SIZE 32 |
106 | ||
107 | #undef MAX_WCHAR_TYPE_SIZE | |
1583720a DE |
108 | |
109 | #undef CPP_PREDEFINES | |
6d8cf409 | 110 | #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sparc__ -Dlinux -Asystem(unix) -Asystem(posix)" |
1583720a | 111 | |
a0a301fc | 112 | #undef CPP_SUBTARGET_SPEC |
985c5e5b | 113 | #ifdef USE_GNULIBC_1 |
a0a301fc | 114 | #define CPP_SUBTARGET_SPEC \ |
4710d3eb JJ |
115 | "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \ |
116 | %{mlong-double-128:-D__LONG_DOUBLE_128__}" | |
985c5e5b | 117 | #else |
a0a301fc | 118 | #define CPP_SUBTARGET_SPEC \ |
4710d3eb JJ |
119 | "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} \ |
120 | %{pthread:-D_REENTRANT} %{mlong-double-128:-D__LONG_DOUBLE_128__}" | |
985c5e5b | 121 | #endif |
1583720a DE |
122 | |
123 | #undef LIB_SPEC | |
1583720a | 124 | /* We no longer link with libc_p.a or libg.a by default. If you |
956d6950 JL |
125 | want to profile or debug the GNU/Linux C library, please add |
126 | -lc_p or -ggdb to LDFLAGS at the link time, respectively. */ | |
985c5e5b RK |
127 | #if 1 |
128 | #ifdef USE_GNULIBC_1 | |
129 | #define LIB_SPEC \ | |
130 | "%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \ | |
131 | %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}" | |
132 | #else | |
1583720a | 133 | #define LIB_SPEC \ |
1398405b L |
134 | "%{shared: -lc} \ |
135 | %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \ | |
985c5e5b RK |
136 | %{profile:-lc_p} %{!profile: -lc}}" |
137 | #endif | |
1583720a DE |
138 | #else |
139 | #define LIB_SPEC \ | |
140 | "%{!shared: \ | |
141 | %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ | |
142 | %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}" | |
143 | #endif | |
144 | ||
956d6950 | 145 | /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support |
1583720a DE |
146 | for the special GCC options -static and -shared, which allow us to |
147 | link things in one of these three modes by applying the appropriate | |
148 | combinations of options at link-time. We like to support here for | |
149 | as many of the other GNU linker options as possible. But I don't | |
150 | have the time to search for those flags. I am sure how to add | |
151 | support for -soname shared_object_name. H.J. | |
152 | ||
153 | I took out %{v:%{!V:-V}}. It is too much :-(. They can use | |
154 | -Wl,-V. | |
155 | ||
156 | When the -shared link option is used a final link is not being | |
157 | done. */ | |
158 | ||
159 | /* If ELF is the default format, we should not use /lib/elf. */ | |
160 | ||
161 | #undef LINK_SPEC | |
985c5e5b | 162 | #ifdef USE_GNULIBC_1 |
1583720a DE |
163 | #ifndef LINUX_DEFAULT_ELF |
164 | #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | |
165 | %{!shared: \ | |
166 | %{!ibcs: \ | |
167 | %{!static: \ | |
168 | %{rdynamic:-export-dynamic} \ | |
169 | %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \ | |
170 | %{!rpath:-rpath /lib/elf/}} %{static:-static}}}" | |
171 | #else | |
172 | #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | |
173 | %{!shared: \ | |
174 | %{!ibcs: \ | |
175 | %{!static: \ | |
176 | %{rdynamic:-export-dynamic} \ | |
177 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \ | |
178 | %{static:-static}}}" | |
985c5e5b RK |
179 | #endif |
180 | #else | |
181 | #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | |
e95b1e6a | 182 | %{!mno-relax:%{!r:-relax}} \ |
985c5e5b RK |
183 | %{!shared: \ |
184 | %{!ibcs: \ | |
185 | %{!static: \ | |
186 | %{rdynamic:-export-dynamic} \ | |
187 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | |
188 | %{static:-static}}}" | |
1583720a DE |
189 | #endif |
190 | ||
191 | /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). | |
192 | It's safe to pass -s always, even if -g is not used. */ | |
193 | #undef ASM_SPEC | |
194 | #define ASM_SPEC \ | |
e95b1e6a JJ |
195 | "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} \ |
196 | %{fPIC:-K PIC} %(asm_relax)" | |
1583720a DE |
197 | |
198 | /* Same as sparc.h */ | |
199 | #undef DBX_REGISTER_NUMBER | |
200 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) | |
201 | ||
202 | /* We use stabs-in-elf for debugging, because that is what the native | |
203 | toolchain uses. XXX */ | |
204 | #undef PREFERRED_DEBUGGING_TYPE | |
205 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
206 | ||
207 | #undef ASM_OUTPUT_ALIGNED_LOCAL | |
208 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
209 | do { \ | |
210 | fputs ("\t.local\t", (FILE)); \ | |
211 | assemble_name ((FILE), (NAME)); \ | |
212 | putc ('\n', (FILE)); \ | |
213 | ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ | |
214 | } while (0) | |
215 | ||
216 | #undef COMMON_ASM_OP | |
217 | #define COMMON_ASM_OP "\t.common" | |
218 | ||
219 | /* This is how to output a definition of an internal numbered label where | |
220 | PREFIX is the class of label and NUM is the number within the class. */ | |
221 | ||
222 | #undef ASM_OUTPUT_INTERNAL_LABEL | |
223 | #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ | |
224 | fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) | |
225 | ||
226 | /* This is how to output a reference to an internal numbered label where | |
227 | PREFIX is the class of label and NUM is the number within the class. */ | |
228 | ||
229 | #undef ASM_OUTPUT_INTERNAL_LABELREF | |
230 | #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ | |
231 | fprintf (FILE, ".L%s%d", PREFIX, NUM) | |
232 | ||
233 | /* This is how to store into the string LABEL | |
234 | the symbol_ref name of an internal numbered label where | |
235 | PREFIX is the class of label and NUM is the number within the class. | |
236 | This is suitable for output with `assemble_name'. */ | |
237 | ||
238 | #undef ASM_GENERATE_INTERNAL_LABEL | |
239 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
240 | sprintf (LABEL, "*.L%s%d", PREFIX, NUM) | |
241 | ||
242 | \f | |
1583720a | 243 | /* Define for support of TFmode long double and REAL_ARITHMETIC. |
4710d3eb JJ |
244 | Sparc ABI says that long double is 4 words. */ |
245 | #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) | |
246 | ||
247 | /* Constant which presents upper bound of the above value. */ | |
248 | #define MAX_LONG_DOUBLE_TYPE_SIZE 128 | |
249 | ||
250 | /* Define this to set long double type size to use in libgcc2.c, which can | |
251 | not depend on target_flags. */ | |
252 | #ifdef __LONG_DOUBLE_128__ | |
253 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 | |
254 | #else | |
255 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 | |
1583720a | 256 | #endif |
f7e0e539 DM |
257 | \f |
258 | /* Override MACHINE_STATE_{SAVE,RESTORE} because we have special | |
259 | traps available which can get and set the condition codes | |
260 | reliably. */ | |
261 | #undef MACHINE_STATE_SAVE | |
262 | #define MACHINE_STATE_SAVE(ID) \ | |
263 | unsigned long int ms_flags, ms_saveret; \ | |
264 | asm volatile("ta 0x20\n\t" \ | |
265 | "mov %%g1, %0\n\t" \ | |
266 | "mov %%g2, %1\n\t" \ | |
267 | : "=r" (ms_flags), "=r" (ms_saveret)); | |
268 | ||
269 | #undef MACHINE_STATE_RESTORE | |
270 | #define MACHINE_STATE_RESTORE(ID) \ | |
271 | asm volatile("mov %0, %%g1\n\t" \ | |
272 | "mov %1, %%g2\n\t" \ | |
273 | "ta 0x21\n\t" \ | |
274 | : /* no outputs */ \ | |
275 | : "r" (ms_flags), "r" (ms_saveret)); |