]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/aix.h
aix.h (CPP_CPU_SPEC): Move back to rs6000.h
[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 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 /* This is the only version of nm that collect2 can work with. */
31 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
32
33 /* AIX does not have any init/fini or ctor/dtor sections, so create
34 static constructors and destructors as normal functions. */
35 /* #define ASM_OUTPUT_CONSTRUCTOR(file, name) */
36 /* #define ASM_OUTPUT_DESTRUCTOR(file, name) */
37 #define USER_LABEL_PREFIX ""
38 /* Don't turn -B into -L if the argument specifies a relative file name. */
39 #define RELATIVE_PREFIX_NOT_LINKDIR
40
41 /* Because of the above, we must have gcc search itself to find libgcc.a. */
42 #define LINK_LIBGCC_SPECIAL_1
43
44 /* Names to predefine in the preprocessor for this target machine. */
45 #define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_LONG_LONG \
46 -Asystem=unix -Asystem=aix -Acpu=rs6000 -Amachine=rs6000"
47
48 /* Define appropriate architecture macros for preprocessor depending on
49 target switches. */
50
51 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
52 %{ansi: -D_ANSI_C_SOURCE}\
53 %(cpp_cpu)"
54
55 #undef CPP_DEFAULT_SPEC
56 #define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
57
58 #undef ASM_DEFAULT_SPEC
59 #define ASM_DEFAULT_SPEC ""
60
61 /* Tell the assembler to assume that all undefined names are external.
62
63 Don't do this until the fixed IBM assembler is more generally available.
64 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
65 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
66 longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
67 will no longer be needed. */
68
69 /* #define ASM_SPEC "-u %(asm_cpu)" */
70
71 /* Default location of syscalls.exp under AIX */
72 #ifndef CROSS_COMPILE
73 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
74 #else
75 #define LINK_SYSCALLS_SPEC ""
76 #endif
77
78 /* Default location of libg.exp under AIX */
79 #ifndef CROSS_COMPILE
80 #define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
81 #else
82 #define LINK_LIBG_SPEC ""
83 #endif
84
85 /* Define the options for the binder: Start text at 512, align all segments
86 to 512 bytes, and warn if there is text relocation.
87
88 The -bhalt:4 option supposedly changes the level at which ld will abort,
89 but it also suppresses warnings about multiply defined symbols and is
90 used by the AIX cc command. So we use it here.
91
92 -bnodelcsect undoes a poor choice of default relating to multiply-defined
93 csects. See AIX documentation for more information about this.
94
95 -bM:SRE tells the linker that the output file is Shared REusable. Note
96 that to actually build a shared library you will also need to specify an
97 export list with the -Wl,-bE option. */
98
99 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
100 %{static:-bnso %(link_syscalls) } \
101 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
102
103 /* Profiled library versions are used by linking with special directories. */
104 #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
105 %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
106
107 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
108 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
109 (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \
110 ? get_inner_array_type (FIELD) \
111 : TREE_TYPE (FIELD)) == DFmode \
112 ? MIN ((COMPUTED), 32) : (COMPUTED))
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)), BIGGEST_ALIGNMENT) \
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, using the standard
154 AIX names. */
155 #define INIT_TARGET_OPTABS \
156 do { \
157 if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT) \
158 { \
159 fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC); \
160 fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC); \
161 } \
162 } while (0)
163
164 /* AIX always has a TOC. */
165 #define TARGET_NO_TOC 0
166 #define TARGET_TOC 1
167
168 /* AIX allows r13 to be used. */
169 #define FIXED_R13 0
170
171 /* __throw will restore its own return address to be the same as the
172 return address of the function that the throw is being made to.
173 This is unfortunate, because we want to check the original
174 return address to see if we need to restore the TOC.
175 So we have to squirrel it away with this. */
176 #define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init ()
177
178 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)