]>
Commit | Line | Data |
---|---|---|
9ebbca7d GK |
1 | /* Definitions of target machine for GNU compiler, |
2 | for IBM RS/6000 POWER running AIX. | |
79c4e63f | 3 | Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. |
9ebbca7d GK |
4 | |
5 | This file is part of GNU CC. | |
6 | ||
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) | |
10 | any later version. | |
11 | ||
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. | |
16 | ||
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. */ | |
21 | ||
22 | /* Yes! We are AIX! */ | |
23 | #define DEFAULT_ABI ABI_AIX | |
774b5662 | 24 | #undef TARGET_AIX |
2bfcf297 | 25 | #define TARGET_AIX 1 |
774b5662 DE |
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 | /* AIX does not support Altivec. */ | |
36 | #undef TARGET_ALTIVEC | |
37 | #define TARGET_ALTIVEC 0 | |
38 | #undef TARGET_ALTIVEC_ABI | |
39 | #define TARGET_ALTIVEC_ABI 0 | |
40 | #undef TARGET_ALTIVEC_VRSAVE | |
41 | #define TARGET_ALTIVEC_VRSAVE 0 | |
42 | ||
84c041a1 ZW |
43 | /* The AIX linker will discard static constructors in object files before |
44 | collect has a chance to see them, so scan the object files directly. */ | |
45 | #define COLLECT_EXPORT_LIST | |
9ebbca7d | 46 | |
79c4e63f AM |
47 | /* Handle #pragma weak and #pragma pack. */ |
48 | #define HANDLE_SYSV_PRAGMA | |
49 | ||
9ebbca7d GK |
50 | /* This is the only version of nm that collect2 can work with. */ |
51 | #define REAL_NM_FILE_NAME "/usr/ucb/nm" | |
52 | ||
2bfcf297 | 53 | #define USER_LABEL_PREFIX "" |
9ebbca7d GK |
54 | /* Don't turn -B into -L if the argument specifies a relative file name. */ |
55 | #define RELATIVE_PREFIX_NOT_LINKDIR | |
56 | ||
fc51424c RH |
57 | /* Because of the above, we must have gcc search itself to find libgcc.a. */ |
58 | #define LINK_LIBGCC_SPECIAL_1 | |
9ebbca7d | 59 | |
fc51424c | 60 | /* Names to predefine in the preprocessor for this target machine. */ |
7990b46f MK |
61 | #define TARGET_OS_CPP_BUILTINS() \ |
62 | do \ | |
63 | { \ | |
64 | builtin_define ("_IBMR2"); \ | |
65 | builtin_define ("_POWER"); \ | |
66 | builtin_define ("_AIX"); \ | |
67 | builtin_define ("_AIX32"); \ | |
68 | builtin_define ("_LONG_LONG"); \ | |
69 | builtin_assert ("system=unix"); \ | |
70 | builtin_assert ("system=aix"); \ | |
71 | builtin_assert ("cpu=rs6000"); \ | |
72 | builtin_assert ("machine=rs6000"); \ | |
73 | } \ | |
74 | while (0) | |
9ebbca7d | 75 | |
d6121128 AO |
76 | /* Define appropriate architecture macros for preprocessor depending on |
77 | target switches. */ | |
78 | ||
79 | #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\ | |
4c4eb375 | 80 | %{ansi: -D_ANSI_C_SOURCE}" |
2bfcf297 | 81 | |
f984d8df | 82 | #undef ASM_DEFAULT_SPEC |
2bfcf297 DB |
83 | #define ASM_DEFAULT_SPEC "" |
84 | ||
9ebbca7d GK |
85 | /* Tell the assembler to assume that all undefined names are external. |
86 | ||
87 | Don't do this until the fixed IBM assembler is more generally available. | |
88 | When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL, | |
89 | ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no | |
90 | longer be needed. Also, the extern declaration of mcount in ASM_FILE_START | |
91 | will no longer be needed. */ | |
92 | ||
93 | /* #define ASM_SPEC "-u %(asm_cpu)" */ | |
94 | ||
95 | /* Default location of syscalls.exp under AIX */ | |
96 | #ifndef CROSS_COMPILE | |
97 | #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp" | |
98 | #else | |
99 | #define LINK_SYSCALLS_SPEC "" | |
100 | #endif | |
101 | ||
102 | /* Default location of libg.exp under AIX */ | |
103 | #ifndef CROSS_COMPILE | |
104 | #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp" | |
105 | #else | |
106 | #define LINK_LIBG_SPEC "" | |
107 | #endif | |
108 | ||
109 | /* Define the options for the binder: Start text at 512, align all segments | |
110 | to 512 bytes, and warn if there is text relocation. | |
111 | ||
a9098fd0 | 112 | The -bhalt:4 option supposedly changes the level at which ld will abort, |
9ebbca7d GK |
113 | but it also suppresses warnings about multiply defined symbols and is |
114 | used by the AIX cc command. So we use it here. | |
115 | ||
116 | -bnodelcsect undoes a poor choice of default relating to multiply-defined | |
117 | csects. See AIX documentation for more information about this. | |
118 | ||
a9098fd0 | 119 | -bM:SRE tells the linker that the output file is Shared REusable. Note |
9ebbca7d GK |
120 | that to actually build a shared library you will also need to specify an |
121 | export list with the -Wl,-bE option. */ | |
122 | ||
123 | #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\ | |
124 | %{static:-bnso %(link_syscalls) } \ | |
125 | %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}" | |
126 | ||
127 | /* Profiled library versions are used by linking with special directories. */ | |
128 | #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ | |
129 | %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc" | |
130 | ||
2bfcf297 DB |
131 | /* AIX increases natural record alignment to doubleword if the first |
132 | field is an FP double while the FP fields remain word aligned. */ | |
133 | #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ | |
134 | ((TREE_CODE (STRUCT) == RECORD_TYPE \ | |
135 | || TREE_CODE (STRUCT) == UNION_TYPE \ | |
136 | || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ | |
137 | && TYPE_FIELDS (STRUCT) != 0 \ | |
138 | && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \ | |
0ac081f6 | 139 | ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ |
2bfcf297 DB |
140 | : MAX ((COMPUTED), (SPECIFIED))) |
141 | ||
9ebbca7d GK |
142 | /* Indicate that jump tables go in the text section. */ |
143 | ||
144 | #define JUMP_TABLES_IN_TEXT_SECTION 1 | |
145 | ||
146 | /* Enable AIX XL compiler calling convention breakage compatibility. */ | |
147 | #undef TARGET_XL_CALL | |
148 | #define MASK_XL_CALL 0x40000000 | |
149 | #define TARGET_XL_CALL (target_flags & MASK_XL_CALL) | |
150 | #undef SUBTARGET_SWITCHES | |
151 | #define SUBTARGET_SWITCHES \ | |
152 | {"xl-call", MASK_XL_CALL, \ | |
047142d3 | 153 | N_("Always pass floating-point arguments in memory") }, \ |
9ebbca7d | 154 | {"no-xl-call", - MASK_XL_CALL, \ |
047142d3 | 155 | N_("Don't always pass floating-point arguments in memory") }, \ |
9ebbca7d GK |
156 | SUBSUBTARGET_SWITCHES |
157 | #define SUBSUBTARGET_SWITCHES | |
158 | ||
159 | /* Define any extra SPECS that the compiler needs to generate. */ | |
160 | #undef SUBTARGET_EXTRA_SPECS | |
161 | #define SUBTARGET_EXTRA_SPECS \ | |
162 | { "link_syscalls", LINK_SYSCALLS_SPEC }, \ | |
163 | { "link_libg", LINK_LIBG_SPEC } | |
164 | ||
9ebbca7d GK |
165 | /* Define cutoff for using external functions to save floating point. */ |
166 | #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63) | |
167 | ||
40501e5f AM |
168 | /* Optabs entries for the int->float routines and quad FP operations |
169 | using the standard AIX names. */ | |
170 | #define ADDTF3_LIBCALL "_xlqadd" | |
171 | #define DIVTF3_LIBCALL "_xlqdiv" | |
172 | #define MULTF3_LIBCALL "_xlqmul" | |
173 | #define SUBTF3_LIBCALL "_xlqsub" | |
174 | ||
9cb8fcaf GK |
175 | #define INIT_TARGET_OPTABS \ |
176 | do { \ | |
177 | if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT) \ | |
178 | { \ | |
179 | fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC); \ | |
180 | fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC); \ | |
181 | } \ | |
40501e5f AM |
182 | if (TARGET_HARD_FLOAT) \ |
183 | { \ | |
184 | add_optab->handlers[(int) TFmode].libfunc \ | |
185 | = init_one_libfunc (ADDTF3_LIBCALL); \ | |
186 | sub_optab->handlers[(int) TFmode].libfunc \ | |
187 | = init_one_libfunc (SUBTF3_LIBCALL); \ | |
188 | smul_optab->handlers[(int) TFmode].libfunc \ | |
189 | = init_one_libfunc (MULTF3_LIBCALL); \ | |
190 | sdiv_optab->handlers[(int) TFmode].libfunc \ | |
191 | = init_one_libfunc (DIVTF3_LIBCALL); \ | |
192 | } \ | |
9cb8fcaf GK |
193 | } while (0) |
194 | ||
9ebbca7d GK |
195 | /* __throw will restore its own return address to be the same as the |
196 | return address of the function that the throw is being made to. | |
197 | This is unfortunate, because we want to check the original | |
198 | return address to see if we need to restore the TOC. | |
199 | So we have to squirrel it away with this. */ | |
200 | #define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init () | |
201 | ||
411707f4 | 202 | #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) |
b91da81f DB |
203 | |
204 | /* Print subsidiary information on the compiler version in use. */ | |
205 | #define TARGET_VERSION ; |