]>
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 #define USER_LABEL_PREFIX ""
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))
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)))
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
58 /* Define cutoff for using external functions to save floating point. */
60 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
62 /* 64-bit PowerPC Linux always has a TOC. */
64 #define TARGET_NO_TOC 0
68 /* 64-bit PowerPC Linux always has GPR13 fixed. */
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 ()
78 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
80 /* Don't assume anything about the header files. */
81 #define NO_IMPLICIT_EXTERN_C
84 #undef MD_STARTFILE_PREFIX
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"
93 #undef CPP_OS_DEFAULT_SPEC
94 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
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)"
102 #undef LINK_SHLIB_SPEC
103 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
105 #undef LIB_DEFAULT_SPEC
106 #define LIB_DEFAULT_SPEC "%(lib_linux)"
108 #undef STARTFILE_DEFAULT_SPEC
109 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
111 #undef ENDFILE_DEFAULT_SPEC
112 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
114 #undef LINK_START_DEFAULT_SPEC
115 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
117 #undef LINK_OS_DEFAULT_SPEC
118 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
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}}}"
125 #undef TOC_SECTION_ASM_OP
126 #define TOC_SECTION_ASM_OP "\t.section\t\".toc\",\"aw\""
128 #undef MINIMAL_TOC_SECTION_ASM_OP
129 #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".toc1\",\"aw\"\n\t.align 3"
131 #undef TARGET_VERSION
132 #define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)");
134 /* Must be at least as big as our pointer type. */
136 #define SIZE_TYPE "long unsigned int"
139 #define PTRDIFF_TYPE "long int"
142 #define WCHAR_TYPE "int"
143 #undef WCHAR_TYPE_SIZE
144 #define WCHAR_TYPE_SIZE 32
146 /* Override rs6000.h definition. */
148 #define ASM_APP_ON "#APP\n"
150 /* Override rs6000.h definition. */
152 #define ASM_APP_OFF "#NO_APP\n"
154 /* PowerPC no-op instruction. */
155 #undef RS6000_CALL_GLUE
156 #define RS6000_CALL_GLUE "nop"
159 #define RS6000_MCOUNT ".__mcount"
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 ""
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 #undef ASM_DEFAULT_SPEC
278 #define ASM_DEFAULT_SPEC "-mppc64"
280 /* We don't need to generate entries in .fixup. */
281 #undef RELOCATABLE_NEEDS_FIXUP