* config/rs6000/t-spe (MULTILIB_EXCEPTIONS): Allow isel without SPE.
[official-gcc.git] / gcc / config / rs6000 / aix.h
blob5ab01848643eb40ef14335e484cbac39f3eead11
1 /* Definitions of target machine for GNU compiler,
2 for IBM RS/6000 POWER running AIX.
3 Copyright (C) 2000-2014 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 /* Yes! We are AIX! */
22 #define DEFAULT_ABI ABI_AIX
23 #undef TARGET_AIX
24 #define TARGET_AIX 1
26 /* Linux64.h wants to redefine TARGET_AIX based on -m64, but it can't be used
27 in the #if conditional in options-default.h, so provide another macro. */
28 #undef TARGET_AIX_OS
29 #define TARGET_AIX_OS 1
31 /* AIX always has a TOC. */
32 #define TARGET_NO_TOC 0
33 #define TARGET_TOC 1
34 #define FIXED_R2 1
36 /* AIX allows r13 to be used in 32-bit mode. */
37 #define FIXED_R13 0
39 /* 32-bit and 64-bit AIX stack boundary is 128. */
40 #undef STACK_BOUNDARY
41 #define STACK_BOUNDARY 128
43 #undef TARGET_IEEEQUAD
44 #define TARGET_IEEEQUAD 0
46 /* The AIX linker will discard static constructors in object files before
47 collect has a chance to see them, so scan the object files directly. */
48 #define COLLECT_EXPORT_LIST
50 /* On AIX, initialisers specified with -binitfini are called in breadth-first
51 order.
52 e.g. if a.out depends on lib1.so, the init function for a.out is called before
53 the init function for lib1.so.
55 To ensure global C++ constructors in linked libraries are run before global
56 C++ constructors from the current module, there is additional symbol scanning
57 logic in collect2.
59 The global initialiser/finaliser functions are named __GLOBAL_AIXI_{libname}
60 and __GLOBAL_AIXD_{libname} and are exported from each shared library.
62 collect2 will detect these symbols when they exist in shared libraries that
63 the current program is being linked against. All such initiliser functions
64 will be called prior to the constructors of the current program, and
65 finaliser functions called after destructors.
67 Reference counting generated by collect2 will ensure that constructors are
68 only invoked once in the case of multiple dependencies on a library.
70 -binitfini is still used in parallel to this solution.
71 This handles the case where a library is loaded through dlopen(), and also
72 handles the option -blazy.
74 #define COLLECT_SHARED_INIT_FUNC(STREAM, FUNC) \
75 fprintf ((STREAM), "void %s() {\n\t%s();\n}\n", aix_shared_initname, (FUNC))
76 #define COLLECT_SHARED_FINI_FUNC(STREAM, FUNC) \
77 fprintf ((STREAM), "void %s() {\n\t%s();\n}\n", aix_shared_fininame, (FUNC))
79 #if HAVE_AS_REF
80 /* Issue assembly directives that create a reference to the given DWARF table
81 identifier label from the current function section. This is defined to
82 ensure we drag frame frame tables associated with needed function bodies in
83 a link with garbage collection activated. */
84 #define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
85 #endif
87 /* This is the only version of nm that collect2 can work with. */
88 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
90 #define USER_LABEL_PREFIX ""
92 /* Don't turn -B into -L if the argument specifies a relative file name. */
93 #define RELATIVE_PREFIX_NOT_LINKDIR
95 /* Because of the above, we must have gcc search itself to find libgcc.a. */
96 #define LINK_LIBGCC_SPECIAL_1
98 /* Names to predefine in the preprocessor for this target machine. */
99 #define TARGET_OS_AIX_CPP_BUILTINS() \
100 do \
102 builtin_define ("_IBMR2"); \
103 builtin_define ("_POWER"); \
104 builtin_define ("__powerpc__"); \
105 builtin_define ("__PPC__"); \
106 builtin_define ("__unix__"); \
107 builtin_define ("_AIX"); \
108 builtin_define ("_AIX32"); \
109 builtin_define ("_AIX41"); \
110 builtin_define ("_LONG_LONG"); \
111 if (TARGET_LONG_DOUBLE_128) \
112 builtin_define ("__LONGDOUBLE128"); \
113 builtin_assert ("system=unix"); \
114 builtin_assert ("system=aix"); \
116 while (0)
118 /* Define appropriate architecture macros for preprocessor depending on
119 target switches. */
121 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
122 %{ansi: -D_ANSI_C_SOURCE}"
124 #define CC1_SPEC "%(cc1_cpu)"
126 #undef ASM_DEFAULT_SPEC
127 #define ASM_DEFAULT_SPEC ""
129 /* Tell the assembler to assume that all undefined names are external.
131 Don't do this until the fixed IBM assembler is more generally available.
132 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
133 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
134 longer be needed. Also, the extern declaration of mcount in
135 rs6000_xcoff_file_start will no longer be needed. */
137 /* #define ASM_SPEC "-u %(asm_cpu)" */
139 /* Default location of syscalls.exp under AIX */
140 #define LINK_SYSCALLS_SPEC "-bI:%R/lib/syscalls.exp"
142 /* Default location of libg.exp under AIX */
143 #define LINK_LIBG_SPEC "-bexport:%R/usr/lib/libg.exp"
145 /* Define the options for the binder: Start text at 512, align all segments
146 to 512 bytes, and warn if there is text relocation.
148 The -bhalt:4 option supposedly changes the level at which ld will abort,
149 but it also suppresses warnings about multiply defined symbols and is
150 used by the AIX cc command. So we use it here.
152 -bnodelcsect undoes a poor choice of default relating to multiply-defined
153 csects. See AIX documentation for more information about this.
155 -bM:SRE tells the linker that the output file is Shared REusable. Note
156 that to actually build a shared library you will also need to specify an
157 export list with the -Wl,-bE option. */
159 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
160 %{static:-bnso %(link_syscalls) } \
161 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
163 /* Profiled library versions are used by linking with special directories. */
164 #define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
165 %{p:-L%R/lib/profiled -L%R/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
167 /* Static linking with shared libstdc++ requires libsupc++ as well. */
168 #define LIBSTDCXX_STATIC "supc++"
170 /* This now supports a natural alignment mode. */
171 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
172 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
173 ((TARGET_ALIGN_NATURAL == 0 \
174 && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \
175 ? MIN ((COMPUTED), 32) \
176 : (COMPUTED))
178 /* AIX increases natural record alignment to doubleword if the first
179 field is an FP double while the FP fields remain word aligned. */
180 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
181 ((TREE_CODE (STRUCT) == RECORD_TYPE \
182 || TREE_CODE (STRUCT) == UNION_TYPE \
183 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
184 && TARGET_ALIGN_NATURAL == 0 \
185 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
186 : MAX ((COMPUTED), (SPECIFIED)))
188 /* The AIX ABI isn't explicit on whether aggregates smaller than a
189 word/doubleword should be padded upward or downward. One could
190 reasonably assume that they follow the normal rules for structure
191 layout treating the parameter area as any other block of memory,
192 then map the reg param area to registers, i.e., pad upward, which
193 is the way IBM Compilers for AIX behave.
194 Setting both of the following defines results in this behavior. */
195 #define AGGREGATE_PADDING_FIXED 1
196 #define AGGREGATES_PAD_UPWARD_ALWAYS 1
198 /* Specify padding for the last element of a block move between
199 registers and memory. FIRST is nonzero if this is the only
200 element. */
201 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
202 (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
204 /* Indicate that jump tables go in the text section. */
206 #define JUMP_TABLES_IN_TEXT_SECTION 1
208 /* Define any extra SPECS that the compiler needs to generate. */
209 #undef SUBTARGET_EXTRA_SPECS
210 #define SUBTARGET_EXTRA_SPECS \
211 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
212 { "link_libg", LINK_LIBG_SPEC }
214 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
216 /* No version of AIX fully supports AltiVec or 64-bit instructions in
217 32-bit mode. */
218 #define OS_MISSING_POWERPC64 1
219 #define OS_MISSING_ALTIVEC 1
221 /* WINT_TYPE */
222 #define WINT_TYPE "int"
224 /* Static stack checking is supported by means of probes. */
225 #define STACK_CHECK_STATIC_BUILTIN 1