]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/linux64.h
aix.h (CPP_CPU_SPEC): Move back to rs6000.h
[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 /* AIX does not have any init/fini or ctor/dtor sections, so create
34 static constructors and destructors as normal functions. */
35 /* #define ASM_OUTPUT_CONSTRUCTOR(file, name) */
36 /* #define ASM_OUTPUT_DESTRUCTOR(file, name) */
37 #define USER_LABEL_PREFIX ""
38
39 /* Tell the assembler to assume that all undefined names are external.
40
41 Don't do this until the fixed IBM assembler is more generally available.
42 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
43 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
44 longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
45 will no longer be needed. */
46
47 /* #define ASM_SPEC "-u %(asm_cpu)" */
48
49 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
50 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
51 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
52 ? get_inner_array_type (FIELD) \
53 : TREE_TYPE (FIELD)) == DFmode \
54 ? MIN ((COMPUTED), 32) : (COMPUTED))
55
56 /* AIX increases natural record alignment to doubleword if the first
57 field is an FP double while the FP fields remain word aligned. */
58 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
59 ((TREE_CODE (STRUCT) == RECORD_TYPE \
60 || TREE_CODE (STRUCT) == UNION_TYPE \
61 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
62 && TYPE_FIELDS (STRUCT) != 0 \
63 && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
64 ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
65 : MAX ((COMPUTED), (SPECIFIED)))
66
67 /* Indicate that jump tables go in the text section. */
68 #undef JUMP_TABLES_IN_TEXT_SECTION
69 #define JUMP_TABLES_IN_TEXT_SECTION 1
70
71 /* Define cutoff for using external functions to save floating point. */
72 #undef FP_SAVE_INLINE
73 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
74
75 #undef TARGET_NO_TOC
76 #undef TARGET_TOC
77
78 /* 64-bit PowerPC Linux always has a TOC. */
79 #define TARGET_NO_TOC 0
80 #define TARGET_TOC 1
81
82 /* 64-bit PowerPC Linux always has GPR13 fixed. */
83 #define FIXED_R13 1
84
85 /* __throw will restore its own return address to be the same as the
86 return address of the function that the throw is being made to.
87 This is unfortunate, because we want to check the original
88 return address to see if we need to restore the TOC.
89 So we have to squirrel it away with this. */
90 #define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
91
92 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
93 /* Don't assume anything about the header files. */
94 #define NO_IMPLICIT_EXTERN_C
95
96 #undef MD_EXEC_PREFIX
97 #undef MD_STARTFILE_PREFIX
98
99 #undef CPP_PREDEFINES
100 #define CPP_PREDEFINES \
101 "-D_PPC_ -D__PPC__ -D_PPC64_ -D__PPC64__ -D__powerpc__ -D__powerpc64__ \
102 -D_PIC_ -D__PIC__ -D_BIG_ENDIAN -D__BIG_ENDIAN__ -D__ELF__ \
103 -D__LONG_MAX__=9223372036854775807L \
104 -Acpu=powerpc64 -Amachine=powerpc64"
105
106 #undef CPP_OS_DEFAULT_SPEC
107 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
108
109 /* The GNU C++ standard library currently requires _GNU_SOURCE being
110 defined on glibc-based systems. This temporary hack accomplishes this,
111 it should go away as soon as libstdc++-v3 has a real fix. */
112 #undef CPLUSPLUS_CPP_SPEC
113 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
114
115 #undef LINK_SHLIB_SPEC
116 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
117
118 #undef LIB_DEFAULT_SPEC
119 #define LIB_DEFAULT_SPEC "%(lib_linux)"
120
121 #undef STARTFILE_DEFAULT_SPEC
122 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
123
124 #undef ENDFILE_DEFAULT_SPEC
125 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
126
127 #undef LINK_START_DEFAULT_SPEC
128 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
129
130 #undef LINK_OS_DEFAULT_SPEC
131 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
132
133 #undef LINK_OS_LINUX_SPEC
134 #define LINK_OS_LINUX_SPEC "-m elf64ppc %{!shared: %{!static: \
135 %{rdynamic:-export-dynamic} \
136 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
137
138 #undef TOC_SECTION_ASM_OP
139 #define TOC_SECTION_ASM_OP "\t.section\t\".toc\",\"aw\""
140
141 #undef MINIMAL_TOC_SECTION_ASM_OP
142 #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".toc1\",\"aw\"\n\t.align 3"
143
144 #undef TARGET_VERSION
145 #define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)");
146
147 /* Must be at least as big as our pointer type. */
148 #undef SIZE_TYPE
149 #define SIZE_TYPE "long unsigned int"
150
151 #undef PTRDIFF_TYPE
152 #define PTRDIFF_TYPE "long int"
153
154 #undef WCHAR_TYPE
155 #define WCHAR_TYPE "int"
156 #undef WCHAR_TYPE_SIZE
157 #define WCHAR_TYPE_SIZE 32
158
159 /* Override rs6000.h definition. */
160 #undef ASM_APP_ON
161 #define ASM_APP_ON "#APP\n"
162
163 /* Override rs6000.h definition. */
164 #undef ASM_APP_OFF
165 #define ASM_APP_OFF "#NO_APP\n"
166
167 /* PowerPC no-op instruction. */
168 #undef RS6000_CALL_GLUE
169 #define RS6000_CALL_GLUE "nop"
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"