]>
git.ipfire.org Git - thirdparty/gcc.git/blob - 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.
5 This file is part of GNU CC.
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)
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.
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. */
22 /* Yes! We are AIX! */
23 #define DEFAULT_ABI ABI_AIX
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
30 /* Handle #pragma weak and #pragma pack. */
31 #define HANDLE_SYSV_PRAGMA
33 /* This is the only version of nm that collect2 can work with. */
34 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
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
40 /* Because of the above, we must have gcc search itself to find libgcc.a. */
41 #define LINK_LIBGCC_SPECIAL_1
43 /* Names to predefine in the preprocessor for this target machine. */
44 #define TARGET_OS_CPP_BUILTINS() \
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"); \
59 /* Define appropriate architecture macros for preprocessor depending on
62 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
63 %{ansi: -D_ANSI_C_SOURCE}"
65 #undef ASM_DEFAULT_SPEC
66 #define ASM_DEFAULT_SPEC ""
68 /* Tell the assembler to assume that all undefined names are external.
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. */
76 /* #define ASM_SPEC "-u %(asm_cpu)" */
78 /* Default location of syscalls.exp under AIX */
80 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
82 #define LINK_SYSCALLS_SPEC ""
85 /* Default location of libg.exp under AIX */
87 #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
89 #define LINK_LIBG_SPEC ""
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.
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.
99 -bnodelcsect undoes a poor choice of default relating to multiply-defined
100 csects. See AIX documentation for more information about this.
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. */
106 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
107 %{static:-bnso %(link_syscalls) } \
108 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
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"
114 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
115 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
116 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
117 ? get_inner_array_type (FIELD) \
118 : TREE_TYPE (FIELD)) == DFmode \
119 ? MIN ((COMPUTED), 32) : (COMPUTED))
121 /* AIX increases natural record alignment to doubleword if the first
122 field is an FP double while the FP fields remain word aligned. */
123 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
124 ((TREE_CODE (STRUCT) == RECORD_TYPE \
125 || TREE_CODE (STRUCT) == UNION_TYPE \
126 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
127 && TYPE_FIELDS (STRUCT) != 0 \
128 && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
129 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \
130 : MAX ((COMPUTED), (SPECIFIED)))
134 /* Indicate that jump tables go in the text section. */
136 #define JUMP_TABLES_IN_TEXT_SECTION 1
138 /* Enable AIX XL compiler calling convention breakage compatibility. */
139 #undef TARGET_XL_CALL
140 #define MASK_XL_CALL 0x40000000
141 #define TARGET_XL_CALL (target_flags & MASK_XL_CALL)
142 #undef SUBTARGET_SWITCHES
143 #define SUBTARGET_SWITCHES \
144 {"xl-call", MASK_XL_CALL, \
145 N_("Always pass floating-point arguments in memory") }, \
146 {"no-xl-call", - MASK_XL_CALL, \
147 N_("Don't always pass floating-point arguments in memory") }, \
148 SUBSUBTARGET_SWITCHES
149 #define SUBSUBTARGET_SWITCHES
151 /* Define any extra SPECS that the compiler needs to generate. */
152 #undef SUBTARGET_EXTRA_SPECS
153 #define SUBTARGET_EXTRA_SPECS \
154 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
155 { "link_libg", LINK_LIBG_SPEC }
157 /* Define cutoff for using external functions to save floating point. */
158 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
160 /* Optabs entries for the int->float routines and quad FP operations
161 using the standard AIX names. */
162 #define ADDTF3_LIBCALL "_xlqadd"
163 #define DIVTF3_LIBCALL "_xlqdiv"
164 #define MULTF3_LIBCALL "_xlqmul"
165 #define SUBTF3_LIBCALL "_xlqsub"
167 #define INIT_TARGET_OPTABS \
169 if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT) \
171 fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC); \
172 fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC); \
174 if (TARGET_HARD_FLOAT) \
176 add_optab->handlers[(int) TFmode].libfunc \
177 = init_one_libfunc (ADDTF3_LIBCALL); \
178 sub_optab->handlers[(int) TFmode].libfunc \
179 = init_one_libfunc (SUBTF3_LIBCALL); \
180 smul_optab->handlers[(int) TFmode].libfunc \
181 = init_one_libfunc (MULTF3_LIBCALL); \
182 sdiv_optab->handlers[(int) TFmode].libfunc \
183 = init_one_libfunc (DIVTF3_LIBCALL); \
187 /* AIX always has a TOC. */
188 #define TARGET_NO_TOC 0
192 /* AIX allows r13 to be used. */
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 ()
202 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
204 /* Print subsidiary information on the compiler version in use. */
205 #define TARGET_VERSION ;