1 |
38 |
julius |
/* Definitions of target machine for GNU compiler,
|
2 |
|
|
for IBM RS/6000 POWER running AIX.
|
3 |
|
|
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
4 |
|
|
Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
8 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
9 |
|
|
under the terms of the GNU General Public License as published
|
10 |
|
|
by the Free Software Foundation; either version 3, or (at your
|
11 |
|
|
option) any later version.
|
12 |
|
|
|
13 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
14 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
15 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
16 |
|
|
License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with GCC; see the file COPYING3. If not see
|
20 |
|
|
<http://www.gnu.org/licenses/>. */
|
21 |
|
|
|
22 |
|
|
/* Yes! We are AIX! */
|
23 |
|
|
#define DEFAULT_ABI ABI_AIX
|
24 |
|
|
#undef TARGET_AIX
|
25 |
|
|
#define TARGET_AIX 1
|
26 |
|
|
|
27 |
|
|
/* AIX always has a TOC. */
|
28 |
|
|
#define TARGET_NO_TOC 0
|
29 |
|
|
#define TARGET_TOC 1
|
30 |
|
|
#define FIXED_R2 1
|
31 |
|
|
|
32 |
|
|
/* AIX allows r13 to be used in 32-bit mode. */
|
33 |
|
|
#define FIXED_R13 0
|
34 |
|
|
|
35 |
|
|
/* 32-bit and 64-bit AIX stack boundary is 128. */
|
36 |
|
|
#undef STACK_BOUNDARY
|
37 |
|
|
#define STACK_BOUNDARY 128
|
38 |
|
|
|
39 |
|
|
/* AIX does not support Altivec. */
|
40 |
|
|
#undef TARGET_ALTIVEC
|
41 |
|
|
#define TARGET_ALTIVEC 0
|
42 |
|
|
#undef TARGET_ALTIVEC_ABI
|
43 |
|
|
#define TARGET_ALTIVEC_ABI 0
|
44 |
|
|
#undef TARGET_IEEEQUAD
|
45 |
|
|
#define TARGET_IEEEQUAD 0
|
46 |
|
|
|
47 |
|
|
/* The AIX linker will discard static constructors in object files before
|
48 |
|
|
collect has a chance to see them, so scan the object files directly. */
|
49 |
|
|
#define COLLECT_EXPORT_LIST
|
50 |
|
|
|
51 |
|
|
/* Handle #pragma weak and #pragma pack. */
|
52 |
|
|
#define HANDLE_SYSV_PRAGMA 1
|
53 |
|
|
|
54 |
|
|
/* This is the only version of nm that collect2 can work with. */
|
55 |
|
|
#define REAL_NM_FILE_NAME "/usr/ucb/nm"
|
56 |
|
|
|
57 |
|
|
#define USER_LABEL_PREFIX ""
|
58 |
|
|
|
59 |
|
|
/* Don't turn -B into -L if the argument specifies a relative file name. */
|
60 |
|
|
#define RELATIVE_PREFIX_NOT_LINKDIR
|
61 |
|
|
|
62 |
|
|
/* Because of the above, we must have gcc search itself to find libgcc.a. */
|
63 |
|
|
#define LINK_LIBGCC_SPECIAL_1
|
64 |
|
|
|
65 |
|
|
#define MFWRAP_SPEC " %{static: %{fmudflap|fmudflapth: \
|
66 |
|
|
-brename:malloc,__wrap_malloc -brename:__real_malloc,malloc \
|
67 |
|
|
-brename:free,__wrap_free -brename:__real_free,free \
|
68 |
|
|
-brename:calloc,__wrap_calloc -brename:__real_calloc,calloc \
|
69 |
|
|
-brename:realloc,__wrap_realloc -brename:__real_realloc,realloc \
|
70 |
|
|
-brename:mmap,__wrap_mmap -brename:__real_mmap,mmap \
|
71 |
|
|
-brename:munmap,__wrap_munmap -brename:__real_munmap,munmap \
|
72 |
|
|
-brename:alloca,__wrap_alloca -brename:__real_alloca,alloca \
|
73 |
|
|
} %{fmudflapth: \
|
74 |
|
|
-brename:pthread_create,__wrap_pthread_create \
|
75 |
|
|
-brename:__real_pthread_create,pthread_create \
|
76 |
|
|
-brename:pthread_join,__wrap_pthread_join \
|
77 |
|
|
-brename:__real_pthread_join,pthread_join \
|
78 |
|
|
-brename:pthread_exit,__wrap_pthread_exit \
|
79 |
|
|
-brename:__real_pthread_exit,pthread_exit \
|
80 |
|
|
}} %{fmudflap|fmudflapth: \
|
81 |
|
|
-brename:main,__wrap_main -brename:__real_main,main \
|
82 |
|
|
}"
|
83 |
|
|
|
84 |
|
|
#define MFLIB_SPEC " %{fmudflap: -lmudflap \
|
85 |
|
|
%{static:%(link_gcc_c_sequence) -lmudflap}} \
|
86 |
|
|
%{fmudflapth: -lmudflapth -lpthread \
|
87 |
|
|
%{static:%(link_gcc_c_sequence) -lmudflapth}} "
|
88 |
|
|
|
89 |
|
|
/* Names to predefine in the preprocessor for this target machine. */
|
90 |
|
|
#define TARGET_OS_AIX_CPP_BUILTINS() \
|
91 |
|
|
do \
|
92 |
|
|
{ \
|
93 |
|
|
builtin_define ("_IBMR2"); \
|
94 |
|
|
builtin_define ("_POWER"); \
|
95 |
|
|
builtin_define ("_AIX"); \
|
96 |
|
|
builtin_define ("_AIX32"); \
|
97 |
|
|
builtin_define ("_AIX41"); \
|
98 |
|
|
builtin_define ("_LONG_LONG"); \
|
99 |
|
|
if (TARGET_LONG_DOUBLE_128) \
|
100 |
|
|
builtin_define ("__LONGDOUBLE128"); \
|
101 |
|
|
builtin_assert ("system=unix"); \
|
102 |
|
|
builtin_assert ("system=aix"); \
|
103 |
|
|
} \
|
104 |
|
|
while (0)
|
105 |
|
|
|
106 |
|
|
/* Define appropriate architecture macros for preprocessor depending on
|
107 |
|
|
target switches. */
|
108 |
|
|
|
109 |
|
|
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
|
110 |
|
|
%{ansi: -D_ANSI_C_SOURCE}"
|
111 |
|
|
|
112 |
|
|
#undef ASM_DEFAULT_SPEC
|
113 |
|
|
#define ASM_DEFAULT_SPEC ""
|
114 |
|
|
|
115 |
|
|
/* Tell the assembler to assume that all undefined names are external.
|
116 |
|
|
|
117 |
|
|
Don't do this until the fixed IBM assembler is more generally available.
|
118 |
|
|
When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
|
119 |
|
|
ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
|
120 |
|
|
longer be needed. Also, the extern declaration of mcount in
|
121 |
|
|
rs6000_xcoff_file_start will no longer be needed. */
|
122 |
|
|
|
123 |
|
|
/* #define ASM_SPEC "-u %(asm_cpu)" */
|
124 |
|
|
|
125 |
|
|
/* Default location of syscalls.exp under AIX */
|
126 |
|
|
#ifndef CROSS_COMPILE
|
127 |
|
|
#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
|
128 |
|
|
#else
|
129 |
|
|
#define LINK_SYSCALLS_SPEC ""
|
130 |
|
|
#endif
|
131 |
|
|
|
132 |
|
|
/* Default location of libg.exp under AIX */
|
133 |
|
|
#ifndef CROSS_COMPILE
|
134 |
|
|
#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
|
135 |
|
|
#else
|
136 |
|
|
#define LINK_LIBG_SPEC ""
|
137 |
|
|
#endif
|
138 |
|
|
|
139 |
|
|
/* Define the options for the binder: Start text at 512, align all segments
|
140 |
|
|
to 512 bytes, and warn if there is text relocation.
|
141 |
|
|
|
142 |
|
|
The -bhalt:4 option supposedly changes the level at which ld will abort,
|
143 |
|
|
but it also suppresses warnings about multiply defined symbols and is
|
144 |
|
|
used by the AIX cc command. So we use it here.
|
145 |
|
|
|
146 |
|
|
-bnodelcsect undoes a poor choice of default relating to multiply-defined
|
147 |
|
|
csects. See AIX documentation for more information about this.
|
148 |
|
|
|
149 |
|
|
-bM:SRE tells the linker that the output file is Shared REusable. Note
|
150 |
|
|
that to actually build a shared library you will also need to specify an
|
151 |
|
|
export list with the -Wl,-bE option. */
|
152 |
|
|
|
153 |
|
|
#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
|
154 |
|
|
%{static:-bnso %(link_syscalls) } \
|
155 |
|
|
%{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
|
156 |
|
|
|
157 |
|
|
/* Profiled library versions are used by linking with special directories. */
|
158 |
|
|
#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
|
159 |
|
|
%{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
|
160 |
|
|
|
161 |
|
|
/* This now supports a natural alignment mode. */
|
162 |
|
|
/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
|
163 |
|
|
#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
|
164 |
|
|
(TARGET_ALIGN_NATURAL ? (COMPUTED) : \
|
165 |
|
|
(TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
|
166 |
|
|
? get_inner_array_type (FIELD) \
|
167 |
|
|
: TREE_TYPE (FIELD)) == DFmode \
|
168 |
|
|
? MIN ((COMPUTED), 32) : (COMPUTED)))
|
169 |
|
|
|
170 |
|
|
/* AIX increases natural record alignment to doubleword if the first
|
171 |
|
|
field is an FP double while the FP fields remain word aligned. */
|
172 |
|
|
#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
|
173 |
|
|
((TREE_CODE (STRUCT) == RECORD_TYPE \
|
174 |
|
|
|| TREE_CODE (STRUCT) == UNION_TYPE \
|
175 |
|
|
|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
|
176 |
|
|
&& TARGET_ALIGN_NATURAL == 0 \
|
177 |
|
|
? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
|
178 |
|
|
: MAX ((COMPUTED), (SPECIFIED)))
|
179 |
|
|
|
180 |
|
|
/* The AIX ABI isn't explicit on whether aggregates smaller than a
|
181 |
|
|
word/doubleword should be padded upward or downward. One could
|
182 |
|
|
reasonably assume that they follow the normal rules for structure
|
183 |
|
|
layout treating the parameter area as any other block of memory,
|
184 |
|
|
then map the reg param area to registers, i.e., pad upward, which
|
185 |
|
|
is the way IBM Compilers for AIX behave.
|
186 |
|
|
Setting both of the following defines results in this behavior. */
|
187 |
|
|
#define AGGREGATE_PADDING_FIXED 1
|
188 |
|
|
#define AGGREGATES_PAD_UPWARD_ALWAYS 1
|
189 |
|
|
|
190 |
|
|
/* Specify padding for the last element of a block move between
|
191 |
|
|
registers and memory. FIRST is nonzero if this is the only
|
192 |
|
|
element. */
|
193 |
|
|
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
|
194 |
|
|
(!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
|
195 |
|
|
|
196 |
|
|
/* Indicate that jump tables go in the text section. */
|
197 |
|
|
|
198 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION 1
|
199 |
|
|
|
200 |
|
|
/* Define any extra SPECS that the compiler needs to generate. */
|
201 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
202 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
203 |
|
|
{ "link_syscalls", LINK_SYSCALLS_SPEC }, \
|
204 |
|
|
{ "link_libg", LINK_LIBG_SPEC }
|
205 |
|
|
|
206 |
|
|
/* Define cutoff for using external functions to save floating point. */
|
207 |
|
|
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
|
208 |
|
|
|
209 |
|
|
/* __throw will restore its own return address to be the same as the
|
210 |
|
|
return address of the function that the throw is being made to.
|
211 |
|
|
This is unfortunate, because we want to check the original
|
212 |
|
|
return address to see if we need to restore the TOC.
|
213 |
|
|
So we have to squirrel it away with this. */
|
214 |
|
|
#define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
|
215 |
|
|
|
216 |
|
|
/* If the current unwind info (FS) does not contain explicit info
|
217 |
|
|
saving R2, then we have to do a minor amount of code reading to
|
218 |
|
|
figure out if it was saved. The big problem here is that the
|
219 |
|
|
code that does the save/restore is generated by the linker, so
|
220 |
|
|
we have no good way to determine at compile time what to do. */
|
221 |
|
|
|
222 |
|
|
#ifdef __64BIT__
|
223 |
|
|
#define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
|
224 |
|
|
do { \
|
225 |
|
|
if ((FS)->regs.reg[2].how == REG_UNSAVED) \
|
226 |
|
|
{ \
|
227 |
|
|
unsigned int *insn \
|
228 |
|
|
= (unsigned int *) \
|
229 |
|
|
_Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \
|
230 |
|
|
if (*insn == 0xE8410028) \
|
231 |
|
|
_Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40); \
|
232 |
|
|
} \
|
233 |
|
|
} while (0)
|
234 |
|
|
#else
|
235 |
|
|
#define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
|
236 |
|
|
do { \
|
237 |
|
|
if ((FS)->regs.reg[2].how == REG_UNSAVED) \
|
238 |
|
|
{ \
|
239 |
|
|
unsigned int *insn \
|
240 |
|
|
= (unsigned int *) \
|
241 |
|
|
_Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \
|
242 |
|
|
if (*insn == 0x80410014) \
|
243 |
|
|
_Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 20); \
|
244 |
|
|
} \
|
245 |
|
|
} while (0)
|
246 |
|
|
#endif
|
247 |
|
|
|
248 |
|
|
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
|
249 |
|
|
|
250 |
|
|
/* Print subsidiary information on the compiler version in use. */
|
251 |
|
|
#define TARGET_VERSION ;
|
252 |
|
|
|
253 |
|
|
/* No version of AIX fully supports AltiVec or 64-bit instructions in
|
254 |
|
|
32-bit mode. */
|
255 |
|
|
#define OS_MISSING_POWERPC64 1
|
256 |
|
|
#define OS_MISSING_ALTIVEC 1
|
257 |
|
|
|
258 |
|
|
/* WINT_TYPE */
|
259 |
|
|
#define WINT_TYPE "int"
|