predicates.md (cint34_operand): Update SIGNED_34BIT_OFFSET_P call.
[official-gcc.git] / gcc / config / rs6000 / linux64.h
blob5380f6a6a6f1cb3e8d9734f5037646ecafa02fee
1 /* Definitions of target machine for GNU compiler,
2 for 64 bit PowerPC linux.
3 Copyright (C) 2000-2019 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; \
158 if (TARGET_PLTSEQ && DEFAULT_ABI != ABI_ELFv2) \
160 if (global_options_set.x_rs6000_pltseq) \
161 warning (0, "%qs unsupported for this ABI", \
162 "-mpltseq"); \
163 rs6000_pltseq = false; \
166 else \
168 if (!RS6000_BI_ARCH_P) \
169 error (INVALID_32BIT, "32"); \
170 if (TARGET_PROFILE_KERNEL) \
172 TARGET_PROFILE_KERNEL = 0; \
173 error (INVALID_32BIT, "profile-kernel"); \
175 if (global_options_set.x_rs6000_current_cmodel) \
177 SET_CMODEL (CMODEL_SMALL); \
178 error (INVALID_32BIT, "cmodel"); \
182 while (0)
184 #undef ASM_DEFAULT_SPEC
185 #undef ASM_SPEC
186 #undef LINK_OS_LINUX_SPEC
187 #undef LINK_SECURE_PLT_SPEC
189 #ifndef RS6000_BI_ARCH
190 #define ASM_DEFAULT_SPEC "-mppc64"
191 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
192 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
193 #define LINK_SECURE_PLT_SPEC ""
194 #else
195 #if DEFAULT_ARCH64_P
196 #define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
197 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
198 #define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
199 #define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
200 #else
201 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
202 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
203 #define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
204 #define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
205 #endif
206 #endif
208 #define ASM_SPEC32 "-a32 \
209 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
210 %{memb|msdata=eabi: -memb}"
212 #define ASM_SPEC64 "-a64"
214 #define ASM_SPEC_COMMON "%(asm_cpu) \
215 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
216 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
218 #undef SUBSUBTARGET_EXTRA_SPECS
219 #define SUBSUBTARGET_EXTRA_SPECS \
220 { "asm_spec_common", ASM_SPEC_COMMON }, \
221 { "asm_spec32", ASM_SPEC32 }, \
222 { "asm_spec64", ASM_SPEC64 }, \
223 { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \
224 { "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 }, \
225 { "link_os_extra_spec32", LINK_OS_EXTRA_SPEC32 }, \
226 { "link_os_extra_spec64", LINK_OS_EXTRA_SPEC64 }, \
227 { "link_os_new_dtags", LINK_OS_NEW_DTAGS_SPEC }, \
228 { "include_extra", INCLUDE_EXTRA_SPEC }, \
229 { "dynamic_linker_prefix", DYNAMIC_LINKER_PREFIX },
231 /* Optional specs used for overriding the system include directory, default
232 -rpath links, and prefix for the dynamic linker. Normally, there are not
233 defined, but if the user configure with the --with-advance-toolchain=<xxx>
234 option, the advance-toolchain.h file will override these. */
235 #ifndef INCLUDE_EXTRA_SPEC
236 #define INCLUDE_EXTRA_SPEC ""
237 #endif
239 #ifndef LINK_OS_EXTRA_SPEC32
240 #define LINK_OS_EXTRA_SPEC32 ""
241 #endif
243 #ifndef LINK_OS_EXTRA_SPEC64
244 #define LINK_OS_EXTRA_SPEC64 ""
245 #endif
247 #ifndef LINK_OS_NEW_DTAGS_SPEC
248 #define LINK_OS_NEW_DTAGS_SPEC ""
249 #endif
251 #ifndef DYNAMIC_LINKER_PREFIX
252 #define DYNAMIC_LINKER_PREFIX ""
253 #endif
255 #undef MULTILIB_DEFAULTS
256 #if DEFAULT_ARCH64_P
257 #define MULTILIB_DEFAULTS { "m64" }
258 #else
259 #define MULTILIB_DEFAULTS { "m32" }
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 (strcmp (rs6000_abi_name, "linux") == 0) \
380 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
381 if (TARGET_64BIT) \
383 builtin_define ("__PPC__"); \
384 builtin_define ("__PPC64__"); \
385 builtin_define ("__powerpc__"); \
386 builtin_define ("__powerpc64__"); \
387 if (!DOT_SYMBOLS) \
388 builtin_define ("_CALL_LINUX"); \
389 builtin_assert ("cpu=powerpc64"); \
390 builtin_assert ("machine=powerpc64"); \
392 else \
394 builtin_define_std ("PPC"); \
395 builtin_define_std ("powerpc"); \
396 builtin_assert ("cpu=powerpc"); \
397 builtin_assert ("machine=powerpc"); \
398 TARGET_OS_SYSV_CPP_BUILTINS (); \
401 while (0)
403 #define GNU_USER_TARGET_D_OS_VERSIONS() \
404 do { \
405 builtin_version ("linux"); \
406 if (OPTION_GLIBC) \
407 builtin_version ("CRuntime_Glibc"); \
408 else if (OPTION_UCLIBC) \
409 builtin_version ("CRuntime_UClibc"); \
410 else if (OPTION_BIONIC) \
411 builtin_version ("CRuntime_Bionic"); \
412 else if (OPTION_MUSL) \
413 builtin_version ("CRuntime_Musl"); \
414 } while (0)
416 #undef CPP_OS_DEFAULT_SPEC
417 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
419 #undef LINK_SHLIB_SPEC
420 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
421 %{static-pie:-static -pie --no-dynamic-linker -z text}"
423 #undef LIB_DEFAULT_SPEC
424 #define LIB_DEFAULT_SPEC "%(lib_linux)"
426 #undef STARTFILE_DEFAULT_SPEC
427 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
429 #undef ENDFILE_DEFAULT_SPEC
430 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
432 #undef LINK_START_DEFAULT_SPEC
433 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
435 #undef LINK_OS_DEFAULT_SPEC
436 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
438 #define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
440 #ifdef LINUX64_DEFAULT_ABI_ELFv2
441 #define GLIBC_DYNAMIC_LINKER64 \
442 "%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
443 ":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
444 #else
445 #define GLIBC_DYNAMIC_LINKER64 \
446 "%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
447 ":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
448 #endif
450 #undef MUSL_DYNAMIC_LINKER32
451 #define MUSL_DYNAMIC_LINKER32 \
452 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
453 #undef MUSL_DYNAMIC_LINKER64
454 #define MUSL_DYNAMIC_LINKER64 \
455 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
457 #undef DEFAULT_ASM_ENDIAN
458 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
459 #define DEFAULT_ASM_ENDIAN " -mlittle"
460 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
461 " -m elf32lppclinux", \
462 " -m elf32lppclinux")
463 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
464 " -m elf64lppc", \
465 " -m elf64lppc")
466 #else
467 #define DEFAULT_ASM_ENDIAN " -mbig"
468 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
469 " -m elf32lppclinux", \
470 " -m elf32ppclinux")
471 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
472 " -m elf64lppc", \
473 " -m elf64ppc")
474 #endif
476 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
477 %{!static-pie: \
478 %{rdynamic:-export-dynamic} \
479 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
480 %(link_os_extra_spec32)"
482 #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
483 %{!static-pie: \
484 %{rdynamic:-export-dynamic} \
485 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
486 %(link_os_extra_spec64)"
488 /* Use gnu-user.h LINK_GCC_SEQUENCE_SPEC for linux. */
489 #undef LINK_GCC_C_SEQUENCE_SPEC
490 #define LINK_GCC_C_SEQUENCE_SPEC \
491 "%{mads|myellowknife|mmvme|msim:%G %L %G;" \
492 "!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \
493 ":%G %L %G}"
495 #undef TOC_SECTION_ASM_OP
496 #define TOC_SECTION_ASM_OP \
497 (TARGET_64BIT \
498 ? "\t.section\t\".toc\",\"aw\"" \
499 : "\t.section\t\".got\",\"aw\"")
501 #undef MINIMAL_TOC_SECTION_ASM_OP
502 #define MINIMAL_TOC_SECTION_ASM_OP \
503 (TARGET_64BIT \
504 ? "\t.section\t\".toc1\",\"aw\"" \
505 : (flag_pic \
506 ? "\t.section\t\".got2\",\"aw\"" \
507 : "\t.section\t\".got1\",\"aw\""))
509 /* Must be at least as big as our pointer type. */
510 #undef SIZE_TYPE
511 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
513 #undef PTRDIFF_TYPE
514 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
516 #undef WCHAR_TYPE
517 #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
518 #undef WCHAR_TYPE_SIZE
519 #define WCHAR_TYPE_SIZE 32
521 #undef RS6000_MCOUNT
522 #define RS6000_MCOUNT "_mcount"
524 #ifdef __powerpc64__
525 /* _init and _fini functions are built from bits spread across many
526 object files, each potentially with a different TOC pointer. For
527 that reason, place a nop after the call so that the linker can
528 restore the TOC pointer if a TOC adjusting call stub is needed. */
529 #if DOT_SYMBOLS
530 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
531 asm (SECTION_OP "\n" \
532 " bl ." #FUNC "\n" \
533 " nop\n" \
534 " .previous");
535 #else
536 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
537 asm (SECTION_OP "\n" \
538 " bl " #FUNC "\n" \
539 " nop\n" \
540 " .previous");
541 #endif
542 #endif
544 /* FP save and restore routines. */
545 #undef SAVE_FP_PREFIX
546 #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
547 #undef SAVE_FP_SUFFIX
548 #define SAVE_FP_SUFFIX ""
549 #undef RESTORE_FP_PREFIX
550 #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
551 #undef RESTORE_FP_SUFFIX
552 #define RESTORE_FP_SUFFIX ""
554 /* Dwarf2 debugging. */
555 #undef PREFERRED_DEBUGGING_TYPE
556 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
558 /* This is how to declare the size of a function. */
559 #undef ASM_DECLARE_FUNCTION_SIZE
560 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
561 do \
563 if (!flag_inhibit_size_directive) \
565 fputs ("\t.size\t", (FILE)); \
566 if (TARGET_64BIT && DOT_SYMBOLS) \
567 putc ('.', (FILE)); \
568 assemble_name ((FILE), (FNAME)); \
569 fputs (",.-", (FILE)); \
570 rs6000_output_function_entry (FILE, FNAME); \
571 putc ('\n', (FILE)); \
574 while (0)
576 /* Return nonzero if this entry is to be written into the constant
577 pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
578 or a CONST containing one of them. If -mfp-in-toc (the default),
579 we also do this for floating-point constants. We actually can only
580 do this if the FP formats of the target and host machines are the
581 same, but we can't check that since not every file that uses
582 the macros includes real.h. We also do this when we can write an
583 integer into the TOC and the entry is not larger than a TOC entry,
584 but not for -mcmodel=medium where we'll use a toc-relative load for
585 constants outside the TOC. */
587 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
588 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
589 (TARGET_TOC \
590 && (SYMBOL_REF_P (X) \
591 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
592 && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0))) \
593 || GET_CODE (X) == LABEL_REF \
594 || (CONST_INT_P (X) \
595 && TARGET_CMODEL != CMODEL_MEDIUM \
596 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
597 || (CONST_DOUBLE_P (X) \
598 && ((TARGET_64BIT \
599 && (TARGET_MINIMAL_TOC \
600 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
601 && ! TARGET_NO_FP_IN_TOC))) \
602 || (!TARGET_64BIT \
603 && !TARGET_NO_FP_IN_TOC \
604 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
605 && BITS_PER_WORD == HOST_BITS_PER_INT)))))
607 /* Select a format to encode pointers in exception handling data. CODE
608 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
609 true if the symbol may be affected by dynamic relocations. */
610 #undef ASM_PREFERRED_EH_DATA_FORMAT
611 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
612 (TARGET_64BIT || flag_pic \
613 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
614 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \
615 : DW_EH_PE_absptr)
617 /* For backward compatibility, we must continue to use the AIX
618 structure return convention. */
619 #undef DRAFT_V4_STRUCT_RET
620 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
622 #ifdef TARGET_LIBC_PROVIDES_SSP
623 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
624 ppc64 glibc provides it at -0x7010(13). */
625 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
626 #endif
628 #define POWERPC_LINUX
630 /* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
631 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
632 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
633 #endif
635 /* Static stack checking is supported by means of probes. */
636 #define STACK_CHECK_STATIC_BUILTIN 1
638 /* The default value isn't sufficient in 64-bit mode. */
639 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
641 /* Software floating point support for exceptions and rounding modes
642 depends on the C library in use. */
643 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
644 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
645 rs6000_linux_float_exceptions_rounding_supported_p
647 /* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
648 on glibc 2.19 or greater. */
649 #if TARGET_GLIBC_MAJOR > 2 \
650 || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
651 #define RS6000_GLIBC_ATOMIC_FENV 1
652 #endif
654 /* The IEEE 128-bit emulator is only built on Linux systems. Flag that we
655 should enable the type handling for KFmode on VSX systems even if we are not
656 enabling the __float128 keyword. */
657 #undef TARGET_FLOAT128_ENABLE_TYPE
658 #define TARGET_FLOAT128_ENABLE_TYPE 1