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