* config/s390/linux.h (ASM_OUTPUT_ALIGNED_BSS): New.
[official-gcc.git] / gcc / config / s390 / linux.h
blob63c635172ac10854a047833a3ff13143defe48dc
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 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)
11 any later version.
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. */
23 #ifndef _LINUX_H
24 #define _LINUX_H
26 /* Target specific version string. */
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
37 /* Target specific type definitions. */
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")
45 #undef WCHAR_TYPE
46 #define WCHAR_TYPE "int"
47 #undef WCHAR_TYPE_SIZE
48 #define WCHAR_TYPE_SIZE 32
51 /* Target specific preprocessor settings. */
53 #define NO_BUILTIN_SIZE_TYPE
54 #define NO_BUILTIN_PTRDIFF_TYPE
56 #define CPP_PREDEFINES \
57 "-Dunix -Asystem(unix) -Dlinux -Asystem(linux) -D__ELF__ \
58 -Acpu(s390) -Amachine(s390) -D__s390__"
60 #define CPP_ARCH31_SPEC \
61 "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=int"
62 #define CPP_ARCH64_SPEC \
63 "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \
64 -D__s390x__ -D__LONG_MAX__=9223372036854775807L"
66 #ifdef DEFAULT_TARGET_64BIT
67 #undef CPP_SPEC
68 #define CPP_SPEC "%{m31:%(cpp_arch31)} %{!m31:%(cpp_arch64)}"
69 #else
70 #undef CPP_SPEC
71 #define CPP_SPEC "%{m64:%(cpp_arch64)} %{!m64:%(cpp_arch31)}"
72 #endif
75 /* Target specific compiler settings. */
77 /* ??? -fcaller-saves sometimes doesn't work. Fix this! */
78 #undef CC1_SPEC
79 #define CC1_SPEC "-fno-caller-saves"
80 #undef CC1PLUS_SPEC
81 #define CC1PLUS_SPEC "-fno-caller-saves"
84 /* Target specific assembler settings. */
86 #ifdef DEFAULT_TARGET_64BIT
87 #undef ASM_SPEC
88 #define ASM_SPEC "%{m31:-m31 -Aesa}"
89 #else
90 #undef ASM_SPEC
91 #define ASM_SPEC "%{m64:-m64 -Aesame}"
92 #endif
95 /* Target specific linker settings. */
97 #define LINK_ARCH31_SPEC \
98 "-m elf_s390 \
99 %{shared:-shared} \
100 %{!shared: \
101 %{static:-static} \
102 %{!static: \
103 %{rdynamic:-export-dynamic} \
104 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
106 #define LINK_ARCH64_SPEC \
107 "-m elf64_s390 \
108 %{shared:-shared} \
109 %{!shared: \
110 %{static:-static} \
111 %{!static: \
112 %{rdynamic:-export-dynamic} \
113 %{!dynamic-linker:-dynamic-linker /lib/ld64.so.1}}}"
115 #ifdef DEFAULT_TARGET_64BIT
116 #undef LINK_SPEC
117 #define LINK_SPEC "%{m31:%(link_arch31)} %{!m31:%(link_arch64)}"
118 #else
119 #undef LINK_SPEC
120 #define LINK_SPEC "%{m64:%(link_arch64)} %{!m64:%(link_arch31)}"
121 #endif
124 /* This macro defines names of additional specifications to put in the specs
125 that can be used in various specifications like CC1_SPEC. Its definition
126 is an initializer with a subgrouping for each command option. */
128 #define EXTRA_SPECS \
129 { "cpp_arch31", CPP_ARCH31_SPEC }, \
130 { "cpp_arch64", CPP_ARCH64_SPEC }, \
131 { "link_arch31", LINK_ARCH31_SPEC }, \
132 { "link_arch64", LINK_ARCH64_SPEC }, \
135 /* Character to start a comment. */
137 #define ASM_COMMENT_START "#"
140 /* Assembler pseudos to introduce constants of various size. */
142 #define ASM_DOUBLE "\t.double"
145 /* Prefix for internally generated assembler labels. */
146 #define LPREFIX ".L"
149 /* This is how to output the definition of a user-level label named NAME,
150 such as the label on a static function or variable NAME. */
152 #undef ASM_OUTPUT_LABEL
153 #define ASM_OUTPUT_LABEL(FILE, NAME) \
154 (assemble_name (FILE, NAME), fputs (":\n", FILE))
156 /* Store in OUTPUT a string (made with alloca) containing
157 an assembler-name for a local static variable named NAME.
158 LABELNO is an integer which is different for each call. */
160 #undef ASM_FORMAT_PRIVATE_NAME
161 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
162 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
163 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
166 /* internal macro to output long */
167 #define _ASM_OUTPUT_LONG(FILE, VALUE) \
168 fprintf (FILE, "\t.long\t0x%lX\n", VALUE);
171 /* This is how to output an element of a case-vector that is absolute. */
173 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
174 fprintf (FILE, "%s%s%d\n", integer_asm_op (UNITS_PER_WORD, TRUE), \
175 LPREFIX, VALUE)
177 /* This is how to output an element of a case-vector that is relative. */
179 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
180 fprintf (FILE, "%s%s%d-%s%d\n", integer_asm_op (UNITS_PER_WORD, TRUE), \
181 LPREFIX, VALUE, LPREFIX, REL)
185 /* This is how to output an assembler line
186 that says to advance the location counter
187 to a multiple of 2**LOG bytes. */
189 #undef ASM_OUTPUT_ALIGN
190 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
191 if ((LOG)!=0) fprintf ((FILE), "\t.align\t%d\n", 1<<(LOG))
193 /* This is how to output an assembler line
194 that says to advance the location counter by SIZE bytes. */
196 #undef ASM_OUTPUT_SKIP
197 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
198 fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE))
200 /* This is how to output assembler code to declare an
201 uninitialized external linkage data object. */
203 #undef ASM_OUTPUT_ALIGNED_BSS
204 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
205 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
207 /* Output before read-only data. */
209 #define TEXT_SECTION_ASM_OP ".text"
211 /* Output before writable (initialized) data. */
213 #define DATA_SECTION_ASM_OP ".data"
215 /* Output before writable (uninitialized) data. */
217 #define BSS_SECTION_ASM_OP ".bss"
219 /* This is how to output a command to make the user-level label named NAME
220 defined for reference from other files. */
222 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
223 (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
225 /* Select section for constant in constant pool.
226 We are in the right section.
227 undef for 64 bit mode (linux64.h).
230 #undef SELECT_RTX_SECTION
231 #define SELECT_RTX_SECTION(MODE, X, ALIGN)
234 /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
235 Used for C++ multiple inheritance. */
236 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
237 do { \
238 if (TARGET_64BIT) \
240 if (flag_pic) \
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, "\tlarl 1,"); \
247 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
248 fprintf (FILE, "@GOTENT\n"); \
249 fprintf (FILE, "\tlg 1,0(1)\n"); \
250 fprintf (FILE, "\tbr 1\n"); \
251 fprintf (FILE, "0:\t.long "); \
252 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
253 fprintf (FILE, "\n"); \
255 else \
257 fprintf (FILE, "\tlarl 1,0f\n"); \
258 fprintf (FILE, "\tagf %d,0(1)\n", \
259 aggregate_value_p (TREE_TYPE \
260 (TREE_TYPE (FUNCTION))) ? 3 :2 ); \
261 fprintf (FILE, "\tjg "); \
262 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
263 fprintf (FILE, "\n"); \
264 fprintf (FILE, "0:\t.long "); \
265 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
266 fprintf (FILE, "\n"); \
269 else \
271 if (flag_pic) \
273 fprintf (FILE, "\tbras 1,0f\n"); \
274 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_-.\n"); \
275 fprintf (FILE, "\t.long "); \
276 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
277 fprintf (FILE, "@GOT\n"); \
278 fprintf (FILE, "\t.long "); \
279 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
280 fprintf (FILE, "\n"); \
281 fprintf (FILE, "0:\tal %d,8(1)\n", \
282 aggregate_value_p (TREE_TYPE \
283 (TREE_TYPE (FUNCTION))) ? 3 : 2 ); \
284 fprintf (FILE, "\tl 0,4(1)\n"); \
285 fprintf (FILE, "\tal 1,0(1)\n"); \
286 fprintf (FILE, "\talr 1,0\n"); \
287 fprintf (FILE, "\tl 1,0(1)\n"); \
288 fprintf (FILE, "\tbr 1\n"); \
289 } else { \
290 fprintf (FILE, "\tbras 1,0f\n"); \
291 fprintf (FILE, "\t.long "); \
292 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
293 fprintf (FILE, "-.\n"); \
294 fprintf (FILE, "\t.long "); \
295 fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, (DELTA)); \
296 fprintf (FILE, "\n"); \
297 fprintf (FILE, "0:\tal %d,4(1)\n", \
298 aggregate_value_p (TREE_TYPE \
299 (TREE_TYPE (FUNCTION))) ? 3 : 2 ); \
300 fprintf (FILE, "\tal 1,0(1)\n"); \
301 fprintf (FILE, "\tbr 1\n"); \
304 } while (0)
306 #endif