Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/rs6000/linux64.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 64 bit PowerPC linux. | 2 for 64 bit PowerPC linux. |
3 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, | 3 Copyright (C) 2000-2017 Free Software Foundation, Inc. |
4 2009, 2010, 2011 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 |
23 a copy of the GCC Runtime Library Exception along with this program; | 22 a copy of the GCC Runtime Library Exception along with this program; |
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | 23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
25 <http://www.gnu.org/licenses/>. */ | 24 <http://www.gnu.org/licenses/>. */ |
26 | 25 |
27 #ifndef RS6000_BI_ARCH | 26 #ifndef RS6000_BI_ARCH |
28 | |
29 #undef DEFAULT_ABI | |
30 #define DEFAULT_ABI ABI_AIX | |
31 | 27 |
32 #undef TARGET_64BIT | 28 #undef TARGET_64BIT |
33 #define TARGET_64BIT 1 | 29 #define TARGET_64BIT 1 |
34 | 30 |
35 #define DEFAULT_ARCH64_P 1 | 31 #define DEFAULT_ARCH64_P 1 |
61 #define DOT_SYMBOLS dot_symbols | 57 #define DOT_SYMBOLS dot_symbols |
62 #endif | 58 #endif |
63 | 59 |
64 #define TARGET_PROFILE_KERNEL profile_kernel | 60 #define TARGET_PROFILE_KERNEL profile_kernel |
65 | 61 |
62 #undef TARGET_KEEP_LEAF_WHEN_PROFILED | |
63 #define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled | |
64 | |
66 #define TARGET_USES_LINUX64_OPT 1 | 65 #define TARGET_USES_LINUX64_OPT 1 |
67 #ifdef HAVE_LD_LARGE_TOC | 66 #ifdef HAVE_LD_LARGE_TOC |
68 #undef TARGET_CMODEL | 67 #undef TARGET_CMODEL |
69 #define TARGET_CMODEL rs6000_current_cmodel | 68 #define TARGET_CMODEL rs6000_current_cmodel |
70 #define SET_CMODEL(opt) rs6000_current_cmodel = opt | 69 #define SET_CMODEL(opt) rs6000_current_cmodel = opt |
73 #endif | 72 #endif |
74 | 73 |
75 #undef PROCESSOR_DEFAULT | 74 #undef PROCESSOR_DEFAULT |
76 #define PROCESSOR_DEFAULT PROCESSOR_POWER7 | 75 #define PROCESSOR_DEFAULT PROCESSOR_POWER7 |
77 #undef PROCESSOR_DEFAULT64 | 76 #undef PROCESSOR_DEFAULT64 |
78 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER7 | 77 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8 |
79 | 78 |
80 /* We don't need to generate entries in .fixup, except when | 79 /* We don't need to generate entries in .fixup, except when |
81 -mrelocatable or -mrelocatable-lib is given. */ | 80 -mrelocatable or -mrelocatable-lib is given. */ |
82 #undef RELOCATABLE_NEEDS_FIXUP | 81 #undef RELOCATABLE_NEEDS_FIXUP |
83 #define RELOCATABLE_NEEDS_FIXUP \ | 82 #define RELOCATABLE_NEEDS_FIXUP \ |
84 (target_flags & target_flags_explicit & MASK_RELOCATABLE) | 83 (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE) |
85 | 84 |
86 #undef RS6000_ABI_NAME | 85 #undef RS6000_ABI_NAME |
87 #define RS6000_ABI_NAME "linux" | 86 #define RS6000_ABI_NAME "linux" |
88 | 87 |
89 #define INVALID_64BIT "-m%s not supported in this configuration" | 88 #define INVALID_64BIT "%<-m%s%> not supported in this configuration" |
90 #define INVALID_32BIT INVALID_64BIT | 89 #define INVALID_32BIT INVALID_64BIT |
90 | |
91 #ifdef LINUX64_DEFAULT_ABI_ELFv2 | |
92 #define ELFv2_ABI_CHECK (rs6000_elf_abi != 1) | |
93 #else | |
94 #define ELFv2_ABI_CHECK (rs6000_elf_abi == 2) | |
95 #endif | |
91 | 96 |
92 #undef SUBSUBTARGET_OVERRIDE_OPTIONS | 97 #undef SUBSUBTARGET_OVERRIDE_OPTIONS |
93 #define SUBSUBTARGET_OVERRIDE_OPTIONS \ | 98 #define SUBSUBTARGET_OVERRIDE_OPTIONS \ |
94 do \ | 99 do \ |
95 { \ | 100 { \ |
96 if (!rs6000_explicit_options.alignment) \ | 101 if (!global_options_set.x_rs6000_alignment_flags) \ |
97 rs6000_alignment_flags = MASK_ALIGN_NATURAL; \ | 102 rs6000_alignment_flags = MASK_ALIGN_NATURAL; \ |
98 if (TARGET_64BIT) \ | 103 if (rs6000_isa_flags & OPTION_MASK_64BIT) \ |
99 { \ | 104 { \ |
100 if (DEFAULT_ABI != ABI_AIX) \ | 105 if (DEFAULT_ABI != ABI_AIX) \ |
101 { \ | 106 { \ |
102 rs6000_current_abi = ABI_AIX; \ | 107 rs6000_current_abi = ABI_AIX; \ |
103 error (INVALID_64BIT, "call"); \ | 108 error (INVALID_64BIT, "call"); \ |
104 } \ | 109 } \ |
105 dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \ | 110 dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \ |
106 if (target_flags & MASK_RELOCATABLE) \ | 111 if (ELFv2_ABI_CHECK) \ |
107 { \ | 112 { \ |
108 target_flags &= ~MASK_RELOCATABLE; \ | 113 rs6000_current_abi = ABI_ELFv2; \ |
114 if (dot_symbols) \ | |
115 error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \ | |
116 } \ | |
117 if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \ | |
118 { \ | |
119 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ | |
109 error (INVALID_64BIT, "relocatable"); \ | 120 error (INVALID_64BIT, "relocatable"); \ |
110 } \ | 121 } \ |
111 if (target_flags & MASK_EABI) \ | 122 if (rs6000_isa_flags & OPTION_MASK_EABI) \ |
112 { \ | 123 { \ |
113 target_flags &= ~MASK_EABI; \ | 124 rs6000_isa_flags &= ~OPTION_MASK_EABI; \ |
114 error (INVALID_64BIT, "eabi"); \ | 125 error (INVALID_64BIT, "eabi"); \ |
115 } \ | 126 } \ |
116 if (TARGET_PROTOTYPE) \ | 127 if (TARGET_PROTOTYPE) \ |
117 { \ | 128 { \ |
118 target_prototype = 0; \ | 129 target_prototype = 0; \ |
119 error (INVALID_64BIT, "prototype"); \ | 130 error (INVALID_64BIT, "prototype"); \ |
120 } \ | 131 } \ |
121 if ((target_flags & MASK_POWERPC64) == 0) \ | 132 if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \ |
122 { \ | 133 { \ |
123 target_flags |= MASK_POWERPC64; \ | 134 rs6000_isa_flags |= OPTION_MASK_POWERPC64; \ |
124 error ("-m64 requires a PowerPC64 cpu"); \ | 135 error ("-m64 requires a PowerPC64 cpu"); \ |
125 } \ | 136 } \ |
126 if ((target_flags_explicit & MASK_MINIMAL_TOC) != 0) \ | 137 if ((rs6000_isa_flags_explicit \ |
127 { \ | 138 & OPTION_MASK_MINIMAL_TOC) != 0) \ |
128 if (rs6000_explicit_options.cmodel \ | 139 { \ |
140 if (global_options_set.x_rs6000_current_cmodel \ | |
129 && rs6000_current_cmodel != CMODEL_SMALL) \ | 141 && rs6000_current_cmodel != CMODEL_SMALL) \ |
130 error ("-mcmodel incompatible with other toc options"); \ | 142 error ("-mcmodel incompatible with other toc options"); \ |
131 SET_CMODEL (CMODEL_SMALL); \ | 143 SET_CMODEL (CMODEL_SMALL); \ |
132 } \ | 144 } \ |
133 else \ | 145 else \ |
134 { \ | 146 { \ |
135 if (!rs6000_explicit_options.cmodel) \ | 147 if (!global_options_set.x_rs6000_current_cmodel) \ |
136 SET_CMODEL (CMODEL_MEDIUM); \ | 148 SET_CMODEL (CMODEL_MEDIUM); \ |
137 if (rs6000_current_cmodel != CMODEL_SMALL) \ | 149 if (rs6000_current_cmodel != CMODEL_SMALL) \ |
138 { \ | 150 { \ |
139 TARGET_NO_FP_IN_TOC = 0; \ | 151 if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \ |
140 TARGET_NO_SUM_IN_TOC = 0; \ | 152 TARGET_NO_FP_IN_TOC \ |
153 = rs6000_current_cmodel == CMODEL_MEDIUM; \ | |
154 if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \ | |
155 TARGET_NO_SUM_IN_TOC = 0; \ | |
141 } \ | 156 } \ |
142 } \ | 157 } \ |
143 } \ | 158 } \ |
144 else \ | 159 else \ |
145 { \ | 160 { \ |
148 if (TARGET_PROFILE_KERNEL) \ | 163 if (TARGET_PROFILE_KERNEL) \ |
149 { \ | 164 { \ |
150 TARGET_PROFILE_KERNEL = 0; \ | 165 TARGET_PROFILE_KERNEL = 0; \ |
151 error (INVALID_32BIT, "profile-kernel"); \ | 166 error (INVALID_32BIT, "profile-kernel"); \ |
152 } \ | 167 } \ |
153 if (rs6000_explicit_options.cmodel) \ | 168 if (global_options_set.x_rs6000_current_cmodel) \ |
154 { \ | 169 { \ |
155 SET_CMODEL (CMODEL_SMALL); \ | 170 SET_CMODEL (CMODEL_SMALL); \ |
156 error (INVALID_32BIT, "cmodel"); \ | 171 error (INVALID_32BIT, "cmodel"); \ |
157 } \ | 172 } \ |
158 } \ | 173 } \ |
159 } \ | 174 } \ |
160 while (0) | 175 while (0) |
161 | 176 |
162 #ifdef RS6000_BI_ARCH | |
163 | |
164 #undef OPTION_TARGET_CPU_DEFAULT | |
165 #define OPTION_TARGET_CPU_DEFAULT \ | |
166 (((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \ | |
167 ? (char *) 0 : TARGET_CPU_DEFAULT) | |
168 | |
169 #endif | |
170 | |
171 #undef ASM_DEFAULT_SPEC | 177 #undef ASM_DEFAULT_SPEC |
172 #undef ASM_SPEC | 178 #undef ASM_SPEC |
173 #undef LINK_OS_LINUX_SPEC | 179 #undef LINK_OS_LINUX_SPEC |
174 | 180 #undef LINK_SECURE_PLT_SPEC |
175 /* FIXME: This will quite possibly choose the wrong dynamic linker. */ | |
176 #undef LINK_OS_GNU_SPEC | |
177 #define LINK_OS_GNU_SPEC LINK_OS_LINUX_SPEC | |
178 | 181 |
179 #ifndef RS6000_BI_ARCH | 182 #ifndef RS6000_BI_ARCH |
180 #define ASM_DEFAULT_SPEC "-mppc64" | 183 #define ASM_DEFAULT_SPEC "-mppc64" |
181 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)" | 184 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)" |
182 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)" | 185 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)" |
186 #define LINK_SECURE_PLT_SPEC "" | |
183 #else | 187 #else |
184 #if DEFAULT_ARCH64_P | 188 #if DEFAULT_ARCH64_P |
185 #define ASM_DEFAULT_SPEC "-mppc%{!m32:64}" | 189 #define ASM_DEFAULT_SPEC "-mppc%{!m32:64}" |
186 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)" | 190 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)" |
187 #define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}" | 191 #define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}" |
192 #define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}" | |
188 #else | 193 #else |
189 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}" | 194 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}" |
190 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" | 195 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" |
191 #define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}" | 196 #define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}" |
197 #define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}" | |
192 #endif | 198 #endif |
193 #endif | 199 #endif |
194 | 200 |
195 #define ASM_SPEC32 "-a32 \ | 201 #define ASM_SPEC32 "-a32 \ |
196 %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ | 202 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ |
197 %{memb} %{!memb: %{msdata=eabi: -memb}} \ | 203 %{memb|msdata=eabi: -memb}" |
198 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ | |
199 %{mcall-freebsd: -mbig} \ | |
200 %{mcall-i960-old: -mlittle} \ | |
201 %{mcall-linux: -mbig} \ | |
202 %{mcall-gnu: -mbig} \ | |
203 %{mcall-netbsd: -mbig} \ | |
204 }}}}" | |
205 | 204 |
206 #define ASM_SPEC64 "-a64" | 205 #define ASM_SPEC64 "-a64" |
207 | 206 |
208 #define ASM_SPEC_COMMON "%(asm_cpu) \ | 207 #define ASM_SPEC_COMMON "%(asm_cpu) \ |
209 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ | 208 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \ |
210 %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}" | 209 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) |
211 | 210 |
212 #undef SUBSUBTARGET_EXTRA_SPECS | 211 #undef SUBSUBTARGET_EXTRA_SPECS |
213 #define SUBSUBTARGET_EXTRA_SPECS \ | 212 #define SUBSUBTARGET_EXTRA_SPECS \ |
214 { "asm_spec_common", ASM_SPEC_COMMON }, \ | 213 { "asm_spec_common", ASM_SPEC_COMMON }, \ |
215 { "asm_spec32", ASM_SPEC32 }, \ | 214 { "asm_spec32", ASM_SPEC32 }, \ |
216 { "asm_spec64", ASM_SPEC64 }, \ | 215 { "asm_spec64", ASM_SPEC64 }, \ |
217 { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \ | 216 { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \ |
218 { "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 }, | 217 { "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 }, \ |
218 { "link_os_extra_spec32", LINK_OS_EXTRA_SPEC32 }, \ | |
219 { "link_os_extra_spec64", LINK_OS_EXTRA_SPEC64 }, \ | |
220 { "link_os_new_dtags", LINK_OS_NEW_DTAGS_SPEC }, \ | |
221 { "include_extra", INCLUDE_EXTRA_SPEC }, \ | |
222 { "dynamic_linker_prefix", DYNAMIC_LINKER_PREFIX }, | |
223 | |
224 /* Optional specs used for overriding the system include directory, default | |
225 -rpath links, and prefix for the dynamic linker. Normally, there are not | |
226 defined, but if the user configure with the --with-advance-toolchain=<xxx> | |
227 option, the advance-toolchain.h file will override these. */ | |
228 #ifndef INCLUDE_EXTRA_SPEC | |
229 #define INCLUDE_EXTRA_SPEC "" | |
230 #endif | |
231 | |
232 #ifndef LINK_OS_EXTRA_SPEC32 | |
233 #define LINK_OS_EXTRA_SPEC32 "" | |
234 #endif | |
235 | |
236 #ifndef LINK_OS_EXTRA_SPEC64 | |
237 #define LINK_OS_EXTRA_SPEC64 "" | |
238 #endif | |
239 | |
240 #ifndef LINK_OS_NEW_DTAGS_SPEC | |
241 #define LINK_OS_NEW_DTAGS_SPEC "" | |
242 #endif | |
243 | |
244 #ifndef DYNAMIC_LINKER_PREFIX | |
245 #define DYNAMIC_LINKER_PREFIX "" | |
246 #endif | |
219 | 247 |
220 #undef MULTILIB_DEFAULTS | 248 #undef MULTILIB_DEFAULTS |
221 #if DEFAULT_ARCH64_P | 249 #if DEFAULT_ARCH64_P |
222 #define MULTILIB_DEFAULTS { "m64" } | 250 #define MULTILIB_DEFAULTS { "m64" } |
223 #else | 251 #else |
224 #define MULTILIB_DEFAULTS { "m32" } | 252 #define MULTILIB_DEFAULTS { "m32" } |
225 #endif | 253 #endif |
226 | 254 |
255 /* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */ | |
256 #if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018 | |
257 # ifndef RS6000_BI_ARCH | |
258 # define TARGET_CAN_SPLIT_STACK | |
259 # else | |
260 # if DEFAULT_ARCH64_P | |
261 /* Supported, and the default is -m64 */ | |
262 # define TARGET_CAN_SPLIT_STACK_64BIT 1 | |
263 # else | |
264 /* Supported, and the default is -m32 */ | |
265 # define TARGET_CAN_SPLIT_STACK_64BIT 0 | |
266 # endif | |
267 # endif | |
268 #endif | |
269 | |
227 #ifndef RS6000_BI_ARCH | 270 #ifndef RS6000_BI_ARCH |
228 | |
229 /* 64-bit PowerPC Linux is always big-endian. */ | |
230 #undef TARGET_LITTLE_ENDIAN | |
231 #define TARGET_LITTLE_ENDIAN 0 | |
232 | 271 |
233 /* 64-bit PowerPC Linux always has a TOC. */ | 272 /* 64-bit PowerPC Linux always has a TOC. */ |
234 #undef TARGET_TOC | 273 #undef TARGET_TOC |
235 #define TARGET_TOC 1 | 274 #define TARGET_TOC 1 |
236 | 275 |
237 /* Some things from sysv4.h we don't do when 64 bit. */ | 276 /* Some things from sysv4.h we don't do when 64 bit. */ |
238 #undef TARGET_RELOCATABLE | 277 #undef OPTION_RELOCATABLE |
239 #define TARGET_RELOCATABLE 0 | 278 #define OPTION_RELOCATABLE 0 |
240 #undef TARGET_EABI | 279 #undef OPTION_EABI |
241 #define TARGET_EABI 0 | 280 #define OPTION_EABI 0 |
242 #undef TARGET_PROTOTYPE | 281 #undef OPTION_PROTOTYPE |
243 #define TARGET_PROTOTYPE 0 | 282 #define OPTION_PROTOTYPE 0 |
244 #undef RELOCATABLE_NEEDS_FIXUP | 283 #undef RELOCATABLE_NEEDS_FIXUP |
245 #define RELOCATABLE_NEEDS_FIXUP 0 | 284 #define RELOCATABLE_NEEDS_FIXUP 0 |
246 | 285 |
247 #endif | 286 #endif |
248 | 287 |
251 #define PROFILE_HOOK(LABEL) \ | 290 #define PROFILE_HOOK(LABEL) \ |
252 do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) | 291 do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) |
253 | 292 |
254 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ | 293 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ |
255 #undef ADJUST_FIELD_ALIGN | 294 #undef ADJUST_FIELD_ALIGN |
256 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ | 295 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ |
257 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ | 296 (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ |
258 ? 128 \ | 297 ? 128 \ |
259 : (TARGET_64BIT \ | 298 : (TARGET_64BIT \ |
260 && TARGET_ALIGN_NATURAL == 0 \ | 299 && TARGET_ALIGN_NATURAL == 0 \ |
261 && TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode) \ | 300 && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ |
262 ? MIN ((COMPUTED), 32) \ | 301 ? MIN ((COMPUTED), 32) \ |
263 : (COMPUTED)) | 302 : (COMPUTED)) |
264 | 303 |
265 /* PowerPC64 Linux increases natural record alignment to doubleword if | 304 /* PowerPC64 Linux increases natural record alignment to doubleword if |
266 the first field is an FP double, only if in power alignment mode. */ | 305 the first field is an FP double, only if in power alignment mode. */ |
299 | 338 |
300 /* Specify padding for the last element of a block move between | 339 /* Specify padding for the last element of a block move between |
301 registers and memory. FIRST is nonzero if this is the only | 340 registers and memory. FIRST is nonzero if this is the only |
302 element. */ | 341 element. */ |
303 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ | 342 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ |
304 (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE)) | 343 (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE)) |
305 | 344 |
306 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit | 345 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit |
307 process. */ | 346 process. */ |
308 #define OS_MISSING_POWERPC64 !TARGET_64BIT | 347 #define OS_MISSING_POWERPC64 !TARGET_64BIT |
309 | 348 |
310 #ifdef SINGLE_LIBC | 349 #ifdef SINGLE_LIBC |
311 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) | 350 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) |
351 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) | |
352 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) | |
353 #undef OPTION_MUSL | |
354 #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) | |
312 #else | 355 #else |
313 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) | 356 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) |
314 #endif | 357 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) |
315 | 358 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) |
316 /* glibc has float and long double forms of math functions. */ | 359 #undef OPTION_MUSL |
317 #undef TARGET_C99_FUNCTIONS | 360 #define OPTION_MUSL (linux_libc == LIBC_MUSL) |
318 #define TARGET_C99_FUNCTIONS (OPTION_GLIBC) | 361 #endif |
319 | 362 |
320 /* Whether we have sincos that follows the GNU extension. */ | 363 /* Determine what functions are present at the runtime; |
321 #undef TARGET_HAS_SINCOS | 364 this includes full c99 runtime and sincos. */ |
322 #define TARGET_HAS_SINCOS (OPTION_GLIBC) | 365 #undef TARGET_LIBC_HAS_FUNCTION |
366 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function | |
323 | 367 |
324 #undef TARGET_OS_CPP_BUILTINS | 368 #undef TARGET_OS_CPP_BUILTINS |
325 #define TARGET_OS_CPP_BUILTINS() \ | 369 #define TARGET_OS_CPP_BUILTINS() \ |
326 do \ | 370 do \ |
327 { \ | 371 { \ |
329 { \ | 373 { \ |
330 builtin_define ("__PPC__"); \ | 374 builtin_define ("__PPC__"); \ |
331 builtin_define ("__PPC64__"); \ | 375 builtin_define ("__PPC64__"); \ |
332 builtin_define ("__powerpc__"); \ | 376 builtin_define ("__powerpc__"); \ |
333 builtin_define ("__powerpc64__"); \ | 377 builtin_define ("__powerpc64__"); \ |
378 if (!DOT_SYMBOLS) \ | |
379 builtin_define ("_CALL_LINUX"); \ | |
334 builtin_assert ("cpu=powerpc64"); \ | 380 builtin_assert ("cpu=powerpc64"); \ |
335 builtin_assert ("machine=powerpc64"); \ | 381 builtin_assert ("machine=powerpc64"); \ |
336 } \ | 382 } \ |
337 else \ | 383 else \ |
338 { \ | 384 { \ |
344 } \ | 390 } \ |
345 } \ | 391 } \ |
346 while (0) | 392 while (0) |
347 | 393 |
348 #undef CPP_OS_DEFAULT_SPEC | 394 #undef CPP_OS_DEFAULT_SPEC |
349 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" | 395 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)" |
350 | |
351 /* The GNU C++ standard library currently requires _GNU_SOURCE being | |
352 defined on glibc-based systems. This temporary hack accomplishes this, | |
353 it should go away as soon as libstdc++-v3 has a real fix. */ | |
354 #undef CPLUSPLUS_CPP_SPEC | |
355 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | |
356 | 396 |
357 #undef LINK_SHLIB_SPEC | 397 #undef LINK_SHLIB_SPEC |
358 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" | 398 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \ |
399 %{static-pie:-static -pie --no-dynamic-linker -z text}" | |
359 | 400 |
360 #undef LIB_DEFAULT_SPEC | 401 #undef LIB_DEFAULT_SPEC |
361 #define LIB_DEFAULT_SPEC "%(lib_linux)" | 402 #define LIB_DEFAULT_SPEC "%(lib_linux)" |
362 | 403 |
363 #undef STARTFILE_DEFAULT_SPEC | 404 #undef STARTFILE_DEFAULT_SPEC |
370 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" | 411 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" |
371 | 412 |
372 #undef LINK_OS_DEFAULT_SPEC | 413 #undef LINK_OS_DEFAULT_SPEC |
373 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" | 414 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" |
374 | 415 |
375 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" | 416 #define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1" |
376 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1" | 417 |
418 #ifdef LINUX64_DEFAULT_ABI_ELFv2 | |
419 #define GLIBC_DYNAMIC_LINKER64 \ | |
420 "%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \ | |
421 ":%(dynamic_linker_prefix)/lib64/ld64.so.2}" | |
422 #else | |
423 #define GLIBC_DYNAMIC_LINKER64 \ | |
424 "%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \ | |
425 ":%(dynamic_linker_prefix)/lib64/ld64.so.1}" | |
426 #endif | |
427 | |
428 #define MUSL_DYNAMIC_LINKER32 \ | |
429 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" | |
430 #define MUSL_DYNAMIC_LINKER64 \ | |
431 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" | |
432 | |
377 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" | 433 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" |
378 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" | 434 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" |
379 #if DEFAULT_LIBC == LIBC_UCLIBC | 435 #if DEFAULT_LIBC == LIBC_UCLIBC |
380 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" | 436 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \ |
437 "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" | |
381 #elif DEFAULT_LIBC == LIBC_GLIBC | 438 #elif DEFAULT_LIBC == LIBC_GLIBC |
382 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" | 439 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \ |
440 "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" | |
441 #elif DEFAULT_LIBC == LIBC_MUSL | |
442 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \ | |
443 "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" | |
383 #else | 444 #else |
384 #error "Unsupported DEFAULT_LIBC" | 445 #error "Unsupported DEFAULT_LIBC" |
385 #endif | 446 #endif |
386 #define LINUX_DYNAMIC_LINKER32 \ | 447 #define GNU_USER_DYNAMIC_LINKER32 \ |
387 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) | 448 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ |
388 #define LINUX_DYNAMIC_LINKER64 \ | 449 MUSL_DYNAMIC_LINKER32) |
389 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) | 450 #define GNU_USER_DYNAMIC_LINKER64 \ |
390 | 451 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ |
391 | 452 MUSL_DYNAMIC_LINKER64) |
392 #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \ | 453 |
393 %{rdynamic:-export-dynamic} \ | 454 #undef DEFAULT_ASM_ENDIAN |
394 -dynamic-linker " LINUX_DYNAMIC_LINKER32 "}}" | 455 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) |
395 | 456 #define DEFAULT_ASM_ENDIAN " -mlittle" |
396 #define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \ | 457 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \ |
397 %{rdynamic:-export-dynamic} \ | 458 " -m elf32lppclinux", \ |
398 -dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}" | 459 " -m elf32lppclinux") |
460 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \ | |
461 " -m elf64lppc", \ | |
462 " -m elf64lppc") | |
463 #else | |
464 #define DEFAULT_ASM_ENDIAN " -mbig" | |
465 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \ | |
466 " -m elf32lppclinux", \ | |
467 " -m elf32ppclinux") | |
468 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \ | |
469 " -m elf64lppc", \ | |
470 " -m elf64ppc") | |
471 #endif | |
472 | |
473 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \ | |
474 %{!static-pie: \ | |
475 %{rdynamic:-export-dynamic} \ | |
476 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \ | |
477 %(link_os_extra_spec32)" | |
478 | |
479 #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \ | |
480 %{!static-pie: \ | |
481 %{rdynamic:-export-dynamic} \ | |
482 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \ | |
483 %(link_os_extra_spec64)" | |
399 | 484 |
400 #undef TOC_SECTION_ASM_OP | 485 #undef TOC_SECTION_ASM_OP |
401 #define TOC_SECTION_ASM_OP \ | 486 #define TOC_SECTION_ASM_OP \ |
402 (TARGET_64BIT \ | 487 (TARGET_64BIT \ |
403 ? "\t.section\t\".toc\",\"aw\"" \ | 488 ? "\t.section\t\".toc\",\"aw\"" \ |
405 | 490 |
406 #undef MINIMAL_TOC_SECTION_ASM_OP | 491 #undef MINIMAL_TOC_SECTION_ASM_OP |
407 #define MINIMAL_TOC_SECTION_ASM_OP \ | 492 #define MINIMAL_TOC_SECTION_ASM_OP \ |
408 (TARGET_64BIT \ | 493 (TARGET_64BIT \ |
409 ? "\t.section\t\".toc1\",\"aw\"" \ | 494 ? "\t.section\t\".toc1\",\"aw\"" \ |
410 : ((TARGET_RELOCATABLE || flag_pic) \ | 495 : (flag_pic \ |
411 ? "\t.section\t\".got2\",\"aw\"" \ | 496 ? "\t.section\t\".got2\",\"aw\"" \ |
412 : "\t.section\t\".got1\",\"aw\"")) | 497 : "\t.section\t\".got1\",\"aw\"")) |
413 | |
414 #undef TARGET_VERSION | |
415 #define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)"); | |
416 | 498 |
417 /* Must be at least as big as our pointer type. */ | 499 /* Must be at least as big as our pointer type. */ |
418 #undef SIZE_TYPE | 500 #undef SIZE_TYPE |
419 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") | 501 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") |
420 | 502 |
423 | 505 |
424 #undef WCHAR_TYPE | 506 #undef WCHAR_TYPE |
425 #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") | 507 #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") |
426 #undef WCHAR_TYPE_SIZE | 508 #undef WCHAR_TYPE_SIZE |
427 #define WCHAR_TYPE_SIZE 32 | 509 #define WCHAR_TYPE_SIZE 32 |
428 | |
429 /* Override rs6000.h definition. */ | |
430 #undef ASM_APP_ON | |
431 #define ASM_APP_ON "#APP\n" | |
432 | |
433 /* Override rs6000.h definition. */ | |
434 #undef ASM_APP_OFF | |
435 #define ASM_APP_OFF "#NO_APP\n" | |
436 | |
437 /* PowerPC no-op instruction. */ | |
438 #undef RS6000_CALL_GLUE | |
439 #define RS6000_CALL_GLUE (TARGET_64BIT ? "nop" : "cror 31,31,31") | |
440 | 510 |
441 #undef RS6000_MCOUNT | 511 #undef RS6000_MCOUNT |
442 #define RS6000_MCOUNT "_mcount" | 512 #define RS6000_MCOUNT "_mcount" |
443 | 513 |
444 #ifdef __powerpc64__ | 514 #ifdef __powerpc64__ |
516 && (TARGET_MINIMAL_TOC \ | 586 && (TARGET_MINIMAL_TOC \ |
517 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ | 587 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ |
518 && ! TARGET_NO_FP_IN_TOC))) \ | 588 && ! TARGET_NO_FP_IN_TOC))) \ |
519 || (!TARGET_64BIT \ | 589 || (!TARGET_64BIT \ |
520 && !TARGET_NO_FP_IN_TOC \ | 590 && !TARGET_NO_FP_IN_TOC \ |
521 && !TARGET_RELOCATABLE \ | |
522 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ | 591 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ |
523 && BITS_PER_WORD == HOST_BITS_PER_INT))))) | 592 && BITS_PER_WORD == HOST_BITS_PER_INT))))) |
524 | 593 |
525 /* Select a format to encode pointers in exception handling data. CODE | 594 /* Select a format to encode pointers in exception handling data. CODE |
526 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is | 595 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is |
527 true if the symbol may be affected by dynamic relocations. */ | 596 true if the symbol may be affected by dynamic relocations. */ |
528 #undef ASM_PREFERRED_EH_DATA_FORMAT | 597 #undef ASM_PREFERRED_EH_DATA_FORMAT |
529 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ | 598 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ |
530 ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE) \ | 599 (TARGET_64BIT || flag_pic \ |
531 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ | 600 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ |
532 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ | 601 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ |
533 : DW_EH_PE_absptr) | 602 : DW_EH_PE_absptr) |
534 | 603 |
535 /* For backward compatibility, we must continue to use the AIX | 604 /* For backward compatibility, we must continue to use the AIX |
536 structure return convention. */ | 605 structure return convention. */ |
537 #undef DRAFT_V4_STRUCT_RET | 606 #undef DRAFT_V4_STRUCT_RET |
538 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) | 607 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) |
539 | 608 |
540 #define TARGET_POSIX_IO | |
541 | |
542 #define LINK_GCC_C_SEQUENCE_SPEC \ | |
543 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" | |
544 | |
545 /* Use --as-needed -lgcc_s for eh support. */ | |
546 #ifdef HAVE_LD_AS_NEEDED | |
547 #define USE_LD_AS_NEEDED 1 | |
548 #endif | |
549 | |
550 #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" | |
551 | |
552 #ifdef TARGET_LIBC_PROVIDES_SSP | 609 #ifdef TARGET_LIBC_PROVIDES_SSP |
553 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), | 610 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), |
554 ppc64 glibc provides it at -0x7010(13). */ | 611 ppc64 glibc provides it at -0x7010(13). */ |
555 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) | 612 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) |
556 #endif | 613 #endif |
565 /* Static stack checking is supported by means of probes. */ | 622 /* Static stack checking is supported by means of probes. */ |
566 #define STACK_CHECK_STATIC_BUILTIN 1 | 623 #define STACK_CHECK_STATIC_BUILTIN 1 |
567 | 624 |
568 /* The default value isn't sufficient in 64-bit mode. */ | 625 /* The default value isn't sufficient in 64-bit mode. */ |
569 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) | 626 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) |
627 | |
628 /* Software floating point support for exceptions and rounding modes | |
629 depends on the C library in use. */ | |
630 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P | |
631 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \ | |
632 rs6000_linux_float_exceptions_rounding_supported_p | |
633 | |
634 /* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends | |
635 on glibc 2.19 or greater. */ | |
636 #if TARGET_GLIBC_MAJOR > 2 \ | |
637 || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19) | |
638 #define RS6000_GLIBC_ATOMIC_FENV 1 | |
639 #endif | |
640 | |
641 /* The IEEE 128-bit emulator is only built on Linux systems. Flag that we | |
642 should enable the type handling for KFmode on VSX systems even if we are not | |
643 enabling the __float128 keyword. */ | |
644 #undef TARGET_FLOAT128_ENABLE_TYPE | |
645 #define TARGET_FLOAT128_ENABLE_TYPE 1 |