]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/s390/linux.h
system.h (SELECT_RTX_SECTION): Poison.
[thirdparty/gcc.git] / gcc / config / s390 / linux.h
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).
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
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
13 GNU CC is distributed in the hope that it will be useful,
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
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 #ifndef _LINUX_H
24 #define _LINUX_H
25
26 /* Target specific version string. */
27
28 #ifdef DEFAULT_TARGET_64BIT
29 #undef TARGET_VERSION
30 #define TARGET_VERSION fprintf (stderr, " (Linux for zSeries)");
31 #else
32 #undef TARGET_VERSION
33 #define TARGET_VERSION fprintf (stderr, " (Linux for S/390)");
34 #endif
35
36
37 /* Target specific type definitions. */
38
39 /* ??? Do we really want long as size_t on 31-bit? */
40 #undef SIZE_TYPE
41 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "long unsigned int")
42 #undef PTRDIFF_TYPE
43 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
44
45 #undef WCHAR_TYPE
46 #define WCHAR_TYPE "int"
47 #undef WCHAR_TYPE_SIZE
48 #define WCHAR_TYPE_SIZE 32
49
50
51 /* Target specific preprocessor settings. */
52
53 #define CPP_PREDEFINES \
54 "-Dunix -Asystem(unix) -D__gnu_linux__ -Dlinux -Asystem(linux) -D__ELF__ \
55 -Acpu(s390) -Amachine(s390) -D__s390__"
56
57 #define CPP_ARCH31_SPEC ""
58 #define CPP_ARCH64_SPEC "-D__s390x__ -D__LONG_MAX__=9223372036854775807L"
59
60 #undef CPP_SPEC
61 #ifdef DEFAULT_TARGET_64BIT
62 #define CPP_SPEC "%{!m31:%(cpp_arch64)}"
63 #else
64 #define CPP_SPEC "%{m64:%(cpp_arch64)}"
65 #endif
66
67 /* Target specific compiler settings. */
68
69 /* ??? -fcaller-saves sometimes doesn't work. Fix this! */
70 #undef CC1_SPEC
71 #define CC1_SPEC "-fno-caller-saves"
72 #undef CC1PLUS_SPEC
73 #define CC1PLUS_SPEC "-fno-caller-saves"
74
75
76 /* Target specific assembler settings. */
77
78 #ifdef DEFAULT_TARGET_64BIT
79 #undef ASM_SPEC
80 #define ASM_SPEC "%{m31:-m31 -Aesa}"
81 #else
82 #undef ASM_SPEC
83 #define ASM_SPEC "%{m64:-m64 -Aesame}"
84 #endif
85
86
87 /* Target specific linker settings. */
88
89 #define LINK_ARCH31_SPEC \
90 "-m elf_s390 \
91 %{shared:-shared} \
92 %{!shared: \
93 %{static:-static} \
94 %{!static: \
95 %{rdynamic:-export-dynamic} \
96 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
97
98 #define LINK_ARCH64_SPEC \
99 "-m elf64_s390 \
100 %{shared:-shared} \
101 %{!shared: \
102 %{static:-static} \
103 %{!static: \
104 %{rdynamic:-export-dynamic} \
105 %{!dynamic-linker:-dynamic-linker /lib/ld64.so.1}}}"
106
107 #ifdef DEFAULT_TARGET_64BIT
108 #undef LINK_SPEC
109 #define LINK_SPEC "%{m31:%(link_arch31)} %{!m31:%(link_arch64)}"
110 #else
111 #undef LINK_SPEC
112 #define LINK_SPEC "%{m64:%(link_arch64)} %{!m64:%(link_arch31)}"
113 #endif
114
115
116 /* This macro defines names of additional specifications to put in the specs
117 that can be used in various specifications like CC1_SPEC. Its definition
118 is an initializer with a subgrouping for each command option. */
119
120 #define EXTRA_SPECS \
121 { "cpp_arch31", CPP_ARCH31_SPEC }, \
122 { "cpp_arch64", CPP_ARCH64_SPEC }, \
123 { "link_arch31", LINK_ARCH31_SPEC }, \
124 { "link_arch64", LINK_ARCH64_SPEC }, \
125
126
127 /* Character to start a comment. */
128
129 #define ASM_COMMENT_START "#"
130
131
132 /* Assembler pseudos to introduce constants of various size. */
133
134 #define ASM_DOUBLE "\t.double"
135
136 /* The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
137 #define LOCAL_LABEL_PREFIX "."
138
139 /* Prefix for internally generated assembler labels. */
140 #define LPREFIX ".L"
141
142
143 /* This is how to output the definition of a user-level label named NAME,
144 such as the label on a static function or variable NAME. */
145
146 #undef ASM_OUTPUT_LABEL
147 #define ASM_OUTPUT_LABEL(FILE, NAME) \
148 (assemble_name (FILE, NAME), fputs (":\n", FILE))
149
150 /* Store in OUTPUT a string (made with alloca) containing
151 an assembler-name for a local static variable named NAME.
152 LABELNO is an integer which is different for each call. */
153
154 #undef ASM_FORMAT_PRIVATE_NAME
155 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
156 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
157 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
158
159
160 /* internal macro to output long */
161 #define _ASM_OUTPUT_LONG(FILE, VALUE) \
162 fprintf (FILE, "\t.long\t0x%lX\n", VALUE);
163
164
165 /* This is how to output an element of a case-vector that is absolute. */
166
167 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
168 fprintf (FILE, "%s%s%d\n", integer_asm_op (UNITS_PER_WORD, TRUE), \
169 LPREFIX, VALUE)
170
171 /* This is how to output an element of a case-vector that is relative. */
172
173 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
174 fprintf (FILE, "%s%s%d-%s%d\n", integer_asm_op (UNITS_PER_WORD, TRUE), \
175 LPREFIX, VALUE, LPREFIX, REL)
176
177
178
179 /* This is how to output an assembler line
180 that says to advance the location counter
181 to a multiple of 2**LOG bytes. */
182
183 #undef ASM_OUTPUT_ALIGN
184 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
185 if ((LOG)!=0) fprintf ((FILE), "\t.align\t%d\n", 1<<(LOG))
186
187 /* This is how to output an assembler line
188 that says to advance the location counter by SIZE bytes. */
189
190 #undef ASM_OUTPUT_SKIP
191 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
192 fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE))
193
194 /* This is how to output assembler code to declare an
195 uninitialized external linkage data object. */
196
197 #undef ASM_OUTPUT_ALIGNED_BSS
198 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
199 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
200
201 /* Output before read-only data. */
202
203 #define TEXT_SECTION_ASM_OP ".text"
204
205 /* Output before writable (initialized) data. */
206
207 #define DATA_SECTION_ASM_OP ".data"
208
209 /* Output before writable (uninitialized) data. */
210
211 #define BSS_SECTION_ASM_OP ".bss"
212
213 /* This is how to output a command to make the user-level label named NAME
214 defined for reference from other files. */
215
216 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
217 (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
218 \f
219 /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
220 Used for C++ multiple inheritance. */
221 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
222 do { \
223 if (TARGET_64BIT) \
224 { \
225 if (flag_pic) \
226 { \
227 fprintf (FILE, "\tlarl 1,0f\n"); \
228 fprintf (FILE, "\tagf %d,0(1)\n", \
229 aggregate_value_p (TREE_TYPE \
230 (TREE_TYPE (FUNCTION))) ? 3 :2 ); \
231 fprintf (FILE, "\tlarl 1,"); \
232 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
233 fprintf (FILE, "@GOTENT\n"); \
234 fprintf (FILE, "\tlg 1,0(1)\n"); \
235 fprintf (FILE, "\tbr 1\n"); \
236 fprintf (FILE, "0:\t.long "); \
237 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
238 fprintf (FILE, "\n"); \
239 } \
240 else \
241 { \
242 fprintf (FILE, "\tlarl 1,0f\n"); \
243 fprintf (FILE, "\tagf %d,0(1)\n", \
244 aggregate_value_p (TREE_TYPE \
245 (TREE_TYPE (FUNCTION))) ? 3 :2 ); \
246 fprintf (FILE, "\tjg "); \
247 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
248 fprintf (FILE, "\n"); \
249 fprintf (FILE, "0:\t.long "); \
250 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
251 fprintf (FILE, "\n"); \
252 } \
253 } \
254 else \
255 { \
256 if (flag_pic) \
257 { \
258 fprintf (FILE, "\tbras 1,0f\n"); \
259 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_-.\n"); \
260 fprintf (FILE, "\t.long "); \
261 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
262 fprintf (FILE, "@GOT\n"); \
263 fprintf (FILE, "\t.long "); \
264 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
265 fprintf (FILE, "\n"); \
266 fprintf (FILE, "0:\tal %d,8(1)\n", \
267 aggregate_value_p (TREE_TYPE \
268 (TREE_TYPE (FUNCTION))) ? 3 : 2 ); \
269 fprintf (FILE, "\tl 0,4(1)\n"); \
270 fprintf (FILE, "\tal 1,0(1)\n"); \
271 fprintf (FILE, "\talr 1,0\n"); \
272 fprintf (FILE, "\tl 1,0(1)\n"); \
273 fprintf (FILE, "\tbr 1\n"); \
274 } else { \
275 fprintf (FILE, "\tbras 1,0f\n"); \
276 fprintf (FILE, "\t.long "); \
277 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
278 fprintf (FILE, "-.\n"); \
279 fprintf (FILE, "\t.long "); \
280 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
281 fprintf (FILE, "\n"); \
282 fprintf (FILE, "0:\tal %d,4(1)\n", \
283 aggregate_value_p (TREE_TYPE \
284 (TREE_TYPE (FUNCTION))) ? 3 : 2 ); \
285 fprintf (FILE, "\tal 1,0(1)\n"); \
286 fprintf (FILE, "\tbr 1\n"); \
287 } \
288 } \
289 } while (0)
290
291 #endif