* varasm.c (bss_initializer_p): Remove static.
[official-gcc.git] / gcc / config / rs6000 / aix.h
blob41421a0beca9b4d53e413927d9af888b34ba5f81
1 /* 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, 2008, 2010,
4 2011, 2012 Free Software Foundation, Inc.
6 This file is part of GCC.
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.
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.
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/>. */
22 /* Yes! We are AIX! */
23 #define DEFAULT_ABI ABI_AIX
24 #undef TARGET_AIX
25 #define TARGET_AIX 1
27 /* Linux64.h wants to redefine TARGET_AIX based on -m64, but it can't be used
28 in the #if conditional in options-default.h, so provide another macro. */
29 #undef TARGET_AIX_OS
30 #define TARGET_AIX_OS 1
32 /* AIX always has a TOC. */
33 #define TARGET_NO_TOC 0
34 #define TARGET_TOC 1
35 #define FIXED_R2 1
37 /* AIX allows r13 to be used in 32-bit mode. */
38 #define FIXED_R13 0
40 /* 32-bit and 64-bit AIX stack boundary is 128. */
41 #undef STACK_BOUNDARY
42 #define STACK_BOUNDARY 128
44 #undef TARGET_IEEEQUAD
45 #define TARGET_IEEEQUAD 0
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
51 #if HAVE_AS_REF
52 /* Issue assembly directives that create a reference to the given DWARF table
53 identifier label from the current function section. This is defined to
54 ensure we drag frame frame tables associated with needed function bodies in
55 a link with garbage collection activated. */
56 #define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
57 #endif
59 /* This is the only version of nm that collect2 can work with. */
60 #define REAL_NM_FILE_NAME "/usr/ucb/nm"
62 #define USER_LABEL_PREFIX ""
64 /* Don't turn -B into -L if the argument specifies a relative file name. */
65 #define RELATIVE_PREFIX_NOT_LINKDIR
67 /* Because of the above, we must have gcc search itself to find libgcc.a. */
68 #define LINK_LIBGCC_SPECIAL_1
70 #define MFWRAP_SPEC " %{static: %{fmudflap|fmudflapth: \
71 -brename:malloc,__wrap_malloc -brename:__real_malloc,malloc \
72 -brename:free,__wrap_free -brename:__real_free,free \
73 -brename:calloc,__wrap_calloc -brename:__real_calloc,calloc \
74 -brename:realloc,__wrap_realloc -brename:__real_realloc,realloc \
75 -brename:mmap,__wrap_mmap -brename:__real_mmap,mmap \
76 -brename:munmap,__wrap_munmap -brename:__real_munmap,munmap \
77 -brename:alloca,__wrap_alloca -brename:__real_alloca,alloca \
78 } %{fmudflapth: \
79 -brename:pthread_create,__wrap_pthread_create \
80 -brename:__real_pthread_create,pthread_create \
81 -brename:pthread_join,__wrap_pthread_join \
82 -brename:__real_pthread_join,pthread_join \
83 -brename:pthread_exit,__wrap_pthread_exit \
84 -brename:__real_pthread_exit,pthread_exit \
85 }} %{fmudflap|fmudflapth: \
86 -brename:main,__wrap_main -brename:__real_main,main \
89 #define MFLIB_SPEC " %{fmudflap: -lmudflap \
90 %{static:%(link_gcc_c_sequence) -lmudflap}} \
91 %{fmudflapth: -lmudflapth -lpthread \
92 %{static:%(link_gcc_c_sequence) -lmudflapth}} "
94 /* Names to predefine in the preprocessor for this target machine. */
95 #define TARGET_OS_AIX_CPP_BUILTINS() \
96 do \
97 { \
98 builtin_define ("_IBMR2"); \
99 builtin_define ("_POWER"); \
100 builtin_define ("__powerpc__"); \
101 builtin_define ("__PPC__"); \
102 builtin_define ("__unix__"); \
103 builtin_define ("_AIX"); \
104 builtin_define ("_AIX32"); \
105 builtin_define ("_AIX41"); \
106 builtin_define ("_LONG_LONG"); \
107 if (TARGET_LONG_DOUBLE_128) \
108 builtin_define ("__LONGDOUBLE128"); \
109 builtin_assert ("system=unix"); \
110 builtin_assert ("system=aix"); \
112 while (0)
114 /* Define appropriate architecture macros for preprocessor depending on
115 target switches. */
117 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
118 %{ansi: -D_ANSI_C_SOURCE}"
120 #define CC1_SPEC "%(cc1_cpu)"
122 #undef ASM_DEFAULT_SPEC
123 #define ASM_DEFAULT_SPEC ""
125 /* Tell the assembler to assume that all undefined names are external.
127 Don't do this until the fixed IBM assembler is more generally available.
128 When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
129 ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
130 longer be needed. Also, the extern declaration of mcount in
131 rs6000_xcoff_file_start will no longer be needed. */
133 /* #define ASM_SPEC "-u %(asm_cpu)" */
135 /* Default location of syscalls.exp under AIX */
136 #define LINK_SYSCALLS_SPEC "-bI:%R/lib/syscalls.exp"
138 /* Default location of libg.exp under AIX */
139 #define LINK_LIBG_SPEC "-bexport:%R/usr/lib/libg.exp"
141 /* Define the options for the binder: Start text at 512, align all segments
142 to 512 bytes, and warn if there is text relocation.
144 The -bhalt:4 option supposedly changes the level at which ld will abort,
145 but it also suppresses warnings about multiply defined symbols and is
146 used by the AIX cc command. So we use it here.
148 -bnodelcsect undoes a poor choice of default relating to multiply-defined
149 csects. See AIX documentation for more information about this.
151 -bM:SRE tells the linker that the output file is Shared REusable. Note
152 that to actually build a shared library you will also need to specify an
153 export list with the -Wl,-bE option. */
155 #define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
156 %{static:-bnso %(link_syscalls) } \
157 %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
159 /* Profiled library versions are used by linking with special directories. */
160 #define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
161 %{p:-L%R/lib/profiled -L%R/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
163 /* Static linking with shared libstdc++ requires libsupc++ as well. */
164 #define LIBSTDCXX_STATIC "supc++"
166 /* This now supports a natural alignment mode. */
167 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
168 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
169 ((TARGET_ALIGN_NATURAL == 0 \
170 && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \
171 ? MIN ((COMPUTED), 32) \
172 : (COMPUTED))
174 /* AIX increases natural record alignment to doubleword if the first
175 field is an FP double while the FP fields remain word aligned. */
176 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
177 ((TREE_CODE (STRUCT) == RECORD_TYPE \
178 || TREE_CODE (STRUCT) == UNION_TYPE \
179 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
180 && TARGET_ALIGN_NATURAL == 0 \
181 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
182 : MAX ((COMPUTED), (SPECIFIED)))
184 /* The AIX ABI isn't explicit on whether aggregates smaller than a
185 word/doubleword should be padded upward or downward. One could
186 reasonably assume that they follow the normal rules for structure
187 layout treating the parameter area as any other block of memory,
188 then map the reg param area to registers, i.e., pad upward, which
189 is the way IBM Compilers for AIX behave.
190 Setting both of the following defines results in this behavior. */
191 #define AGGREGATE_PADDING_FIXED 1
192 #define AGGREGATES_PAD_UPWARD_ALWAYS 1
194 /* Specify padding for the last element of a block move between
195 registers and memory. FIRST is nonzero if this is the only
196 element. */
197 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
198 (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
200 /* Indicate that jump tables go in the text section. */
202 #define JUMP_TABLES_IN_TEXT_SECTION 1
204 /* Define any extra SPECS that the compiler needs to generate. */
205 #undef SUBTARGET_EXTRA_SPECS
206 #define SUBTARGET_EXTRA_SPECS \
207 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
208 { "link_libg", LINK_LIBG_SPEC }
210 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
212 /* No version of AIX fully supports AltiVec or 64-bit instructions in
213 32-bit mode. */
214 #define OS_MISSING_POWERPC64 1
215 #define OS_MISSING_ALTIVEC 1
217 /* WINT_TYPE */
218 #define WINT_TYPE "int"
220 /* Static stack checking is supported by means of probes. */
221 #define STACK_CHECK_STATIC_BUILTIN 1