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