1 /* Definitions for Linux for S/390.
2 Copyright (C) 1999, 2000, 2001 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 GNU CC.
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)
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.
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. */
26 #undef SIZE_TYPE /* use default */
29 #define TARGET_VERSION fprintf (stderr, " (Linux for S/390)");
31 /* Names to predefine in the preprocessor for this target machine. */
33 #define CPP_PREDEFINES "-Dlinux -Asystem(linux) -Acpu(s390) -Amachine(s390) -D__s390__ -Asystem(unix) -Dunix -D__ELF__"
36 * Caller save not (always) working in gcc-2.95.2
40 #define CC1_SPEC "-fno-caller-saves"
41 #define CC1PLUS_SPEC "-fno-caller-saves"
45 #define LINK_SPEC "-m elf_s390 %{shared:-shared} \
49 %{rdynamic:-export-dynamic} \
50 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1 \
51 -rpath-link=/usr/local/s390-ibm-linux/lib}} \
54 #define LINK_SPEC "-m elf_s390 %{shared:-shared} \
58 %{rdynamic:-export-dynamic} \
59 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
63 /* Need to define this. Otherwise define to BITS_PER_WORD in cexp.c.
64 But BITS_PER_WORD depends on target flags, which are not defined in
68 #define WCHAR_TYPE "int"
69 #undef WCHAR_TYPE_SIZE
70 #define WCHAR_TYPE_SIZE 32
72 /* Character to start a comment. */
74 #define ASM_COMMENT_START "#"
77 /* Assembler pseudos to introduce constants of various size. */
79 #define ASM_SHORT "\t.word"
80 #define ASM_LONG "\t.long"
81 #define ASM_QUAD "\t.quad"
82 #define ASM_DOUBLE "\t.double"
85 /* Prefix for internally generated assembler labels. */
88 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
89 fprintf (FILE, "%s", NAME);
92 /* This is how to output the definition of a user-level label named NAME,
93 such as the label on a static function or variable NAME. */
95 #undef ASM_OUTPUT_LABEL
96 #define ASM_OUTPUT_LABEL(FILE, NAME) \
97 (assemble_name (FILE, NAME), fputs (":\n", FILE))
99 /* This is how to output an assembler line defining a `double' constant. */
102 /* This is how to output an assembler line defining a `double' constant. */
104 #undef ASM_OUTPUT_DOUBLE
105 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
108 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
109 fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", \
110 t[0] & 0xffffffff, t[1] & 0xffffffff); \
113 /* This is how to output an assembler line defining a `float' constant. */
115 #undef ASM_OUTPUT_FLOAT
116 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
119 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
120 fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
123 /* Store in OUTPUT a string (made with alloca) containing
124 an assembler-name for a local static variable named NAME.
125 LABELNO is an integer which is different for each call. */
127 #undef ASM_FORMAT_PRIVATE_NAME
128 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
129 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
130 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
133 #define ASM_OUTPUT_DOUBLE_INT(FILE, VALUE) \
134 do { fprintf ((FILE), "%s\t", ASM_QUAD); \
135 /* Work around bug in some GNU as versions */ \
136 if (GET_CODE (VALUE) == CONST_INT && INTVAL (VALUE) < INT_MIN) \
137 fprintf ((FILE), HOST_WIDE_INT_PRINT_HEX, INTVAL (x)); \
139 output_addr_const ((FILE), (VALUE)); \
140 putc ('\n', (FILE)); \
144 /* This is how to output an assembler line defining an `int' constant. */
146 #undef ASM_OUTPUT_INT
147 #define ASM_OUTPUT_INT(FILE, VALUE) \
148 do { fprintf (FILE, "%s\t", ASM_LONG); \
149 output_addr_const (FILE, (VALUE)); \
153 /* Likewise for `char' and `short' constants.
154 is this supposed to do align too?? */
156 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
157 ( fprintf (FILE, "%s ", ASM_SHORT), \
158 output_addr_const (FILE, (VALUE)), \
161 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
162 ( fprintf (FILE, "%s ", ASM_BYTE_OP), \
163 output_addr_const (FILE, (VALUE)), \
166 /* This is how to output an assembler line for a numeric constant byte. */
168 #define ASM_OUTPUT_BYTE(FILE, VALUE) \
169 fprintf ((FILE), "%s 0x%x\n", ASM_BYTE_OP, (VALUE))
171 /* internal macro to output long */
172 #define _ASM_OUTPUT_LONG(FILE, VALUE) \
173 fprintf (FILE, "\t.long\t0x%lX\n", VALUE);
176 /* This is how to output an element of a case-vector that is absolute. */
178 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
179 fprintf (FILE, "%s\t%s%d\n", TARGET_64BIT?ASM_QUAD:ASM_LONG, \
182 /* This is how to output an element of a case-vector that is relative. */
184 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
185 fprintf (FILE, "%s\t%s%d-%s%d\n", TARGET_64BIT?ASM_QUAD:ASM_LONG, \
186 LPREFIX, VALUE, LPREFIX, REL)
190 /* This is how to output an assembler line
191 that says to advance the location counter
192 to a multiple of 2**LOG bytes. */
194 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
195 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
197 /* This is how to output an assembler line
198 that says to advance the location counter by SIZE bytes. */
200 #undef ASM_OUTPUT_SKIP
201 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
202 fprintf ((FILE), "\t.set .,.+%u\n", (SIZE))
204 /* This is how to output an assembler line
205 that says to advance the location counter
206 to a multiple of 2**LOG bytes. */
208 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
209 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
211 /* This is how to output an assembler line
212 that says to advance the location counter by SIZE bytes. */
214 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
215 fprintf ((FILE), "\t.set .,.+%u\n", (SIZE))
217 /* The routine used to output sequences of byte values. We use a special
218 version of this for most svr4 targets because doing so makes the
219 generated assembly code more compact (and thus faster to assemble)
220 as well as more readable. Note that if we find subparts of the
221 character sequence which end with NUL (and which are shorter than
222 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
224 #undef ASM_OUTPUT_ASCII
225 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
227 register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
228 register unsigned char *limit = _ascii_bytes + (LENGTH); \
229 register unsigned bytes_in_chunk = 0; \
230 for (; _ascii_bytes < limit; _ascii_bytes++) \
232 register unsigned char *p; \
233 if (bytes_in_chunk >= 64) \
235 fputc ('\n', (FILE)); \
236 bytes_in_chunk = 0; \
238 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
240 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
242 if (bytes_in_chunk > 0) \
244 fputc ('\n', (FILE)); \
245 bytes_in_chunk = 0; \
247 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
252 if (bytes_in_chunk == 0) \
253 fprintf ((FILE), "%s\t", ASM_BYTE_OP); \
255 fputc (',', (FILE)); \
256 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
257 bytes_in_chunk += 5; \
260 if (bytes_in_chunk > 0) \
261 fprintf ((FILE), "\n"); \
264 /* Output before read-only data. */
266 #define TEXT_SECTION_ASM_OP ".text"
268 /* Output before writable (initialized) data. */
270 #define DATA_SECTION_ASM_OP ".data"
272 /* Output before writable (uninitialized) data. */
274 #define BSS_SECTION_ASM_OP ".bss"
276 /* This is how to output a command to make the user-level label named NAME
277 defined for reference from other files. */
279 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
280 (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
282 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
284 /* Select section for constant in constant pool.
285 We are in the right section.
286 undef for 64 bit mode (linux64.h).
289 #undef SELECT_RTX_SECTION
290 #define SELECT_RTX_SECTION(MODE, X, ALIGN)
293 /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
294 Used for C++ multiple inheritance. */
295 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
301 fprintf (FILE, "\tlarl 1,0f\n"); \
302 fprintf (FILE, "\tagf %d,0(1)\n", \
303 aggregate_value_p (TREE_TYPE \
304 (TREE_TYPE (FUNCTION))) ? 3 :2 ); \
305 fprintf (FILE, "\tlarl 1,"); \
306 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
307 fprintf (FILE, "@GOTENT\n"); \
308 fprintf (FILE, "\tlg 1,0(1)\n"); \
309 fprintf (FILE, "\tbr 1\n"); \
310 fprintf (FILE, "0:\t.long %d\n",DELTA); \
314 fprintf (FILE, "\tlarl 1,0f\n"); \
315 fprintf (FILE, "\tagf %d,0(1)\n", \
316 aggregate_value_p (TREE_TYPE \
317 (TREE_TYPE (FUNCTION))) ? 3 :2 ); \
318 fprintf (FILE, "\tjg "); \
319 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
320 fprintf (FILE, "\n"); \
321 fprintf (FILE, "0:\t.long %d\n",DELTA); \
328 fprintf (FILE, "\tbras 1,0f\n"); \
329 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_-.\n"); \
330 fprintf (FILE, "\t.long "); \
331 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
332 fprintf (FILE, "@GOT\n"); \
333 fprintf (FILE, "\t.long %d\n",DELTA); \
334 fprintf (FILE, "0:\tal %d,8(1)\n", \
335 aggregate_value_p (TREE_TYPE \
336 (TREE_TYPE (FUNCTION))) ? 3 : 2 ); \
337 fprintf (FILE, "\tl 0,4(1)\n"); \
338 fprintf (FILE, "\tal 1,0(1)\n"); \
339 fprintf (FILE, "\talr 1,0\n"); \
340 fprintf (FILE, "\tl 1,0(1)\n"); \
341 fprintf (FILE, "\tbr 1\n"); \
343 fprintf (FILE, "\tbras 1,0f\n"); \
344 fprintf (FILE, "\t.long "); \
345 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
346 fprintf (FILE, "-.\n"); \
347 fprintf (FILE, "\t.long %d\n",DELTA); \
348 fprintf (FILE, "0:\tal %d,4(1)\n", \
349 aggregate_value_p (TREE_TYPE \
350 (TREE_TYPE (FUNCTION))) ? 3 : 2 ); \
351 fprintf (FILE, "\tal 1,0(1)\n"); \
352 fprintf (FILE, "\tbr 1\n"); \