* gimplify.c (nonlocal_vlas): Delete.
[official-gcc.git] / gcc / config / rs6000 / linux64.h
blob90fe65662552e31b8b116d60230c160d78cc25d6
1 /* Definitions of target machine for GNU compiler,
2 for 64 bit PowerPC linux.
3 Copyright (C) 2000-2018 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 #ifndef RS6000_BI_ARCH
28 #undef TARGET_64BIT
29 #define TARGET_64BIT 1
31 #define DEFAULT_ARCH64_P 1
32 #define RS6000_BI_ARCH_P 0
34 #else
36 #define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
37 #define RS6000_BI_ARCH_P 1
39 #endif
41 #ifdef IN_LIBGCC2
42 #undef TARGET_64BIT
43 #ifdef __powerpc64__
44 #define TARGET_64BIT 1
45 #else
46 #define TARGET_64BIT 0
47 #endif
48 #endif
50 #undef TARGET_AIX
51 #define TARGET_AIX TARGET_64BIT
53 #ifdef HAVE_LD_NO_DOT_SYMS
54 /* New ABI uses a local sym for the function entry point. */
55 extern int dot_symbols;
56 #undef DOT_SYMBOLS
57 #define DOT_SYMBOLS dot_symbols
58 #endif
60 #define TARGET_PROFILE_KERNEL profile_kernel
62 #undef TARGET_KEEP_LEAF_WHEN_PROFILED
63 #define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled
65 #define TARGET_USES_LINUX64_OPT 1
66 #ifdef HAVE_LD_LARGE_TOC
67 #undef TARGET_CMODEL
68 #define TARGET_CMODEL rs6000_current_cmodel
69 #define SET_CMODEL(opt) rs6000_current_cmodel = opt
70 #else
71 #define SET_CMODEL(opt) do {} while (0)
72 #endif
74 #undef PROCESSOR_DEFAULT
75 #define PROCESSOR_DEFAULT PROCESSOR_POWER7
76 #undef PROCESSOR_DEFAULT64
77 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
79 /* We don't need to generate entries in .fixup, except when
80 -mrelocatable or -mrelocatable-lib is given. */
81 #undef RELOCATABLE_NEEDS_FIXUP
82 #define RELOCATABLE_NEEDS_FIXUP \
83 (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
85 #undef RS6000_ABI_NAME
86 #define RS6000_ABI_NAME "linux"
88 #define INVALID_64BIT "%<-m%s%> not supported in this configuration"
89 #define INVALID_32BIT INVALID_64BIT
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
97 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
98 #define SUBSUBTARGET_OVERRIDE_OPTIONS \
99 do \
101 if (!global_options_set.x_rs6000_alignment_flags) \
102 rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
103 if (rs6000_isa_flags & OPTION_MASK_64BIT) \
105 if (DEFAULT_ABI != ABI_AIX) \
107 rs6000_current_abi = ABI_AIX; \
108 error (INVALID_64BIT, "call"); \
110 dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
111 if (ELFv2_ABI_CHECK) \
113 rs6000_current_abi = ABI_ELFv2; \
114 if (dot_symbols) \
115 error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
117 if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
119 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
120 error (INVALID_64BIT, "relocatable"); \
122 if (rs6000_isa_flags & OPTION_MASK_EABI) \
124 rs6000_isa_flags &= ~OPTION_MASK_EABI; \
125 error (INVALID_64BIT, "eabi"); \
127 if (TARGET_PROTOTYPE) \
129 target_prototype = 0; \
130 error (INVALID_64BIT, "prototype"); \
132 if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
134 rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
135 error ("-m64 requires a PowerPC64 cpu"); \
137 if ((rs6000_isa_flags_explicit \
138 & OPTION_MASK_MINIMAL_TOC) != 0) \
140 if (global_options_set.x_rs6000_current_cmodel \
141 && rs6000_current_cmodel != CMODEL_SMALL) \
142 error ("-mcmodel incompatible with other toc options"); \
143 SET_CMODEL (CMODEL_SMALL); \
145 else \
147 if (!global_options_set.x_rs6000_current_cmodel) \
148 SET_CMODEL (CMODEL_MEDIUM); \
149 if (rs6000_current_cmodel != CMODEL_SMALL) \
151 if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \
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; \
159 else \
161 if (!RS6000_BI_ARCH_P) \
162 error (INVALID_32BIT, "32"); \
163 if (TARGET_PROFILE_KERNEL) \
165 TARGET_PROFILE_KERNEL = 0; \
166 error (INVALID_32BIT, "profile-kernel"); \
168 if (global_options_set.x_rs6000_current_cmodel) \
170 SET_CMODEL (CMODEL_SMALL); \
171 error (INVALID_32BIT, "cmodel"); \
175 while (0)
177 #undef ASM_DEFAULT_SPEC
178 #undef ASM_SPEC
179 #undef LINK_OS_LINUX_SPEC
180 #undef LINK_SECURE_PLT_SPEC
182 #ifndef RS6000_BI_ARCH
183 #define ASM_DEFAULT_SPEC "-mppc64"
184 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
185 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
186 #define LINK_SECURE_PLT_SPEC ""
187 #else
188 #if DEFAULT_ARCH64_P
189 #define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
190 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
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 "}"
193 #else
194 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
195 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
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 "}"
198 #endif
199 #endif
201 #define ASM_SPEC32 "-a32 \
202 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
203 %{memb|msdata=eabi: -memb}"
205 #define ASM_SPEC64 "-a64"
207 #define ASM_SPEC_COMMON "%(asm_cpu) \
208 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
209 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
211 #undef SUBSUBTARGET_EXTRA_SPECS
212 #define SUBSUBTARGET_EXTRA_SPECS \
213 { "asm_spec_common", ASM_SPEC_COMMON }, \
214 { "asm_spec32", ASM_SPEC32 }, \
215 { "asm_spec64", ASM_SPEC64 }, \
216 { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \
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 },
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
232 #ifndef LINK_OS_EXTRA_SPEC32
233 #define LINK_OS_EXTRA_SPEC32 ""
234 #endif
236 #ifndef LINK_OS_EXTRA_SPEC64
237 #define LINK_OS_EXTRA_SPEC64 ""
238 #endif
240 #ifndef LINK_OS_NEW_DTAGS_SPEC
241 #define LINK_OS_NEW_DTAGS_SPEC ""
242 #endif
244 #ifndef DYNAMIC_LINKER_PREFIX
245 #define DYNAMIC_LINKER_PREFIX ""
246 #endif
248 #if TARGET_IEEEQUAD_DEFAULT
249 #define MULTILIB_DEFAULTS_IEEE "mabi=ieeelongdouble"
251 #else /* TARGET_IEEEQUAD_DEFAULT. */
252 #define MULTILIB_DEFAULTS_IEEE "mabi=ibmlongdouble"
253 #endif /* TARGET_IEEEQUAD_DEFAULT. */
255 #undef MULTILIB_DEFAULTS
256 #if DEFAULT_ARCH64_P
257 #define MULTILIB_DEFAULTS { "m64", MULTILIB_DEFAULTS_IEEE }
258 #else
259 #define MULTILIB_DEFAULTS { "m32", MULTILIB_DEFAULTS_IEEE }
260 #endif
262 /* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */
263 #if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018
264 # ifndef RS6000_BI_ARCH
265 # define TARGET_CAN_SPLIT_STACK
266 # else
267 # if DEFAULT_ARCH64_P
268 /* Supported, and the default is -m64 */
269 # define TARGET_CAN_SPLIT_STACK_64BIT 1
270 # else
271 /* Supported, and the default is -m32 */
272 # define TARGET_CAN_SPLIT_STACK_64BIT 0
273 # endif
274 # endif
275 #endif
277 #ifndef RS6000_BI_ARCH
279 /* 64-bit PowerPC Linux always has a TOC. */
280 #undef TARGET_TOC
281 #define TARGET_TOC 1
283 /* Some things from sysv4.h we don't do when 64 bit. */
284 #undef OPTION_RELOCATABLE
285 #define OPTION_RELOCATABLE 0
286 #undef OPTION_EABI
287 #define OPTION_EABI 0
288 #undef OPTION_PROTOTYPE
289 #define OPTION_PROTOTYPE 0
290 #undef RELOCATABLE_NEEDS_FIXUP
291 #define RELOCATABLE_NEEDS_FIXUP 0
293 #endif
295 /* We use glibc _mcount for profiling. */
296 #define NO_PROFILE_COUNTERS 1
297 #define PROFILE_HOOK(LABEL) \
298 do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
300 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */
301 #undef ADJUST_FIELD_ALIGN
302 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
303 (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \
304 ? 128 \
305 : (TARGET_64BIT \
306 && TARGET_ALIGN_NATURAL == 0 \
307 && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \
308 ? MIN ((COMPUTED), 32) \
309 : (COMPUTED))
311 /* PowerPC64 Linux increases natural record alignment to doubleword if
312 the first field is an FP double, only if in power alignment mode. */
313 #undef ROUND_TYPE_ALIGN
314 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
315 ((TARGET_64BIT \
316 && (TREE_CODE (STRUCT) == RECORD_TYPE \
317 || TREE_CODE (STRUCT) == UNION_TYPE \
318 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
319 && TARGET_ALIGN_NATURAL == 0) \
320 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
321 : MAX ((COMPUTED), (SPECIFIED)))
323 /* Use the default for compiling target libs. */
324 #ifdef IN_TARGET_LIBS
325 #undef TARGET_ALIGN_NATURAL
326 #define TARGET_ALIGN_NATURAL 1
327 #endif
329 /* Indicate that jump tables go in the text section. */
330 #undef JUMP_TABLES_IN_TEXT_SECTION
331 #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
333 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
334 than a doubleword should be padded upward or downward. You could
335 reasonably assume that they follow the normal rules for structure
336 layout treating the parameter area as any other block of memory,
337 then map the reg param area to registers. i.e. pad upward.
338 Setting both of the following defines results in this behavior.
339 Setting just the first one will result in aggregates that fit in a
340 doubleword being padded downward, and others being padded upward.
341 Not a bad idea as this results in struct { int x; } being passed
342 the same way as an int. */
343 #define AGGREGATE_PADDING_FIXED TARGET_64BIT
344 #define AGGREGATES_PAD_UPWARD_ALWAYS 0
346 /* Specify padding for the last element of a block move between
347 registers and memory. FIRST is nonzero if this is the only
348 element. */
349 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
350 (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
352 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
353 process. */
354 #define OS_MISSING_POWERPC64 !TARGET_64BIT
356 #ifdef SINGLE_LIBC
357 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
358 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
359 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
360 #undef OPTION_MUSL
361 #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
362 #else
363 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
364 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
365 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
366 #undef OPTION_MUSL
367 #define OPTION_MUSL (linux_libc == LIBC_MUSL)
368 #endif
370 /* Determine what functions are present at the runtime;
371 this includes full c99 runtime and sincos. */
372 #undef TARGET_LIBC_HAS_FUNCTION
373 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
375 #undef TARGET_OS_CPP_BUILTINS
376 #define TARGET_OS_CPP_BUILTINS() \
377 do \
379 if (TARGET_64BIT) \
381 builtin_define ("__PPC__"); \
382 builtin_define ("__PPC64__"); \
383 builtin_define ("__powerpc__"); \
384 builtin_define ("__powerpc64__"); \
385 if (!DOT_SYMBOLS) \
386 builtin_define ("_CALL_LINUX"); \
387 builtin_assert ("cpu=powerpc64"); \
388 builtin_assert ("machine=powerpc64"); \
390 else \
392 builtin_define_std ("PPC"); \
393 builtin_define_std ("powerpc"); \
394 builtin_assert ("cpu=powerpc"); \
395 builtin_assert ("machine=powerpc"); \
396 TARGET_OS_SYSV_CPP_BUILTINS (); \
399 while (0)
401 #undef CPP_OS_DEFAULT_SPEC
402 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
404 #undef LINK_SHLIB_SPEC
405 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
406 %{static-pie:-static -pie --no-dynamic-linker -z text}"
408 #undef LIB_DEFAULT_SPEC
409 #define LIB_DEFAULT_SPEC "%(lib_linux)"
411 #undef STARTFILE_DEFAULT_SPEC
412 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
414 #undef ENDFILE_DEFAULT_SPEC
415 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
417 #undef LINK_START_DEFAULT_SPEC
418 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
420 #undef LINK_OS_DEFAULT_SPEC
421 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
423 #define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
425 #ifdef LINUX64_DEFAULT_ABI_ELFv2
426 #define GLIBC_DYNAMIC_LINKER64 \
427 "%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
428 ":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
429 #else
430 #define GLIBC_DYNAMIC_LINKER64 \
431 "%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
432 ":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
433 #endif
435 #define MUSL_DYNAMIC_LINKER32 \
436 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
437 #define MUSL_DYNAMIC_LINKER64 \
438 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
440 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
441 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
442 #if DEFAULT_LIBC == LIBC_UCLIBC
443 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
444 "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
445 #elif DEFAULT_LIBC == LIBC_GLIBC
446 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
447 "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
448 #elif DEFAULT_LIBC == LIBC_MUSL
449 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
450 "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
451 #else
452 #error "Unsupported DEFAULT_LIBC"
453 #endif
454 #define GNU_USER_DYNAMIC_LINKER32 \
455 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
456 MUSL_DYNAMIC_LINKER32)
457 #define GNU_USER_DYNAMIC_LINKER64 \
458 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
459 MUSL_DYNAMIC_LINKER64)
461 #undef DEFAULT_ASM_ENDIAN
462 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
463 #define DEFAULT_ASM_ENDIAN " -mlittle"
464 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
465 " -m elf32lppclinux", \
466 " -m elf32lppclinux")
467 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
468 " -m elf64lppc", \
469 " -m elf64lppc")
470 #else
471 #define DEFAULT_ASM_ENDIAN " -mbig"
472 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
473 " -m elf32lppclinux", \
474 " -m elf32ppclinux")
475 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
476 " -m elf64lppc", \
477 " -m elf64ppc")
478 #endif
480 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
481 %{!static-pie: \
482 %{rdynamic:-export-dynamic} \
483 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
484 %(link_os_extra_spec32)"
486 #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
487 %{!static-pie: \
488 %{rdynamic:-export-dynamic} \
489 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
490 %(link_os_extra_spec64)"
492 #undef TOC_SECTION_ASM_OP
493 #define TOC_SECTION_ASM_OP \
494 (TARGET_64BIT \
495 ? "\t.section\t\".toc\",\"aw\"" \
496 : "\t.section\t\".got\",\"aw\"")
498 #undef MINIMAL_TOC_SECTION_ASM_OP
499 #define MINIMAL_TOC_SECTION_ASM_OP \
500 (TARGET_64BIT \
501 ? "\t.section\t\".toc1\",\"aw\"" \
502 : (flag_pic \
503 ? "\t.section\t\".got2\",\"aw\"" \
504 : "\t.section\t\".got1\",\"aw\""))
506 /* Must be at least as big as our pointer type. */
507 #undef SIZE_TYPE
508 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
510 #undef PTRDIFF_TYPE
511 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
513 #undef WCHAR_TYPE
514 #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
515 #undef WCHAR_TYPE_SIZE
516 #define WCHAR_TYPE_SIZE 32
518 #undef RS6000_MCOUNT
519 #define RS6000_MCOUNT "_mcount"
521 #ifdef __powerpc64__
522 /* _init and _fini functions are built from bits spread across many
523 object files, each potentially with a different TOC pointer. For
524 that reason, place a nop after the call so that the linker can
525 restore the TOC pointer if a TOC adjusting call stub is needed. */
526 #if DOT_SYMBOLS
527 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
528 asm (SECTION_OP "\n" \
529 " bl ." #FUNC "\n" \
530 " nop\n" \
531 " .previous");
532 #else
533 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
534 asm (SECTION_OP "\n" \
535 " bl " #FUNC "\n" \
536 " nop\n" \
537 " .previous");
538 #endif
539 #endif
541 /* FP save and restore routines. */
542 #undef SAVE_FP_PREFIX
543 #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
544 #undef SAVE_FP_SUFFIX
545 #define SAVE_FP_SUFFIX ""
546 #undef RESTORE_FP_PREFIX
547 #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
548 #undef RESTORE_FP_SUFFIX
549 #define RESTORE_FP_SUFFIX ""
551 /* Dwarf2 debugging. */
552 #undef PREFERRED_DEBUGGING_TYPE
553 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
555 /* This is how to declare the size of a function. */
556 #undef ASM_DECLARE_FUNCTION_SIZE
557 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
558 do \
560 if (!flag_inhibit_size_directive) \
562 fputs ("\t.size\t", (FILE)); \
563 if (TARGET_64BIT && DOT_SYMBOLS) \
564 putc ('.', (FILE)); \
565 assemble_name ((FILE), (FNAME)); \
566 fputs (",.-", (FILE)); \
567 rs6000_output_function_entry (FILE, FNAME); \
568 putc ('\n', (FILE)); \
571 while (0)
573 /* Return nonzero if this entry is to be written into the constant
574 pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
575 or a CONST containing one of them. If -mfp-in-toc (the default),
576 we also do this for floating-point constants. We actually can only
577 do this if the FP formats of the target and host machines are the
578 same, but we can't check that since not every file that uses
579 the macros includes real.h. We also do this when we can write the
580 entry into the TOC and the entry is not larger than a TOC entry. */
582 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
583 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
584 (TARGET_TOC \
585 && (GET_CODE (X) == SYMBOL_REF \
586 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
587 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
588 || GET_CODE (X) == LABEL_REF \
589 || (GET_CODE (X) == CONST_INT \
590 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
591 || (GET_CODE (X) == CONST_DOUBLE \
592 && ((TARGET_64BIT \
593 && (TARGET_MINIMAL_TOC \
594 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
595 && ! TARGET_NO_FP_IN_TOC))) \
596 || (!TARGET_64BIT \
597 && !TARGET_NO_FP_IN_TOC \
598 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
599 && BITS_PER_WORD == HOST_BITS_PER_INT)))))
601 /* Select a format to encode pointers in exception handling data. CODE
602 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
603 true if the symbol may be affected by dynamic relocations. */
604 #undef ASM_PREFERRED_EH_DATA_FORMAT
605 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
606 (TARGET_64BIT || flag_pic \
607 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
608 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \
609 : DW_EH_PE_absptr)
611 /* For backward compatibility, we must continue to use the AIX
612 structure return convention. */
613 #undef DRAFT_V4_STRUCT_RET
614 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
616 #ifdef TARGET_LIBC_PROVIDES_SSP
617 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
618 ppc64 glibc provides it at -0x7010(13). */
619 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
620 #endif
622 #define POWERPC_LINUX
624 /* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
625 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
626 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
627 #endif
629 /* Static stack checking is supported by means of probes. */
630 #define STACK_CHECK_STATIC_BUILTIN 1
632 /* The default value isn't sufficient in 64-bit mode. */
633 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
635 /* Software floating point support for exceptions and rounding modes
636 depends on the C library in use. */
637 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
638 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
639 rs6000_linux_float_exceptions_rounding_supported_p
641 /* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
642 on glibc 2.19 or greater. */
643 #if TARGET_GLIBC_MAJOR > 2 \
644 || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
645 #define RS6000_GLIBC_ATOMIC_FENV 1
646 #endif
648 /* The IEEE 128-bit emulator is only built on Linux systems. Flag that we
649 should enable the type handling for KFmode on VSX systems even if we are not
650 enabling the __float128 keyword. */
651 #undef TARGET_FLOAT128_ENABLE_TYPE
652 #define TARGET_FLOAT128_ENABLE_TYPE 1