1 /* Definitions for Linux for S/390.
2 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4 Ulrich Weigand (uweigand@de.ibm.com).
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 /* Target specific version string. */
28 #ifdef DEFAULT_TARGET_64BIT
30 #define TARGET_VERSION fprintf (stderr, " (Linux for zSeries)");
33 #define TARGET_VERSION fprintf (stderr, " (Linux for S/390)");
37 /* Target specific type definitions. */
39 /* ??? Do we really want long as size_t on 31-bit? */
41 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "long unsigned int")
43 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
46 #define WCHAR_TYPE "int"
47 #undef WCHAR_TYPE_SIZE
48 #define WCHAR_TYPE_SIZE 32
51 /* Target specific preprocessor settings. */
53 #define TARGET_OS_CPP_BUILTINS() \
56 LINUX_TARGET_OS_CPP_BUILTINS(); \
59 builtin_define ("__PIC__"); \
60 builtin_define ("__pic__"); \
66 /* Target specific assembler settings. */
69 #define ASM_SPEC "%{m31&m64}%{mesa&mzarch}%{march=*}"
72 /* Target specific linker settings. */
74 #ifdef DEFAULT_TARGET_64BIT
75 #define MULTILIB_DEFAULTS { "m64" }
77 #define MULTILIB_DEFAULTS { "m31" }
82 "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
87 %{rdynamic:-export-dynamic} \
89 %{m31:-dynamic-linker /lib/ld.so.1} \
90 %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
93 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
95 /* Do code reading to identify a signal frame, and set the frame
96 state data appropriately. See unwind-dw2.c for the structs. */
98 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
100 unsigned char *pc_ = (CONTEXT)->ra; \
106 unsigned long psw_mask; \
107 unsigned long psw_addr; \
108 unsigned long gprs[16]; \
109 unsigned int acrs[16]; \
111 unsigned int __pad; \
113 } __attribute__ ((__aligned__ (8))) sigregs_; \
117 /* svc $__NR_sigreturn or svc $__NR_rt_sigreturn */ \
118 if (pc_[0] != 0x0a || (pc_[1] != 119 && pc_[1] != 173)) \
121 /* New-style RT frame: \
122 retcode + alignment (8 bytes) \
123 siginfo (128 bytes) \
124 ucontext (contains sigregs) */ \
125 if ((CONTEXT)->ra == (CONTEXT)->cfa) \
129 unsigned long uc_flags; \
130 struct ucontext_ *uc_link; \
131 unsigned long uc_stack[3]; \
132 sigregs_ uc_mcontext; \
133 } *uc_ = (CONTEXT)->cfa + 8 + 128; \
135 regs_ = &uc_->uc_mcontext; \
138 /* Old-style RT frame and all non-RT frames: \
139 old signal mask (8 bytes) \
140 pointer to sigregs */ \
143 regs_ = *(sigregs_ **)((CONTEXT)->cfa + 8); \
146 new_cfa_ = regs_->gprs[15] + 16*sizeof(long) + 32; \
147 (FS)->cfa_how = CFA_REG_OFFSET; \
148 (FS)->cfa_reg = 15; \
150 new_cfa_ - (long) (CONTEXT)->cfa + 16*sizeof(long) + 32; \
152 for (i_ = 0; i_ < 16; i_++) \
154 (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
155 (FS)->regs.reg[i_].loc.offset = \
156 (long)®s_->gprs[i_] - new_cfa_; \
158 for (i_ = 0; i_ < 16; i_++) \
160 (FS)->regs.reg[16+i_].how = REG_SAVED_OFFSET; \
161 (FS)->regs.reg[16+i_].loc.offset = \
162 (long)®s_->fprs[i_] - new_cfa_; \
165 /* Load return addr from PSW into dummy register 32. */ \
166 (FS)->regs.reg[32].how = REG_SAVED_OFFSET; \
167 (FS)->regs.reg[32].loc.offset = (long)®s_->psw_addr - new_cfa_; \
168 (FS)->retaddr_column = 32; \