]>
git.ipfire.org Git - thirdparty/gcc.git/blob - 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.
5 This file is part of GNU CC.
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)
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.
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. */
22 /* Yes! We are AIX! Err. Wait. We're Linux!. No, wait, we're a
25 #define DEFAULT_ABI ABI_AIX
31 #define TARGET_DEFAULT (MASK_POWERPC | MASK_POWERPC64 | MASK_64BIT | MASK_NEW_MNEMONICS)
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 ""
39 /* Tell the assembler to assume that all undefined names are external.
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. */
47 /* #define ASM_SPEC "-u %(asm_cpu)" */
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))
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)))
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
71 /* Define cutoff for using external functions to save floating point. */
73 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
78 /* 64-bit PowerPC Linux always has a TOC. */
79 #define TARGET_NO_TOC 0
82 /* 64-bit PowerPC Linux always has GPR13 fixed. */
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 ()
92 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
93 /* Don't assume anything about the header files. */
94 #define NO_IMPLICIT_EXTERN_C
97 #undef MD_STARTFILE_PREFIX
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"
106 #undef CPP_OS_DEFAULT_SPEC
107 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
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)"
115 #undef LINK_SHLIB_SPEC
116 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
118 #undef LIB_DEFAULT_SPEC
119 #define LIB_DEFAULT_SPEC "%(lib_linux)"
121 #undef STARTFILE_DEFAULT_SPEC
122 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
124 #undef ENDFILE_DEFAULT_SPEC
125 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
127 #undef LINK_START_DEFAULT_SPEC
128 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
130 #undef LINK_OS_DEFAULT_SPEC
131 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
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}}}"
138 #undef TOC_SECTION_ASM_OP
139 #define TOC_SECTION_ASM_OP "\t.section\t\".toc\",\"aw\""
141 #undef MINIMAL_TOC_SECTION_ASM_OP
142 #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".toc1\",\"aw\"\n\t.align 3"
144 #undef TARGET_VERSION
145 #define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)");
147 /* Must be at least as big as our pointer type. */
149 #define SIZE_TYPE "long unsigned int"
152 #define PTRDIFF_TYPE "long int"
155 #define WCHAR_TYPE "int"
156 #undef WCHAR_TYPE_SIZE
157 #define WCHAR_TYPE_SIZE 32
159 /* Override rs6000.h definition. */
161 #define ASM_APP_ON "#APP\n"
163 /* Override rs6000.h definition. */
165 #define ASM_APP_OFF "#NO_APP\n"
167 /* PowerPC no-op instruction. */
168 #undef RS6000_CALL_GLUE
169 #define RS6000_CALL_GLUE "nop"
171 /* Dwarf2 debugging. */
172 #undef PREFERRED_DEBUGGING_TYPE
173 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
175 /* This macro gets just the user-specified name
176 out of the string in a SYMBOL_REF. Discard
178 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
180 const char *_name = SYMBOL_NAME; \
181 while (*_name == '*' || *_name == '@') \
186 /* This is how to output a reference to a user-level label named NAME.
187 `assemble_name' uses this. */
189 /* Override elfos.h definition. */
190 #undef ASM_OUTPUT_LABELREF
191 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
193 const char *_name = NAME; \
198 fprintf (FILE, "%s", _name + 1); \
200 asm_fprintf (FILE, "%U%s", _name); \
203 #undef ASM_DECLARE_FUNCTION_NAME
204 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
206 if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag) \
211 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
213 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
214 fputs ("\t.quad ", FILE); \
215 assemble_name (FILE, buf); \
217 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
218 assemble_name (FILE, buf); \
222 fprintf (FILE, "%s", TYPE_ASM_OP); \
223 assemble_name (FILE, NAME); \
225 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
227 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
229 if (DEFAULT_ABI == ABI_AIX) \
231 const char *desc_name, *orig_name; \
233 STRIP_NAME_ENCODING (orig_name, NAME); \
234 desc_name = orig_name; \
235 while (*desc_name == '.') \
238 if (TREE_PUBLIC (DECL)) \
239 fprintf (FILE, "\t.globl %s\n", desc_name); \
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"); \
249 ASM_OUTPUT_LABEL (FILE, NAME); \
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
262 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
263 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
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)))))
277 /* This is how to output an assembler line defining an `int'
279 #undef ASM_OUTPUT_INT
280 #define ASM_OUTPUT_INT(FILE, VALUE) \
283 fputs ("\t.long ", (FILE)); \
284 output_addr_const ((FILE), (VALUE)); \
285 putc ('\n', (FILE)); \
289 /* This is how to output an assembler line defining a `double int'
291 #undef ASM_OUTPUT_DOUBLE_INT
292 #define ASM_OUTPUT_DOUBLE_INT(FILE, VALUE) \
295 fputs (DOUBLE_INT_ASM_OP, (FILE)); \
296 output_addr_const ((FILE), (VALUE)); \
297 putc ('\n', (FILE)); \
301 #undef ASM_DEFAULT_SPEC
302 #define ASM_DEFAULT_SPEC "-mppc64"