]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/linux64.h
655d1054d76ad010b0b0f90886c7dd9d0af069da
[thirdparty/gcc.git] / gcc / config / rs6000 / linux64.h
1 /* Definitions of target machine for GNU compiler,
2 for 64 bit PowerPC linux.
3 Copyright (C) 2000-2024 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
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.
11
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.
16
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.
20
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/>. */
25
26 #ifndef RS6000_BI_ARCH
27
28 #undef TARGET_64BIT
29 #define TARGET_64BIT 1
30
31 #define DEFAULT_ARCH64_P 1
32 #define RS6000_BI_ARCH_P 0
33
34 #else
35
36 #define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
37 #define RS6000_BI_ARCH_P 1
38
39 #endif
40
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
49
50 #undef TARGET_AIX
51 #define TARGET_AIX TARGET_64BIT
52
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
59
60 #define TARGET_PROFILE_KERNEL profile_kernel
61
62 #undef TARGET_KEEP_LEAF_WHEN_PROFILED
63 #define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled
64
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
73
74 #undef PROCESSOR_DEFAULT
75 #define PROCESSOR_DEFAULT PROCESSOR_POWER7
76 #undef PROCESSOR_DEFAULT64
77 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
78
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)
84
85 #undef RS6000_ABI_NAME
86 #define RS6000_ABI_NAME "linux"
87
88 #define INVALID_64BIT "%<-m%s%> not supported in this configuration"
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
96
97 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
98 #define SUBSUBTARGET_OVERRIDE_OPTIONS \
99 do rs6000_linux64_override_options (); while (0)
100
101 #undef ASM_SPEC
102 #undef LINK_OS_LINUX_SPEC
103 #undef LINK_SECURE_PLT_SPEC
104
105 #ifndef RS6000_BI_ARCH
106 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
107 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
108 #define LINK_SECURE_PLT_SPEC ""
109 #else
110 #if DEFAULT_ARCH64_P
111 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
112 #define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
113 #define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
114 #else
115 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
116 #define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
117 #define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
118 #endif
119 #endif
120
121 #define ASM_SPEC32 "-a32 \
122 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
123 %{memb|msdata=eabi: -memb}"
124
125 #define ASM_SPEC64 "-a64"
126
127 #define ASM_SPEC_COMMON "%(asm_cpu) \
128 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
129 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
130
131 #undef SUBSUBTARGET_EXTRA_SPECS
132 #define SUBSUBTARGET_EXTRA_SPECS \
133 { "asm_spec_common", ASM_SPEC_COMMON }, \
134 { "asm_spec32", ASM_SPEC32 }, \
135 { "asm_spec64", ASM_SPEC64 }, \
136 { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \
137 { "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 }, \
138 { "link_os_extra_spec32", LINK_OS_EXTRA_SPEC32 }, \
139 { "link_os_extra_spec64", LINK_OS_EXTRA_SPEC64 }, \
140 { "link_os_new_dtags", LINK_OS_NEW_DTAGS_SPEC }, \
141 { "include_extra", INCLUDE_EXTRA_SPEC }, \
142 { "dynamic_linker_prefix", DYNAMIC_LINKER_PREFIX },
143
144 /* Optional specs used for overriding the system include directory, default
145 -rpath links, and prefix for the dynamic linker. Normally, there are not
146 defined, but if the user configure with the --with-advance-toolchain=<xxx>
147 option, the advance-toolchain.h file will override these. */
148 #ifndef INCLUDE_EXTRA_SPEC
149 #define INCLUDE_EXTRA_SPEC ""
150 #endif
151
152 #ifndef LINK_OS_EXTRA_SPEC32
153 #define LINK_OS_EXTRA_SPEC32 ""
154 #endif
155
156 #ifndef LINK_OS_EXTRA_SPEC64
157 #define LINK_OS_EXTRA_SPEC64 ""
158 #endif
159
160 #ifndef LINK_OS_NEW_DTAGS_SPEC
161 #define LINK_OS_NEW_DTAGS_SPEC ""
162 #endif
163
164 #ifndef DYNAMIC_LINKER_PREFIX
165 #define DYNAMIC_LINKER_PREFIX ""
166 #endif
167
168 #undef MULTILIB_DEFAULTS
169 #if DEFAULT_ARCH64_P
170 #define MULTILIB_DEFAULTS { "m64" }
171 #else
172 #define MULTILIB_DEFAULTS { "m32" }
173 #endif
174
175 /* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */
176 #if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018
177 # ifndef RS6000_BI_ARCH
178 # define TARGET_CAN_SPLIT_STACK
179 # else
180 # if DEFAULT_ARCH64_P
181 /* Supported, and the default is -m64 */
182 # define TARGET_CAN_SPLIT_STACK_64BIT 1
183 # else
184 /* Supported, and the default is -m32 */
185 # define TARGET_CAN_SPLIT_STACK_64BIT 0
186 # endif
187 # endif
188 #endif
189
190 #ifndef RS6000_BI_ARCH
191
192 /* 64-bit PowerPC Linux always has a TOC. */
193 #undef TARGET_HAS_TOC
194 #define TARGET_HAS_TOC 1
195
196 /* Some things from sysv4.h we don't do when 64 bit. */
197 #undef OPTION_RELOCATABLE
198 #define OPTION_RELOCATABLE 0
199 #undef OPTION_EABI
200 #define OPTION_EABI 0
201 #undef OPTION_PROTOTYPE
202 #define OPTION_PROTOTYPE 0
203 #undef RELOCATABLE_NEEDS_FIXUP
204 #define RELOCATABLE_NEEDS_FIXUP 0
205
206 #endif
207
208 /* We use glibc _mcount for profiling. */
209 #define NO_PROFILE_COUNTERS 1
210 #define PROFILE_HOOK(LABEL) \
211 do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
212
213 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */
214 #undef ADJUST_FIELD_ALIGN
215 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
216 ((TARGET_64BIT \
217 && TARGET_ALIGN_NATURAL == 0 \
218 && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \
219 ? MIN ((COMPUTED), 32) \
220 : (COMPUTED))
221
222 /* PowerPC64 Linux increases natural record alignment to doubleword if
223 the first field is an FP double, only if in power alignment mode. */
224 #undef ROUND_TYPE_ALIGN
225 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
226 ((TARGET_64BIT \
227 && RECORD_OR_UNION_TYPE_P (STRUCT) \
228 && TARGET_ALIGN_NATURAL == 0) \
229 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
230 : MAX ((COMPUTED), (SPECIFIED)))
231
232 /* Use the default for compiling target libs. */
233 #ifdef IN_TARGET_LIBS
234 #undef TARGET_ALIGN_NATURAL
235 #define TARGET_ALIGN_NATURAL 1
236 #endif
237
238 /* Indicate that jump tables go in the text section. */
239 #undef JUMP_TABLES_IN_TEXT_SECTION
240 #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
241
242 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
243 than a doubleword should be padded upward or downward. You could
244 reasonably assume that they follow the normal rules for structure
245 layout treating the parameter area as any other block of memory,
246 then map the reg param area to registers. i.e. pad upward.
247 Setting both of the following defines results in this behavior.
248 Setting just the first one will result in aggregates that fit in a
249 doubleword being padded downward, and others being padded upward.
250 Not a bad idea as this results in struct { int x; } being passed
251 the same way as an int. */
252 #define AGGREGATE_PADDING_FIXED TARGET_64BIT
253 #define AGGREGATES_PAD_UPWARD_ALWAYS 0
254
255 /* Specify padding for the last element of a block move between
256 registers and memory. FIRST is nonzero if this is the only
257 element. */
258 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
259 (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
260
261 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
262 process. */
263 #define OS_MISSING_POWERPC64 !TARGET_64BIT
264
265 #ifdef SINGLE_LIBC
266 #define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC)
267 #define OPTION_UCLIBC_P(opts) (DEFAULT_LIBC == LIBC_UCLIBC)
268 #define OPTION_BIONIC_P(opts) (DEFAULT_LIBC == LIBC_BIONIC)
269 #undef OPTION_MUSL_P
270 #define OPTION_MUSL_P(opts) (DEFAULT_LIBC == LIBC_MUSL)
271 #else
272 #define OPTION_GLIBC_P(opts) ((opts)->x_linux_libc == LIBC_GLIBC)
273 #define OPTION_UCLIBC_P(opts) ((opts)->x_linux_libc == LIBC_UCLIBC)
274 #define OPTION_BIONIC_P(opts) ((opts)->x_linux_libc == LIBC_BIONIC)
275 #undef OPTION_MUSL_P
276 #define OPTION_MUSL_P(opts) ((opts)->x_linux_libc == LIBC_MUSL)
277 #endif
278 #define OPTION_GLIBC OPTION_GLIBC_P (&global_options)
279 #define OPTION_UCLIBC OPTION_UCLIBC_P (&global_options)
280 #define OPTION_BIONIC OPTION_BIONIC_P (&global_options)
281 #undef OPTION_MUSL
282 #define OPTION_MUSL OPTION_MUSL_P (&global_options)
283
284 /* Determine what functions are present at the runtime;
285 this includes full c99 runtime and sincos. */
286 #undef TARGET_LIBC_HAS_FUNCTION
287 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
288
289 #undef TARGET_LIBM_FUNCTION_MAX_ERROR
290 #define TARGET_LIBM_FUNCTION_MAX_ERROR rs6000_linux_libm_function_max_error
291
292 #undef TARGET_OS_CPP_BUILTINS
293 #define TARGET_OS_CPP_BUILTINS() \
294 do \
295 { \
296 if (strcmp (rs6000_abi_name, "linux") == 0 \
297 || strcmp (rs6000_abi_name, "aixdesc") == 0) \
298 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
299 if (TARGET_64BIT) \
300 { \
301 builtin_define ("__PPC__"); \
302 builtin_define ("__PPC64__"); \
303 builtin_define ("__powerpc__"); \
304 builtin_define ("__powerpc64__"); \
305 if (!DOT_SYMBOLS) \
306 builtin_define ("_CALL_LINUX"); \
307 builtin_assert ("cpu=powerpc64"); \
308 builtin_assert ("machine=powerpc64"); \
309 } \
310 else \
311 { \
312 builtin_define_std ("PPC"); \
313 builtin_define_std ("powerpc"); \
314 builtin_assert ("cpu=powerpc"); \
315 builtin_assert ("machine=powerpc"); \
316 TARGET_OS_SYSV_CPP_BUILTINS (); \
317 } \
318 } \
319 while (0)
320
321 #undef CPP_OS_DEFAULT_SPEC
322 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
323
324 #undef LINK_SHLIB_SPEC
325 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
326 %{static-pie:-static -pie --no-dynamic-linker -z text}"
327
328 #undef LIB_DEFAULT_SPEC
329 #define LIB_DEFAULT_SPEC "%(lib_linux)"
330
331 #undef STARTFILE_DEFAULT_SPEC
332 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
333
334 #undef ENDFILE_DEFAULT_SPEC
335 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
336
337 #undef LINK_START_DEFAULT_SPEC
338 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
339
340 #undef LINK_OS_DEFAULT_SPEC
341 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
342
343 #define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
344
345 #ifdef LINUX64_DEFAULT_ABI_ELFv2
346 #define GLIBC_DYNAMIC_LINKER64 \
347 "%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
348 ":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
349 #else
350 #define GLIBC_DYNAMIC_LINKER64 \
351 "%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
352 ":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
353 #endif
354
355 #undef MUSL_DYNAMIC_LINKER32
356 #define MUSL_DYNAMIC_LINKER32 \
357 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
358 #undef MUSL_DYNAMIC_LINKER64
359 #define MUSL_DYNAMIC_LINKER64 \
360 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
361
362 #undef DEFAULT_ASM_ENDIAN
363 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
364 #define DEFAULT_ASM_ENDIAN " -mlittle"
365 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
366 " -m elf32lppclinux", \
367 " -m elf32lppclinux")
368 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
369 " -m elf64lppc", \
370 " -m elf64lppc")
371 #else
372 #define DEFAULT_ASM_ENDIAN " -mbig"
373 #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
374 " -m elf32lppclinux", \
375 " -m elf32ppclinux")
376 #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
377 " -m elf64lppc", \
378 " -m elf64ppc")
379 #endif
380
381 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
382 %{!static-pie: \
383 %{rdynamic:-export-dynamic} \
384 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
385 %(link_os_extra_spec32)"
386
387 #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
388 %{!static-pie: \
389 %{rdynamic:-export-dynamic} \
390 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
391 %(link_os_extra_spec64)"
392
393 /* Use gnu-user.h LINK_GCC_SEQUENCE_SPEC for linux. */
394 #undef LINK_GCC_C_SEQUENCE_SPEC
395 #define LINK_GCC_C_SEQUENCE_SPEC \
396 "%{mads|myellowknife|mmvme|msim:%G %L %G;" \
397 "!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \
398 ":%G %L %G}"
399
400 #undef TOC_SECTION_ASM_OP
401 #define TOC_SECTION_ASM_OP \
402 (TARGET_64BIT \
403 ? "\t.section\t\".toc\",\"aw\"" \
404 : "\t.section\t\".got\",\"aw\"")
405
406 #undef MINIMAL_TOC_SECTION_ASM_OP
407 #define MINIMAL_TOC_SECTION_ASM_OP \
408 (TARGET_64BIT \
409 ? "\t.section\t\".toc1\",\"aw\"" \
410 : (flag_pic \
411 ? "\t.section\t\".got2\",\"aw\"" \
412 : "\t.section\t\".got1\",\"aw\""))
413
414 /* Must be at least as big as our pointer type. */
415 #undef SIZE_TYPE
416 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
417
418 #undef PTRDIFF_TYPE
419 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
420
421 #undef WCHAR_TYPE
422 #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
423 #undef WCHAR_TYPE_SIZE
424 #define WCHAR_TYPE_SIZE 32
425
426 #undef RS6000_MCOUNT
427 #define RS6000_MCOUNT "_mcount"
428
429 #ifdef __powerpc64__
430 /* _init and _fini functions are built from bits spread across many
431 object files, each potentially with a different TOC pointer. For
432 that reason, place a nop after the call so that the linker can
433 restore the TOC pointer if a TOC adjusting call stub is needed. */
434 #if DOT_SYMBOLS
435 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
436 asm (SECTION_OP "\n" \
437 " bl ." #FUNC "\n" \
438 " nop\n" \
439 " .previous");
440 #else
441 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
442 asm (SECTION_OP "\n" \
443 " bl " #FUNC "\n" \
444 " nop\n" \
445 " .previous");
446 #endif
447 #endif
448
449 /* FP save and restore routines. */
450 #undef SAVE_FP_PREFIX
451 #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
452 #undef SAVE_FP_SUFFIX
453 #define SAVE_FP_SUFFIX ""
454 #undef RESTORE_FP_PREFIX
455 #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
456 #undef RESTORE_FP_SUFFIX
457 #define RESTORE_FP_SUFFIX ""
458
459 /* Dwarf2 debugging. */
460 #undef PREFERRED_DEBUGGING_TYPE
461 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
462
463 /* This is how to declare the size of a function. */
464 #undef ASM_DECLARE_FUNCTION_SIZE
465 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
466 do \
467 { \
468 if (!flag_inhibit_size_directive) \
469 { \
470 fputs ("\t.size\t", (FILE)); \
471 if (TARGET_64BIT && DOT_SYMBOLS) \
472 putc ('.', (FILE)); \
473 assemble_name ((FILE), (FNAME)); \
474 fputs (",.-", (FILE)); \
475 rs6000_output_function_entry (FILE, FNAME); \
476 putc ('\n', (FILE)); \
477 } \
478 } \
479 while (0)
480
481 /* Return nonzero if this entry is to be written into the constant
482 pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
483 or a CONST containing one of them. If -mfp-in-toc (the default),
484 we also do this for floating-point constants. We actually can only
485 do this if the FP formats of the target and host machines are the
486 same, but we can't check that since not every file that uses
487 the macros includes real.h. We also do this when we can write an
488 integer into the TOC and the entry is not larger than a TOC entry,
489 but not for -mcmodel=medium where we'll use a toc-relative load for
490 constants outside the TOC. */
491
492 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
493 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
494 (TARGET_TOC \
495 && (SYMBOL_REF_P (X) \
496 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
497 && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0))) \
498 || GET_CODE (X) == LABEL_REF \
499 || (CONST_INT_P (X) \
500 && TARGET_CMODEL != CMODEL_MEDIUM \
501 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
502 || (CONST_DOUBLE_P (X) \
503 && ((TARGET_64BIT \
504 && (TARGET_MINIMAL_TOC \
505 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
506 && ! TARGET_NO_FP_IN_TOC))) \
507 || (!TARGET_64BIT \
508 && !TARGET_NO_FP_IN_TOC \
509 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
510 && BITS_PER_WORD == HOST_BITS_PER_INT)))))
511
512 /* Select a format to encode pointers in exception handling data. CODE
513 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
514 true if the symbol may be affected by dynamic relocations. */
515 #undef ASM_PREFERRED_EH_DATA_FORMAT
516 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
517 (TARGET_64BIT || flag_pic \
518 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
519 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \
520 : DW_EH_PE_absptr)
521
522 /* For backward compatibility, we must continue to use the AIX
523 structure return convention. */
524 #undef DRAFT_V4_STRUCT_RET
525 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
526
527 #ifdef TARGET_LIBC_PROVIDES_SSP
528 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
529 ppc64 glibc provides it at -0x7010(13). */
530 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
531 #endif
532
533 #define POWERPC_LINUX
534
535 /* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
536 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
537 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
538 #endif
539
540 /* Static stack checking is supported by means of probes. */
541 #define STACK_CHECK_STATIC_BUILTIN 1
542
543 /* The default value isn't sufficient in 64-bit mode. */
544 #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
545
546 /* Software floating point support for exceptions and rounding modes
547 depends on the C library in use. */
548 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
549 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
550 rs6000_linux_float_exceptions_rounding_supported_p
551
552 /* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
553 on glibc 2.19 or greater. */
554 #if TARGET_GLIBC_MAJOR > 2 \
555 || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
556 #define RS6000_GLIBC_ATOMIC_FENV 1
557 #endif
558
559 /* The IEEE 128-bit emulator is only built on Linux systems. Flag that we
560 should enable the type handling for KFmode on VSX systems even if we are not
561 enabling the __float128 keyword. */
562 #undef TARGET_FLOAT128_ENABLE_TYPE
563 #define TARGET_FLOAT128_ENABLE_TYPE 1
564
565 /* Enable using prefixed PC-relative addressing on POWER10 if the ABI
566 supports it. The ELF v2 ABI only supports PC-relative relocations for
567 the medium code model. */
568 #define PCREL_SUPPORTED_BY_OS (TARGET_POWER10 && TARGET_PREFIXED \
569 && ELFv2_ABI_CHECK \
570 && TARGET_CMODEL == CMODEL_MEDIUM)