]>
Commit | Line | Data |
---|---|---|
956d6950 | 1 | /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF. |
aa335b76 KH |
2 | Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004 |
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 |
bfe87013 DE |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. */ | |
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"); \ | |
33 | } \ | |
34 | while (0) | |
35 | ||
80ffc95e | 36 | /* Don't assume anything about the header files. */ |
bfe87013 DE |
37 | #define NO_IMPLICIT_EXTERN_C |
38 | ||
bfe87013 DE |
39 | #undef MD_EXEC_PREFIX |
40 | #undef MD_STARTFILE_PREFIX | |
41 | ||
f2c0cb15 JJ |
42 | #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \ |
43 | || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \ | |
44 | || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 | |
345a6161 DM |
45 | /* A 64 bit v9 compiler with stack-bias, |
46 | in a Medium/Low code model environment. */ | |
47 | ||
48 | #undef TARGET_DEFAULT | |
49 | #define TARGET_DEFAULT \ | |
50 | (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ | |
33074e5f | 51 | + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128) |
345a6161 DM |
52 | #endif |
53 | ||
a0a301fc DE |
54 | #undef ASM_CPU_DEFAULT_SPEC |
55 | #define ASM_CPU_DEFAULT_SPEC "-Av9a" | |
bfe87013 | 56 | |
4710d3eb JJ |
57 | #ifdef SPARC_BI_ARCH |
58 | ||
59 | #undef CPP_ARCH32_SPEC | |
9b8466f4 | 60 | #define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__}" |
4710d3eb JJ |
61 | |
62 | #endif | |
63 | ||
956d6950 JL |
64 | /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add |
65 | the GNU/Linux magical crtbegin.o file (see crtstuff.c) which | |
bfe87013 | 66 | provides part of the support for getting C++ file-scope static |
80ffc95e | 67 | object constructed before entering `main'. */ |
bfe87013 DE |
68 | |
69 | #undef STARTFILE_SPEC | |
345a6161 | 70 | |
24a4dd31 | 71 | #ifdef HAVE_LD_PIE |
5bbcd587 | 72 | #define STARTFILE_SPEC \ |
24a4dd31 JJ |
73 | "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ |
74 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}" | |
75 | #else | |
76 | #define STARTFILE_SPEC \ | |
77 | "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\ | |
78 | crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}" | |
79 | #endif | |
bfe87013 | 80 | |
956d6950 JL |
81 | /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on |
82 | the GNU/Linux magical crtend.o file (see crtstuff.c) which | |
bfe87013 DE |
83 | provides part of the support for getting C++ file-scope static |
84 | object constructed before entering `main', followed by a normal | |
956d6950 | 85 | GNU/Linux "finalizer" file, `crtn.o'. */ |
bfe87013 DE |
86 | |
87 | #undef ENDFILE_SPEC | |
345a6161 | 88 | |
5bbcd587 | 89 | #define ENDFILE_SPEC \ |
24a4dd31 | 90 | "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ |
5bbcd587 | 91 | %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" |
345a6161 | 92 | |
2be1602e DM |
93 | /* The GNU C++ standard library requires that these macros be defined. */ |
94 | #undef CPLUSPLUS_CPP_SPEC | |
95 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | |
96 | ||
345a6161 DM |
97 | #undef TARGET_VERSION |
98 | #define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)"); | |
a0a301fc DE |
99 | |
100 | /* The default code model. */ | |
101 | #undef SPARC_DEFAULT_CMODEL | |
be3f1ff5 | 102 | #define SPARC_DEFAULT_CMODEL CM_MEDLOW |
bfe87013 | 103 | |
4710d3eb | 104 | #undef SUBTARGET_SWITCHES |
047142d3 PT |
105 | #define SUBTARGET_SWITCHES \ |
106 | {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \ | |
107 | {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") }, | |
4710d3eb | 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 "\ | |
24a4dd31 | 130 | %{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} \ |
bfe87013 | 131 | %{posix:-D_POSIX_SOURCE} \ |
afc96791 | 132 | %{pthread:-D_REENTRANT} \ |
bfe87013 | 133 | " |
afc96791 | 134 | |
bfe87013 DE |
135 | #undef LIB_SPEC |
136 | #define LIB_SPEC \ | |
17772b2a JJ |
137 | "%{pthread:-lpthread} \ |
138 | %{shared:-lc} \ | |
139 | %{!shared: %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" | |
bfe87013 | 140 | |
956d6950 | 141 | /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support |
bfe87013 DE |
142 | for the special GCC options -static and -shared, which allow us to |
143 | link things in one of these three modes by applying the appropriate | |
144 | combinations of options at link-time. We like to support here for | |
145 | as many of the other GNU linker options as possible. But I don't | |
146 | have the time to search for those flags. I am sure how to add | |
147 | support for -soname shared_object_name. H.J. | |
148 | ||
149 | I took out %{v:%{!V:-V}}. It is too much :-(. They can use | |
150 | -Wl,-V. | |
151 | ||
152 | When the -shared link option is used a final link is not being | |
153 | done. */ | |
154 | ||
80ffc95e | 155 | /* If ELF is the default format, we should not use /lib/elf. */ |
bfe87013 | 156 | |
345a6161 DM |
157 | #ifdef SPARC_BI_ARCH |
158 | ||
159 | #undef SUBTARGET_EXTRA_SPECS | |
160 | #define SUBTARGET_EXTRA_SPECS \ | |
161 | { "link_arch32", LINK_ARCH32_SPEC }, \ | |
162 | { "link_arch64", LINK_ARCH64_SPEC }, \ | |
163 | { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ | |
164 | { "link_arch", LINK_ARCH_SPEC }, | |
165 | ||
166 | #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | |
167 | %{!shared: \ | |
168 | %{!ibcs: \ | |
169 | %{!static: \ | |
170 | %{rdynamic:-export-dynamic} \ | |
171 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | |
172 | %{static:-static}}} \ | |
173 | " | |
174 | ||
175 | #define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ | |
176 | %{!shared: \ | |
177 | %{!ibcs: \ | |
178 | %{!static: \ | |
179 | %{rdynamic:-export-dynamic} \ | |
180 | %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ | |
181 | %{static:-static}}} \ | |
182 | " | |
183 | ||
184 | #define LINK_ARCH_SPEC "\ | |
185 | %{m32:%(link_arch32)} \ | |
186 | %{m64:%(link_arch64)} \ | |
187 | %{!m32:%{!m64:%(link_arch_default)}} \ | |
188 | " | |
189 | ||
190 | #define LINK_ARCH_DEFAULT_SPEC \ | |
191 | (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) | |
192 | ||
bfe87013 | 193 | #undef LINK_SPEC |
345a6161 DM |
194 | #define LINK_SPEC "\ |
195 | %(link_arch) \ | |
196 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 197 | %{!mno-relax:%{!r:-relax}} \ |
345a6161 DM |
198 | " |
199 | ||
200 | #undef CC1_SPEC | |
201 | #if DEFAULT_ARCH32_P | |
202 | #define CC1_SPEC "\ | |
203 | %{sun4:} %{target:} \ | |
204 | %{mcypress:-mcpu=cypress} \ | |
205 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
206 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
d6964c30 | 207 | %{m32:%{m64:%emay not use both -m32 and -m64}} \ |
4710d3eb | 208 | %{m64:-mptr64 -mstack-bias -mlong-double-128 \ |
247cfc5c JJ |
209 | %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=ultrasparc}}}}}}} \ |
210 | %{!mno-vis:%{!mcpu=v9:-mvis}}} \ | |
345a6161 DM |
211 | " |
212 | #else | |
213 | #define CC1_SPEC "\ | |
214 | %{sun4:} %{target:} \ | |
215 | %{mcypress:-mcpu=cypress} \ | |
216 | %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ | |
217 | %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ | |
d6964c30 | 218 | %{m32:%{m64:%emay not use both -m32 and -m64}} \ |
4710d3eb | 219 | %{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \ |
b25c3a22 | 220 | %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=cypress}}}}}}}} \ |
9ce13279 | 221 | %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \ |
247cfc5c | 222 | %{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \ |
345a6161 DM |
223 | " |
224 | #endif | |
225 | ||
942e0f44 JJ |
226 | /* Support for a compile-time default CPU, et cetera. The rules are: |
227 | --with-cpu is ignored if -mcpu is specified. | |
228 | --with-tune is ignored if -mtune is specified. | |
229 | --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu | |
230 | are specified. | |
231 | In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)} | |
232 | here, otherwise say -mcpu=v7 would be passed even when -m64. | |
233 | CC1_SPEC above takes care of this instead. */ | |
234 | #undef OPTION_DEFAULT_SPECS | |
235 | #if DEFAULT_ARCH32_P | |
236 | #define OPTION_DEFAULT_SPECS \ | |
237 | {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ | |
238 | {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ | |
239 | {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" } | |
240 | #else | |
241 | #define OPTION_DEFAULT_SPECS \ | |
242 | {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ | |
243 | {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ | |
244 | {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" } | |
245 | #endif | |
246 | ||
345a6161 DM |
247 | #if DEFAULT_ARCH32_P |
248 | #define MULTILIB_DEFAULTS { "m32" } | |
249 | #else | |
250 | #define MULTILIB_DEFAULTS { "m64" } | |
251 | #endif | |
252 | ||
253 | #else /* !SPARC_BI_ARCH */ | |
254 | ||
255 | #undef LINK_SPEC | |
e95b1e6a | 256 | #define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ |
bfe87013 DE |
257 | %{!shared: \ |
258 | %{!ibcs: \ | |
259 | %{!static: \ | |
260 | %{rdynamic:-export-dynamic} \ | |
345a6161 | 261 | %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ |
bfe87013 DE |
262 | %{static:-static}}} \ |
263 | %{mlittle-endian:-EL} \ | |
e95b1e6a | 264 | %{!mno-relax:%{!r:-relax}} \ |
bfe87013 DE |
265 | " |
266 | ||
345a6161 DM |
267 | #endif /* !SPARC_BI_ARCH */ |
268 | ||
bfe87013 | 269 | /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). |
80ffc95e | 270 | It's safe to pass -s always, even if -g is not used. */ |
bfe87013 DE |
271 | #undef ASM_SPEC |
272 | #define ASM_SPEC "\ | |
273 | %{V} \ | |
274 | %{v:%{!V:-V}} \ | |
275 | %{!Qn:-Qy} \ | |
276 | %{n} \ | |
277 | %{T} \ | |
278 | %{Ym,*} \ | |
279 | %{Wa,*:%*} \ | |
24a4dd31 | 280 | -s %{fpic|fPIC|fpie|fPIE:-K PIC} \ |
bfe87013 | 281 | %{mlittle-endian:-EL} \ |
e95b1e6a | 282 | %(asm_cpu) %(asm_arch) %(asm_relax)" |
bfe87013 DE |
283 | |
284 | /* Same as sparc.h */ | |
285 | #undef DBX_REGISTER_NUMBER | |
286 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) | |
287 | ||
23532de9 JT |
288 | #define DWARF2_DEBUGGING_INFO 1 |
289 | #define DBX_DEBUGGING_INFO 1 | |
bfe87013 | 290 | |
bfe87013 DE |
291 | #undef ASM_OUTPUT_ALIGNED_LOCAL |
292 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
293 | do { \ | |
294 | fputs ("\t.local\t", (FILE)); \ | |
295 | assemble_name ((FILE), (NAME)); \ | |
296 | putc ('\n', (FILE)); \ | |
297 | ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ | |
298 | } while (0) | |
299 | ||
300 | #undef COMMON_ASM_OP | |
471b6f1b | 301 | #define COMMON_ASM_OP "\t.common\t" |
bfe87013 | 302 | |
59f96879 RH |
303 | #undef LOCAL_LABEL_PREFIX |
304 | #define LOCAL_LABEL_PREFIX "." | |
305 | ||
bfe87013 DE |
306 | /* This is how to output a reference to an internal numbered label where |
307 | PREFIX is the class of label and NUM is the number within the class. */ | |
308 | ||
309 | #undef ASM_OUTPUT_INTERNAL_LABELREF | |
310 | #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ | |
311 | fprintf (FILE, ".L%s%d", PREFIX, NUM) | |
312 | ||
313 | /* This is how to store into the string LABEL | |
314 | the symbol_ref name of an internal numbered label where | |
315 | PREFIX is the class of label and NUM is the number within the class. | |
316 | This is suitable for output with `assemble_name'. */ | |
317 | ||
318 | #undef ASM_GENERATE_INTERNAL_LABEL | |
319 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
e59f7d3d | 320 | sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM)) |
bfe87013 | 321 | |
bfe87013 DE |
322 | /* DWARF bits. */ |
323 | ||
324 | /* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. | |
d6a7951f | 325 | Obviously the Dwarf2 folks haven't tried to actually build systems |
bfe87013 DE |
326 | with their spec. On a 64-bit system, only 64-bit relocs become |
327 | RELATIVE relocations. */ | |
328 | ||
329 | /* #define DWARF_OFFSET_SIZE PTR_SIZE */ | |
275b60d6 | 330 | |
45dcc026 JJ |
331 | #undef DITF_CONVERSION_LIBFUNCS |
332 | #define DITF_CONVERSION_LIBFUNCS 1 | |
333 | ||
275b60d6 JJ |
334 | #if defined(HAVE_LD_EH_FRAME_HDR) |
335 | #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " | |
336 | #endif | |
f7e0e539 | 337 | \f |
5751a10b JJ |
338 | #ifdef HAVE_AS_TLS |
339 | #undef TARGET_SUN_TLS | |
340 | #undef TARGET_GNU_TLS | |
341 | #define TARGET_SUN_TLS 0 | |
342 | #define TARGET_GNU_TLS 1 | |
343 | #endif | |
344 | \f | |
b5de1a27 DM |
345 | /* Don't be different from other Linux platforms in this regard. */ |
346 | #define HANDLE_PRAGMA_PACK_PUSH_POP | |
7a31a340 DM |
347 | |
348 | /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ | |
349 | #undef CTORS_SECTION_ASM_OP | |
350 | #undef DTORS_SECTION_ASM_OP | |
db430d26 | 351 | |
a5fe455b | 352 | #define TARGET_ASM_FILE_END file_end_indicate_exec_stack |
3edc56a9 | 353 | |
3017c534 DM |
354 | /* Determine whether the the entire c99 runtime is present in the |
355 | runtime library. */ | |
356 | #define TARGET_C99_FUNCTIONS 1 | |
357 | ||
c2cd64b5 JJ |
358 | #define TARGET_HAS_F_SETLKW |
359 | ||
d00eacab | 360 | #undef LINK_GCC_C_SEQUENCE_SPEC |
42df2193 JJ |
361 | #define LINK_GCC_C_SEQUENCE_SPEC \ |
362 | "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" | |
363 | ||
8efcd34f AM |
364 | /* Use --as-needed -lgcc_s for eh support. */ |
365 | #ifdef HAVE_LD_AS_NEEDED | |
366 | #define USE_LD_AS_NEEDED 1 | |
367 | #endif | |
368 | ||
db430d26 DM |
369 | /* Do code reading to identify a signal frame, and set the frame |
370 | state data appropriately. See unwind-dw2.c for the structs. */ | |
371 | ||
db430d26 DM |
372 | /* Handle multilib correctly. */ |
373 | #if defined(__arch64__) | |
56149abc | 374 | /* 64-bit SPARC version */ |
db430d26 DM |
375 | #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ |
376 | do { \ | |
377 | unsigned int *pc_ = (CONTEXT)->ra; \ | |
378 | long new_cfa_, i_; \ | |
379 | long regs_off_, fpu_save_off_; \ | |
380 | long this_cfa_, fpu_save_; \ | |
381 | \ | |
382 | if (pc_[0] != 0x82102065 /* mov NR_rt_sigreturn, %g1 */ \ | |
383 | || pc_[1] != 0x91d0206d) /* ta 0x6d */ \ | |
384 | break; \ | |
385 | regs_off_ = 192 + 128; \ | |
386 | fpu_save_off_ = regs_off_ + (16 * 8) + (3 * 8) + (2 * 4); \ | |
387 | this_cfa_ = (long) (CONTEXT)->cfa; \ | |
388 | new_cfa_ = *(long *)(((CONTEXT)->cfa) + (regs_off_ + (14 * 8))); \ | |
3ef3f384 | 389 | new_cfa_ += 2047; /* Stack bias */ \ |
db430d26 DM |
390 | fpu_save_ = *(long *)((this_cfa_) + (fpu_save_off_)); \ |
391 | (FS)->cfa_how = CFA_REG_OFFSET; \ | |
392 | (FS)->cfa_reg = 14; \ | |
393 | (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ | |
394 | for (i_ = 1; i_ < 16; ++i_) \ | |
395 | { \ | |
db430d26 DM |
396 | (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ |
397 | (FS)->regs.reg[i_].loc.offset = \ | |
398 | this_cfa_ + (regs_off_ + (i_ * 8)) - new_cfa_; \ | |
399 | } \ | |
400 | for (i_ = 0; i_ < 16; ++i_) \ | |
401 | { \ | |
402 | (FS)->regs.reg[i_ + 16].how = REG_SAVED_OFFSET; \ | |
403 | (FS)->regs.reg[i_ + 16].loc.offset = \ | |
404 | this_cfa_ + (i_ * 8) - new_cfa_; \ | |
405 | } \ | |
406 | if (fpu_save_) \ | |
407 | { \ | |
408 | for (i_ = 0; i_ < 64; ++i_) \ | |
409 | { \ | |
410 | if (i_ > 32 && (i_ & 0x1)) \ | |
411 | continue; \ | |
412 | (FS)->regs.reg[i_ + 32].how = REG_SAVED_OFFSET; \ | |
413 | (FS)->regs.reg[i_ + 32].loc.offset = \ | |
414 | (fpu_save_ + (i_ * 4)) - new_cfa_; \ | |
415 | } \ | |
416 | } \ | |
417 | /* Stick return address into %g0, same trick Alpha uses. */ \ | |
418 | (FS)->regs.reg[0].how = REG_SAVED_OFFSET; \ | |
419 | (FS)->regs.reg[0].loc.offset = \ | |
420 | this_cfa_ + (regs_off_ + (16 * 8) + 8) - new_cfa_; \ | |
421 | (FS)->retaddr_column = 0; \ | |
422 | goto SUCCESS; \ | |
423 | } while (0) | |
424 | #else | |
56149abc | 425 | /* 32-bit SPARC version */ |
db430d26 DM |
426 | #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ |
427 | do { \ | |
428 | unsigned int *pc_ = (CONTEXT)->ra; \ | |
429 | int new_cfa_, i_, oldstyle_; \ | |
430 | int regs_off_, fpu_save_off_; \ | |
431 | int fpu_save_, this_cfa_; \ | |
432 | \ | |
433 | if (pc_[1] != 0x91d02010) /* ta 0x10 */ \ | |
434 | break; \ | |
435 | if (pc_[0] == 0x821020d8) /* mov NR_sigreturn, %g1 */ \ | |
436 | oldstyle_ = 1; \ | |
437 | else if (pc_[0] == 0x82102065) /* mov NR_rt_sigreturn, %g1 */ \ | |
438 | oldstyle_ = 0; \ | |
439 | else \ | |
440 | break; \ | |
441 | if (oldstyle_) \ | |
442 | { \ | |
443 | regs_off_ = 96; \ | |
444 | fpu_save_off_ = regs_off_ + (4 * 4) + (16 * 4); \ | |
445 | } \ | |
446 | else \ | |
447 | { \ | |
448 | regs_off_ = 96 + 128; \ | |
449 | fpu_save_off_ = regs_off_ + (4 * 4) + (16 * 4) + (2 * 4); \ | |
450 | } \ | |
451 | this_cfa_ = (int) (CONTEXT)->cfa; \ | |
452 | new_cfa_ = *(int *)(((CONTEXT)->cfa) + (regs_off_+(4*4)+(14 * 4))); \ | |
453 | fpu_save_ = *(int *)((this_cfa_) + (fpu_save_off_)); \ | |
454 | (FS)->cfa_how = CFA_REG_OFFSET; \ | |
455 | (FS)->cfa_reg = 14; \ | |
456 | (FS)->cfa_offset = new_cfa_ - (int) (CONTEXT)->cfa; \ | |
457 | for (i_ = 1; i_ < 16; ++i_) \ | |
458 | { \ | |
459 | if (i_ == 14) \ | |
460 | continue; \ | |
461 | (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ | |
462 | (FS)->regs.reg[i_].loc.offset = \ | |
463 | this_cfa_ + (regs_off_+(4 * 4)+(i_ * 4)) - new_cfa_; \ | |
464 | } \ | |
465 | for (i_ = 0; i_ < 16; ++i_) \ | |
466 | { \ | |
467 | (FS)->regs.reg[i_ + 16].how = REG_SAVED_OFFSET; \ | |
468 | (FS)->regs.reg[i_ + 16].loc.offset = \ | |
469 | this_cfa_ + (i_ * 4) - new_cfa_; \ | |
470 | } \ | |
471 | if (fpu_save_) \ | |
472 | { \ | |
473 | for (i_ = 0; i_ < 32; ++i_) \ | |
474 | { \ | |
475 | (FS)->regs.reg[i_ + 32].how = REG_SAVED_OFFSET; \ | |
476 | (FS)->regs.reg[i_ + 32].loc.offset = \ | |
477 | (fpu_save_ + (i_ * 4)) - new_cfa_; \ | |
478 | } \ | |
479 | } \ | |
480 | /* Stick return address into %g0, same trick Alpha uses. */ \ | |
481 | (FS)->regs.reg[0].how = REG_SAVED_OFFSET; \ | |
482 | (FS)->regs.reg[0].loc.offset = this_cfa_+(regs_off_+4)-new_cfa_; \ | |
483 | (FS)->retaddr_column = 0; \ | |
484 | goto SUCCESS; \ | |
485 | } while (0) | |
486 | #endif |