]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/linux64.h
aix31.h: Fix comment formatting.
[thirdparty/gcc.git] / gcc / config / rs6000 / linux64.h
1 /* Definitions of target machine for GNU compiler,
2 for 64 bit powerpc linux.
3 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Yes! We are AIX! Err. Wait. We're Linux!. No, wait, we're a
23 combo of both!*/
24 #undef DEFAULT_ABI
25 #define DEFAULT_ABI ABI_AIX
26
27 #undef TARGET_AIX
28 #define TARGET_AIX 1
29
30 #undef TARGET_DEFAULT
31 #define TARGET_DEFAULT (MASK_POWERPC | MASK_POWERPC64 | MASK_64BIT | MASK_NEW_MNEMONICS)
32
33 #define USER_LABEL_PREFIX ""
34
35 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
36 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
37 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
38 ? get_inner_array_type (FIELD) \
39 : TREE_TYPE (FIELD)) == DFmode \
40 ? MIN ((COMPUTED), 32) : (COMPUTED))
41
42 /* AIX increases natural record alignment to doubleword if the first
43 field is an FP double while the FP fields remain word aligned. */
44 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
45 ((TREE_CODE (STRUCT) == RECORD_TYPE \
46 || TREE_CODE (STRUCT) == UNION_TYPE \
47 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
48 && TYPE_FIELDS (STRUCT) != 0 \
49 && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
50 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \
51 : MAX ((COMPUTED), (SPECIFIED)))
52
53 /* Indicate that jump tables go in the text section. */
54 #undef JUMP_TABLES_IN_TEXT_SECTION
55 #define JUMP_TABLES_IN_TEXT_SECTION 1
56
57 /* Define cutoff for using external functions to save floating point. */
58 #undef FP_SAVE_INLINE
59 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
60
61 /* 64-bit PowerPC Linux always has a TOC. */
62 #undef TARGET_NO_TOC
63 #define TARGET_NO_TOC 0
64 #undef TARGET_TOC
65 #define TARGET_TOC 1
66
67 /* 64-bit PowerPC Linux always has GPR13 fixed. */
68 #define FIXED_R13 1
69
70 /* __throw will restore its own return address to be the same as the
71 return address of the function that the throw is being made to.
72 This is unfortunate, because we want to check the original
73 return address to see if we need to restore the TOC.
74 So we have to squirrel it away with this. */
75 #define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
76
77 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
78
79 /* Don't assume anything about the header files. */
80 #define NO_IMPLICIT_EXTERN_C
81
82 #undef MD_EXEC_PREFIX
83 #undef MD_STARTFILE_PREFIX
84
85 #undef CPP_PREDEFINES
86 #define CPP_PREDEFINES \
87 "-D_PPC_ -D__PPC__ -D_PPC64_ -D__PPC64__ -D__powerpc__ -D__powerpc64__ \
88 -D_PIC_ -D__PIC__ -D_BIG_ENDIAN -D__BIG_ENDIAN__ -D__ELF__ \
89 -D__LONG_MAX__=9223372036854775807L \
90 -Acpu=powerpc64 -Amachine=powerpc64"
91
92 #undef CPP_OS_DEFAULT_SPEC
93 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
94
95 /* The GNU C++ standard library currently requires _GNU_SOURCE being
96 defined on glibc-based systems. This temporary hack accomplishes this,
97 it should go away as soon as libstdc++-v3 has a real fix. */
98 #undef CPLUSPLUS_CPP_SPEC
99 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
100
101 #undef LINK_SHLIB_SPEC
102 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
103
104 #undef LIB_DEFAULT_SPEC
105 #define LIB_DEFAULT_SPEC "%(lib_linux)"
106
107 #undef STARTFILE_DEFAULT_SPEC
108 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
109
110 #undef ENDFILE_DEFAULT_SPEC
111 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
112
113 #undef LINK_START_DEFAULT_SPEC
114 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
115
116 #undef LINK_OS_DEFAULT_SPEC
117 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
118
119 #undef LINK_OS_LINUX_SPEC
120 #define LINK_OS_LINUX_SPEC "-m elf64ppc %{!shared: %{!static: \
121 %{rdynamic:-export-dynamic} \
122 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
123
124 #undef TOC_SECTION_ASM_OP
125 #define TOC_SECTION_ASM_OP "\t.section\t\".toc\",\"aw\""
126
127 #undef MINIMAL_TOC_SECTION_ASM_OP
128 #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".toc1\",\"aw\"\n\t.align 3"
129
130 #undef TARGET_VERSION
131 #define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)");
132
133 /* Must be at least as big as our pointer type. */
134 #undef SIZE_TYPE
135 #define SIZE_TYPE "long unsigned int"
136
137 #undef PTRDIFF_TYPE
138 #define PTRDIFF_TYPE "long int"
139
140 #undef WCHAR_TYPE
141 #define WCHAR_TYPE "int"
142 #undef WCHAR_TYPE_SIZE
143 #define WCHAR_TYPE_SIZE 32
144
145 /* Override rs6000.h definition. */
146 #undef ASM_APP_ON
147 #define ASM_APP_ON "#APP\n"
148
149 /* Override rs6000.h definition. */
150 #undef ASM_APP_OFF
151 #define ASM_APP_OFF "#NO_APP\n"
152
153 /* PowerPC no-op instruction. */
154 #undef RS6000_CALL_GLUE
155 #define RS6000_CALL_GLUE "nop"
156
157 #undef RS6000_MCOUNT
158 #define RS6000_MCOUNT ".__mcount"
159
160 /* FP save and restore routines. */
161 #undef SAVE_FP_PREFIX
162 #define SAVE_FP_PREFIX "._savef"
163 #undef SAVE_FP_SUFFIX
164 #define SAVE_FP_SUFFIX ""
165 #undef RESTORE_FP_PREFIX
166 #define RESTORE_FP_PREFIX "._restf"
167 #undef RESTORE_FP_SUFFIX
168 #define RESTORE_FP_SUFFIX ""
169
170 /* Dwarf2 debugging. */
171 #undef PREFERRED_DEBUGGING_TYPE
172 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
173
174 /* This macro gets just the user-specified name
175 out of the string in a SYMBOL_REF. Discard
176 a leading * or @. */
177 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
178 do { \
179 const char *_name = SYMBOL_NAME; \
180 while (*_name == '*' || *_name == '@') \
181 _name++; \
182 (VAR) = _name; \
183 } while (0)
184
185 /* This is how to output a reference to a user-level label named NAME.
186 `assemble_name' uses this. */
187
188 /* Override elfos.h definition. */
189 #undef ASM_OUTPUT_LABELREF
190 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
191 do { \
192 const char *_name = NAME; \
193 if (*_name == '@') \
194 _name++; \
195 \
196 if (*_name == '*') \
197 fprintf (FILE, "%s", _name + 1); \
198 else \
199 asm_fprintf (FILE, "%U%s", _name); \
200 } while (0)
201
202 #undef ASM_DECLARE_FUNCTION_NAME
203 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
204 do { \
205 if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag) \
206 && uses_TOC()) \
207 { \
208 char buf[256]; \
209 \
210 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
211 \
212 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
213 fputs ("\t.quad ", FILE); \
214 assemble_name (FILE, buf); \
215 putc ('-', FILE); \
216 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
217 assemble_name (FILE, buf); \
218 putc ('\n', FILE); \
219 } \
220 \
221 fprintf (FILE, "%s", TYPE_ASM_OP); \
222 assemble_name (FILE, NAME); \
223 putc (',', FILE); \
224 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
225 putc ('\n', FILE); \
226 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
227 \
228 if (DEFAULT_ABI == ABI_AIX) \
229 { \
230 const char *desc_name, *orig_name; \
231 \
232 STRIP_NAME_ENCODING (orig_name, NAME); \
233 desc_name = orig_name; \
234 while (*desc_name == '.') \
235 desc_name++; \
236 \
237 if (TREE_PUBLIC (DECL)) \
238 fprintf (FILE, "\t.globl %s\n", desc_name); \
239 \
240 fputs ("\t.section\t\".opd\",\"aw\"\n", FILE); \
241 fprintf (FILE, "%s:\n", desc_name); \
242 fprintf (FILE, "\t.quad %s\n", orig_name); \
243 fputs ("\t.quad .TOC.@tocbase\n", FILE); \
244 if (DEFAULT_ABI == ABI_AIX) \
245 fputs ("\t.quad 0\n", FILE); \
246 fprintf (FILE, "\t.previous\n"); \
247 } \
248 ASM_OUTPUT_LABEL (FILE, NAME); \
249 } while (0)
250
251 /* Return non-zero if this entry is to be written into the constant
252 pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
253 or a CONST containing one of them. If -mfp-in-toc (the default),
254 we also do this for floating-point constants. We actually can only
255 do this if the FP formats of the target and host machines are the
256 same, but we can't check that since not every file that uses
257 GO_IF_LEGITIMATE_ADDRESS_P includes real.h. We also do this when
258 we can write the entry into the TOC and the entry is not larger
259 than a TOC entry. */
260
261 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
262 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
263 (TARGET_TOC \
264 && (GET_CODE (X) == SYMBOL_REF \
265 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
266 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
267 || GET_CODE (X) == LABEL_REF \
268 || (GET_CODE (X) == CONST_INT \
269 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
270 || (GET_CODE (X) == CONST_DOUBLE \
271 && (TARGET_POWERPC64 \
272 || TARGET_MINIMAL_TOC \
273 || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
274 && ! TARGET_NO_FP_IN_TOC)))))
275
276 /* This is how to output an assembler line defining an `int'
277 constant. */
278 #undef ASM_OUTPUT_INT
279 #define ASM_OUTPUT_INT(FILE, VALUE) \
280 do \
281 { \
282 fputs ("\t.long ", (FILE)); \
283 output_addr_const ((FILE), (VALUE)); \
284 putc ('\n', (FILE)); \
285 } \
286 while (0)
287
288 /* This is how to output an assembler line defining a `double int'
289 constant. */
290 #undef ASM_OUTPUT_DOUBLE_INT
291 #define ASM_OUTPUT_DOUBLE_INT(FILE, VALUE) \
292 do \
293 { \
294 fputs (DOUBLE_INT_ASM_OP, (FILE)); \
295 output_addr_const ((FILE), (VALUE)); \
296 putc ('\n', (FILE)); \
297 } \
298 while (0)
299
300 #undef ASM_DEFAULT_SPEC
301 #define ASM_DEFAULT_SPEC "-mppc64"