comparison gcc/config/rs6000/aix.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Definitions of target machine for GNU compiler, 1 /* Definitions of target machine for GNU compiler,
2 for IBM RS/6000 POWER running AIX. 2 for IBM RS/6000 POWER running AIX.
3 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 3 Copyright (C) 2000-2017 Free Software Foundation, Inc.
4 Free Software Foundation, Inc.
5 4
6 This file is part of GCC. 5 This file is part of GCC.
7 6
8 GCC is free software; you can redistribute it and/or modify it 7 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published 8 under the terms of the GNU General Public License as published
39 38
40 /* 32-bit and 64-bit AIX stack boundary is 128. */ 39 /* 32-bit and 64-bit AIX stack boundary is 128. */
41 #undef STACK_BOUNDARY 40 #undef STACK_BOUNDARY
42 #define STACK_BOUNDARY 128 41 #define STACK_BOUNDARY 128
43 42
43 /* Offset within stack frame to start allocating local variables at.
44 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
45 first local allocated. Otherwise, it is the offset to the BEGINNING
46 of the first local allocated.
47
48 On the RS/6000, the frame pointer is the same as the stack pointer,
49 except for dynamic allocations. So we start after the fixed area and
50 outgoing parameter area.
51
52 If the function uses dynamic stack space (CALLS_ALLOCA is set), that
53 space needs to be aligned to STACK_BOUNDARY, i.e. the sum of the
54 sizes of the fixed area and the parameter area must be a multiple of
55 STACK_BOUNDARY. */
56
57 #undef RS6000_STARTING_FRAME_OFFSET
58 #define RS6000_STARTING_FRAME_OFFSET \
59 (cfun->calls_alloca \
60 ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \
61 : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))
62
63 /* Offset from the stack pointer register to an item dynamically
64 allocated on the stack, e.g., by `alloca'.
65
66 The default value for this macro is `STACK_POINTER_OFFSET' plus the
67 length of the outgoing arguments. The default is correct for most
68 machines. See `function.c' for details.
69
70 This value must be a multiple of STACK_BOUNDARY (hard coded in
71 `emit-rtl.c'). */
72 #undef STACK_DYNAMIC_OFFSET
73 #define STACK_DYNAMIC_OFFSET(FUNDECL) \
74 RS6000_ALIGN (crtl->outgoing_args_size + STACK_POINTER_OFFSET, 16)
75
44 #undef TARGET_IEEEQUAD 76 #undef TARGET_IEEEQUAD
45 #define TARGET_IEEEQUAD 0 77 #define TARGET_IEEEQUAD 0
78
79 #undef TARGET_IEEEQUAD_DEFAULT
80 #define TARGET_IEEEQUAD_DEFAULT 0
46 81
47 /* The AIX linker will discard static constructors in object files before 82 /* 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. */ 83 collect has a chance to see them, so scan the object files directly. */
49 #define COLLECT_EXPORT_LIST 84 #define COLLECT_EXPORT_LIST
50 85
86 /* On AIX, initialisers specified with -binitfini are called in breadth-first
87 order.
88 e.g. if a.out depends on lib1.so, the init function for a.out is called before
89 the init function for lib1.so.
90
91 To ensure global C++ constructors in linked libraries are run before global
92 C++ constructors from the current module, there is additional symbol scanning
93 logic in collect2.
94
95 The global initialiser/finaliser functions are named __GLOBAL_AIXI_{libname}
96 and __GLOBAL_AIXD_{libname} and are exported from each shared library.
97
98 collect2 will detect these symbols when they exist in shared libraries that
99 the current program is being linked against. All such initiliser functions
100 will be called prior to the constructors of the current program, and
101 finaliser functions called after destructors.
102
103 Reference counting generated by collect2 will ensure that constructors are
104 only invoked once in the case of multiple dependencies on a library.
105
106 -binitfini is still used in parallel to this solution.
107 This handles the case where a library is loaded through dlopen(), and also
108 handles the option -blazy.
109 */
110 #define COLLECT_SHARED_INIT_FUNC(STREAM, FUNC) \
111 fprintf ((STREAM), "void %s() {\n\t%s();\n}\n", aix_shared_initname, (FUNC))
112 #define COLLECT_SHARED_FINI_FUNC(STREAM, FUNC) \
113 fprintf ((STREAM), "void %s() {\n\t%s();\n}\n", aix_shared_fininame, (FUNC))
114
51 #if HAVE_AS_REF 115 #if HAVE_AS_REF
52 /* Issue assembly directives that create a reference to the given DWARF table 116 /* Issue assembly directives that create a reference to the given DWARF table
53 identifier label from the current function section. This is defined to 117 identifier label from the current function section. This is defined to
54 ensure we drag frame frame tables associated with needed function bodies in 118 ensure we drag frame tables associated with needed function bodies in
55 a link with garbage collection activated. */ 119 a link with garbage collection activated. */
56 #define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref 120 #define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
57 #endif 121 #endif
58 122
59 /* This is the only version of nm that collect2 can work with. */ 123 /* This is the only version of nm that collect2 can work with. */
64 /* Don't turn -B into -L if the argument specifies a relative file name. */ 128 /* Don't turn -B into -L if the argument specifies a relative file name. */
65 #define RELATIVE_PREFIX_NOT_LINKDIR 129 #define RELATIVE_PREFIX_NOT_LINKDIR
66 130
67 /* Because of the above, we must have gcc search itself to find libgcc.a. */ 131 /* Because of the above, we must have gcc search itself to find libgcc.a. */
68 #define LINK_LIBGCC_SPECIAL_1 132 #define LINK_LIBGCC_SPECIAL_1
69
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 \
87 }"
88
89 #define MFLIB_SPEC " %{fmudflap: -lmudflap \
90 %{static:%(link_gcc_c_sequence) -lmudflap}} \
91 %{fmudflapth: -lmudflapth -lpthread \
92 %{static:%(link_gcc_c_sequence) -lmudflapth}} "
93 133
94 /* Names to predefine in the preprocessor for this target machine. */ 134 /* Names to predefine in the preprocessor for this target machine. */
95 #define TARGET_OS_AIX_CPP_BUILTINS() \ 135 #define TARGET_OS_AIX_CPP_BUILTINS() \
96 do \ 136 do \
97 { \ 137 { \
98 builtin_define ("_IBMR2"); \ 138 builtin_define ("_IBMR2"); \
99 builtin_define ("_POWER"); \ 139 builtin_define ("_POWER"); \
140 builtin_define ("__unix__"); \
100 builtin_define ("_AIX"); \ 141 builtin_define ("_AIX"); \
101 builtin_define ("_AIX32"); \ 142 builtin_define ("_AIX32"); \
102 builtin_define ("_AIX41"); \ 143 builtin_define ("_AIX41"); \
103 builtin_define ("_LONG_LONG"); \ 144 builtin_define ("_LONG_LONG"); \
104 if (TARGET_LONG_DOUBLE_128) \ 145 if (TARGET_LONG_DOUBLE_128) \
105 builtin_define ("__LONGDOUBLE128"); \ 146 builtin_define ("__LONGDOUBLE128"); \
106 builtin_assert ("system=unix"); \ 147 builtin_assert ("system=unix"); \
107 builtin_assert ("system=aix"); \ 148 builtin_assert ("system=aix"); \
149 if (TARGET_64BIT) \
150 { \
151 builtin_define ("__PPC__"); \
152 builtin_define ("__PPC64__"); \
153 builtin_define ("__powerpc__"); \
154 builtin_define ("__powerpc64__"); \
155 builtin_assert ("cpu=powerpc64"); \
156 builtin_assert ("machine=powerpc64"); \
157 } \
158 else \
159 { \
160 builtin_define ("__PPC__"); \
161 builtin_define ("__powerpc__"); \
162 builtin_assert ("cpu=powerpc"); \
163 builtin_assert ("machine=powerpc"); \
164 } \
108 } \ 165 } \
109 while (0) 166 while (0)
110 167
111 /* Define appropriate architecture macros for preprocessor depending on 168 /* Define appropriate architecture macros for preprocessor depending on
112 target switches. */ 169 target switches. */
160 /* Static linking with shared libstdc++ requires libsupc++ as well. */ 217 /* Static linking with shared libstdc++ requires libsupc++ as well. */
161 #define LIBSTDCXX_STATIC "supc++" 218 #define LIBSTDCXX_STATIC "supc++"
162 219
163 /* This now supports a natural alignment mode. */ 220 /* This now supports a natural alignment mode. */
164 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ 221 /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
165 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ 222 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
166 ((TARGET_ALIGN_NATURAL == 0 \ 223 ((TARGET_ALIGN_NATURAL == 0 \
167 && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \ 224 && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \
168 ? MIN ((COMPUTED), 32) \ 225 ? MIN ((COMPUTED), 32) \
169 : (COMPUTED)) 226 : (COMPUTED))
170 227
171 /* AIX increases natural record alignment to doubleword if the first 228 /* AIX increases natural record alignment to doubleword if the first
172 field is an FP double while the FP fields remain word aligned. */ 229 field is an FP double while the FP fields remain word aligned. */
190 247
191 /* Specify padding for the last element of a block move between 248 /* Specify padding for the last element of a block move between
192 registers and memory. FIRST is nonzero if this is the only 249 registers and memory. FIRST is nonzero if this is the only
193 element. */ 250 element. */
194 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ 251 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
195 (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE)) 252 (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
196 253
197 /* Indicate that jump tables go in the text section. */ 254 /* Indicate that jump tables go in the text section. */
198 255
199 #define JUMP_TABLES_IN_TEXT_SECTION 1 256 #define JUMP_TABLES_IN_TEXT_SECTION 1
200 257
202 #undef SUBTARGET_EXTRA_SPECS 259 #undef SUBTARGET_EXTRA_SPECS
203 #define SUBTARGET_EXTRA_SPECS \ 260 #define SUBTARGET_EXTRA_SPECS \
204 { "link_syscalls", LINK_SYSCALLS_SPEC }, \ 261 { "link_syscalls", LINK_SYSCALLS_SPEC }, \
205 { "link_libg", LINK_LIBG_SPEC } 262 { "link_libg", LINK_LIBG_SPEC }
206 263
207 /* Define cutoff for using external functions to save floating point. */
208 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
209 /* And similarly for general purpose registers. */
210 #define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
211
212 /* If the current unwind info (FS) does not contain explicit info
213 saving R2, then we have to do a minor amount of code reading to
214 figure out if it was saved. The big problem here is that the
215 code that does the save/restore is generated by the linker, so
216 we have no good way to determine at compile time what to do. */
217
218 #define R_LR 65
219
220 #ifdef __64BIT__
221 #define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
222 do { \
223 if ((FS)->regs.reg[2].how == REG_UNSAVED) \
224 { \
225 unsigned int *insn \
226 = (unsigned int *) \
227 _Unwind_GetGR ((CTX), R_LR); \
228 if (*insn == 0xE8410028) \
229 _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40); \
230 } \
231 } while (0)
232 #else
233 #define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
234 do { \
235 if ((FS)->regs.reg[2].how == REG_UNSAVED) \
236 { \
237 unsigned int *insn \
238 = (unsigned int *) \
239 _Unwind_GetGR ((CTX), R_LR); \
240 if (*insn == 0x80410014) \
241 _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 20); \
242 } \
243 } while (0)
244 #endif
245
246 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) 264 #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
247
248 /* Print subsidiary information on the compiler version in use. */
249 #define TARGET_VERSION ;
250 265
251 /* No version of AIX fully supports AltiVec or 64-bit instructions in 266 /* No version of AIX fully supports AltiVec or 64-bit instructions in
252 32-bit mode. */ 267 32-bit mode. */
253 #define OS_MISSING_POWERPC64 1 268 #define OS_MISSING_POWERPC64 1
254 #define OS_MISSING_ALTIVEC 1 269 #define OS_MISSING_ALTIVEC 1
256 /* WINT_TYPE */ 271 /* WINT_TYPE */
257 #define WINT_TYPE "int" 272 #define WINT_TYPE "int"
258 273
259 /* Static stack checking is supported by means of probes. */ 274 /* Static stack checking is supported by means of probes. */
260 #define STACK_CHECK_STATIC_BUILTIN 1 275 #define STACK_CHECK_STATIC_BUILTIN 1
276
277 /* Use standard DWARF numbering for DWARF debugging information. */
278 #define RS6000_USE_DWARF_NUMBERING
279