Reverting merge from trunk
[official-gcc.git] / gcc / config / rs6000 / aix.h
bloba11bd57284d4646c341c30a83da263ca8ad00275
1 /* Definitions of target machine for GNU compiler,
2 for IBM RS/6000 POWER running AIX.
3 Copyright (C) 2000-2013 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 #if HAVE_AS_REF
51 /* Issue assembly directives that create a reference to the given DWARF table
52 identifier label from the current function section. This is defined to
53 ensure we drag frame frame tables associated with needed function bodies in
54 a link with garbage collection activated. */
55 #define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
56 #endif
58 /* This is the only version of nm that collect2 can work with. */
59 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
61 #define USER_LABEL_PREFIX ""
63 /* Don't turn -B into -L if the argument specifies a relative file name. */
64 #define RELATIVE_PREFIX_NOT_LINKDIR
66 /* Because of the above, we must have gcc search itself to find libgcc.a. */
67 #define LINK_LIBGCC_SPECIAL_1
69 /* Names to predefine in the preprocessor for this target machine. */
70 #define TARGET_OS_AIX_CPP_BUILTINS() \
71 do \
72 { \
73 builtin_define ("_IBMR2"); \
74 builtin_define ("_POWER"); \
75 builtin_define ("__powerpc__"); \
76 builtin_define ("__PPC__"); \
77 builtin_define ("__unix__"); \
78 builtin_define ("_AIX"); \
79 builtin_define ("_AIX32"); \
80 builtin_define ("_AIX41"); \
81 builtin_define ("_LONG_LONG"); \
82 if (TARGET_LONG_DOUBLE_128) \
83 builtin_define ("__LONGDOUBLE128"); \
84 builtin_assert ("system=unix"); \
85 builtin_assert ("system=aix"); \
86 } \
87 while (0)
89 /* Define appropriate architecture macros for preprocessor depending on
90 target switches. */
92 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
93 %{ansi: -D_ANSI_C_SOURCE}"
95 #define CC1_SPEC "%(cc1_cpu)"
97 #undef ASM_DEFAULT_SPEC
98 #define ASM_DEFAULT_SPEC ""
100 /* Tell the assembler to assume that all undefined names are external.
102 Don't do this until the fixed IBM assembler is more generally available.
103 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
104 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
105 longer be needed. Also, the extern declaration of mcount in
106 rs6000_xcoff_file_start will no longer be needed. */
108 /* #define ASM_SPEC "-u %(asm_cpu)" */
110 /* Default location of syscalls.exp under AIX */
111 #define LINK_SYSCALLS_SPEC "-bI:%R/lib/syscalls.exp"
113 /* Default location of libg.exp under AIX */
114 #define LINK_LIBG_SPEC "-bexport:%R/usr/lib/libg.exp"
116 /* Define the options for the binder: Start text at 512, align all segments
117 to 512 bytes, and warn if there is text relocation.
119 The -bhalt:4 option supposedly changes the level at which ld will abort,
120 but it also suppresses warnings about multiply defined symbols and is
121 used by the AIX cc command. So we use it here.
123 -bnodelcsect undoes a poor choice of default relating to multiply-defined
124 csects. See AIX documentation for more information about this.
126 -bM:SRE tells the linker that the output file is Shared REusable. Note
127 that to actually build a shared library you will also need to specify an
128 export list with the -Wl,-bE option. */
130 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
131 %{static:-bnso %(link_syscalls) } \
132 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
134 /* Profiled library versions are used by linking with special directories. */
135 #define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
136 %{p:-L%R/lib/profiled -L%R/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
138 /* Static linking with shared libstdc++ requires libsupc++ as well. */
139 #define LIBSTDCXX_STATIC "supc++"
141 /* This now supports a natural alignment mode. */
142 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
143 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
144 ((TARGET_ALIGN_NATURAL == 0 \
145 && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \
146 ? MIN ((COMPUTED), 32) \
147 : (COMPUTED))
149 /* AIX increases natural record alignment to doubleword if the first
150 field is an FP double while the FP fields remain word aligned. */
151 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
152 ((TREE_CODE (STRUCT) == RECORD_TYPE \
153 || TREE_CODE (STRUCT) == UNION_TYPE \
154 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
155 && TARGET_ALIGN_NATURAL == 0 \
156 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
157 : MAX ((COMPUTED), (SPECIFIED)))
159 /* The AIX ABI isn't explicit on whether aggregates smaller than a
160 word/doubleword should be padded upward or downward. One could
161 reasonably assume that they follow the normal rules for structure
162 layout treating the parameter area as any other block of memory,
163 then map the reg param area to registers, i.e., pad upward, which
164 is the way IBM Compilers for AIX behave.
165 Setting both of the following defines results in this behavior. */
166 #define AGGREGATE_PADDING_FIXED 1
167 #define AGGREGATES_PAD_UPWARD_ALWAYS 1
169 /* Specify padding for the last element of a block move between
170 registers and memory. FIRST is nonzero if this is the only
171 element. */
172 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
173 (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
175 /* Indicate that jump tables go in the text section. */
177 #define JUMP_TABLES_IN_TEXT_SECTION 1
179 /* Define any extra SPECS that the compiler needs to generate. */
180 #undef SUBTARGET_EXTRA_SPECS
181 #define SUBTARGET_EXTRA_SPECS \
182 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
183 { "link_libg", LINK_LIBG_SPEC }
185 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
187 /* No version of AIX fully supports AltiVec or 64-bit instructions in
188 32-bit mode. */
189 #define OS_MISSING_POWERPC64 1
190 #define OS_MISSING_ALTIVEC 1
192 /* WINT_TYPE */
193 #define WINT_TYPE "int"
195 /* Static stack checking is supported by means of probes. */
196 #define STACK_CHECK_STATIC_BUILTIN 1