]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/rs6000/linux64.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / rs6000 / linux64.h
CommitLineData
8eaf2dd1 1/* Definitions of target machine for GNU compiler,
c8515df4 2 for 64 bit PowerPC linux.
fbd26352 3 Copyright (C) 2000-2019 Free Software Foundation, Inc.
8eaf2dd1 4
3a5a28e2 5 This file is part of GCC.
8eaf2dd1 6
3a5a28e2 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
038d1e19 9 by the Free Software Foundation; either version 3, or (at your
3a5a28e2 10 option) any later version.
8eaf2dd1 11
3a5a28e2 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.
8eaf2dd1 16
6bc9506f 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
038d1e19 24 <http://www.gnu.org/licenses/>. */
8eaf2dd1 25
527d5be8 26#ifndef RS6000_BI_ARCH
8eaf2dd1 27
527d5be8 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
2eb52fc1 52
66ebfa67 53#ifdef HAVE_LD_NO_DOT_SYMS
54/* New ABI uses a local sym for the function entry point. */
55extern int dot_symbols;
56#undef DOT_SYMBOLS
57#define DOT_SYMBOLS dot_symbols
58#endif
59
2fe6297a 60#define TARGET_PROFILE_KERNEL profile_kernel
61
4d4180ce 62#undef TARGET_KEEP_LEAF_WHEN_PROFILED
63#define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled
64
72350d7b 65#define TARGET_USES_LINUX64_OPT 1
66#ifdef HAVE_LD_LARGE_TOC
72350d7b 67#undef TARGET_CMODEL
755fa783 68#define TARGET_CMODEL rs6000_current_cmodel
69#define SET_CMODEL(opt) rs6000_current_cmodel = opt
72350d7b 70#else
8d056442 71#define SET_CMODEL(opt) do {} while (0)
72350d7b 72#endif
73
7241927c 74#undef PROCESSOR_DEFAULT
bcc2fca8 75#define PROCESSOR_DEFAULT PROCESSOR_POWER7
7241927c 76#undef PROCESSOR_DEFAULT64
5881a7cb 77#define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
72943b59 78
31f742e9 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 \
62b54165 83 (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
527d5be8 84
85#undef RS6000_ABI_NAME
66ebfa67 86#define RS6000_ABI_NAME "linux"
527d5be8 87
2d67bb48 88#define INVALID_64BIT "%<-m%s%> not supported in this configuration"
527d5be8 89#define INVALID_32BIT INVALID_64BIT
90
238f342d 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
527d5be8 97#undef SUBSUBTARGET_OVERRIDE_OPTIONS
98#define SUBSUBTARGET_OVERRIDE_OPTIONS \
99 do \
100 { \
a4a5a0e9 101 if (!global_options_set.x_rs6000_alignment_flags) \
df79d252 102 rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
7bb12776 103 if (rs6000_isa_flags & OPTION_MASK_64BIT) \
527d5be8 104 { \
105 if (DEFAULT_ABI != ABI_AIX) \
106 { \
df79d252 107 rs6000_current_abi = ABI_AIX; \
527d5be8 108 error (INVALID_64BIT, "call"); \
109 } \
66ebfa67 110 dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
238f342d 111 if (ELFv2_ABI_CHECK) \
112 { \
113 rs6000_current_abi = ABI_ELFv2; \
114 if (dot_symbols) \
115 error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
116 } \
62b54165 117 if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
527d5be8 118 { \
62b54165 119 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
527d5be8 120 error (INVALID_64BIT, "relocatable"); \
121 } \
62b54165 122 if (rs6000_isa_flags & OPTION_MASK_EABI) \
527d5be8 123 { \
62b54165 124 rs6000_isa_flags &= ~OPTION_MASK_EABI; \
527d5be8 125 error (INVALID_64BIT, "eabi"); \
126 } \
3230b740 127 if (TARGET_PROTOTYPE) \
527d5be8 128 { \
47b92737 129 target_prototype = 0; \
527d5be8 130 error (INVALID_64BIT, "prototype"); \
131 } \
62b54165 132 if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
3a9bfe1e 133 { \
62b54165 134 rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
3a9bfe1e 135 error ("-m64 requires a PowerPC64 cpu"); \
136 } \
62b54165 137 if ((rs6000_isa_flags_explicit \
138 & OPTION_MASK_MINIMAL_TOC) != 0) \
72350d7b 139 { \
a4a5a0e9 140 if (global_options_set.x_rs6000_current_cmodel \
755fa783 141 && rs6000_current_cmodel != CMODEL_SMALL) \
72350d7b 142 error ("-mcmodel incompatible with other toc options"); \
143 SET_CMODEL (CMODEL_SMALL); \
144 } \
145 else \
146 { \
a4a5a0e9 147 if (!global_options_set.x_rs6000_current_cmodel) \
40e2644f 148 SET_CMODEL (CMODEL_MEDIUM); \
755fa783 149 if (rs6000_current_cmodel != CMODEL_SMALL) \
72350d7b 150 { \
c7f18d78 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; \
72350d7b 156 } \
157 } \
527d5be8 158 } \
159 else \
160 { \
161 if (!RS6000_BI_ARCH_P) \
162 error (INVALID_32BIT, "32"); \
617f66bf 163 if (TARGET_PROFILE_KERNEL) \
164 { \
2fe6297a 165 TARGET_PROFILE_KERNEL = 0; \
617f66bf 166 error (INVALID_32BIT, "profile-kernel"); \
167 } \
a4a5a0e9 168 if (global_options_set.x_rs6000_current_cmodel) \
72350d7b 169 { \
170 SET_CMODEL (CMODEL_SMALL); \
171 error (INVALID_32BIT, "cmodel"); \
172 } \
527d5be8 173 } \
174 } \
175 while (0)
176
527d5be8 177#undef ASM_DEFAULT_SPEC
115ebc5d 178#undef ASM_SPEC
527d5be8 179#undef LINK_OS_LINUX_SPEC
71017472 180#undef LINK_SECURE_PLT_SPEC
115ebc5d 181
527d5be8 182#ifndef RS6000_BI_ARCH
183#define ASM_DEFAULT_SPEC "-mppc64"
253cf589 184#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
527d5be8 185#define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
71017472 186#define LINK_SECURE_PLT_SPEC ""
527d5be8 187#else
188#if DEFAULT_ARCH64_P
189#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
253cf589 190#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
527d5be8 191#define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
71017472 192#define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
527d5be8 193#else
194#define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
253cf589 195#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
527d5be8 196#define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
71017472 197#define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
527d5be8 198#endif
199#endif
200
63713d4f 201#define ASM_SPEC32 "-a32 \
e9abca4f 202%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
23c6c8a2 203%{memb|msdata=eabi: -memb}"
527d5be8 204
205#define ASM_SPEC64 "-a64"
206
207#define ASM_SPEC_COMMON "%(asm_cpu) \
23c6c8a2 208%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
209 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
527d5be8 210
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 }, \
78de65bc 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
527d5be8 247
c9f48b91 248#undef MULTILIB_DEFAULTS
527d5be8 249#if DEFAULT_ARCH64_P
c9f48b91 250#define MULTILIB_DEFAULTS { "m64" }
527d5be8 251#else
c9f48b91 252#define MULTILIB_DEFAULTS { "m32" }
527d5be8 253#endif
254
c33609c3 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
527d5be8 270#ifndef RS6000_BI_ARCH
3b6e6f93 271
2eb52fc1 272/* 64-bit PowerPC Linux always has a TOC. */
2eb52fc1 273#undef TARGET_TOC
274#define TARGET_TOC 1
275
527d5be8 276/* Some things from sysv4.h we don't do when 64 bit. */
62b54165 277#undef OPTION_RELOCATABLE
278#define OPTION_RELOCATABLE 0
279#undef OPTION_EABI
280#define OPTION_EABI 0
281#undef OPTION_PROTOTYPE
282#define OPTION_PROTOTYPE 0
31f742e9 283#undef RELOCATABLE_NEEDS_FIXUP
284#define RELOCATABLE_NEEDS_FIXUP 0
3b6e6f93 285
527d5be8 286#endif
287
2eb52fc1 288/* We use glibc _mcount for profiling. */
b34a9a74 289#define NO_PROFILE_COUNTERS 1
527d5be8 290#define PROFILE_HOOK(LABEL) \
291 do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
2eb52fc1 292
df79d252 293/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */
227c963b 294#undef ADJUST_FIELD_ALIGN
700a9760 295#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
296 (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \
527d5be8 297 ? 128 \
298 : (TARGET_64BIT \
299 && TARGET_ALIGN_NATURAL == 0 \
700a9760 300 && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \
527d5be8 301 ? MIN ((COMPUTED), 32) \
302 : (COMPUTED))
3c8fd74f 303
df79d252 304/* PowerPC64 Linux increases natural record alignment to doubleword if
d84c6db8 305 the first field is an FP double, only if in power alignment mode. */
3a5a28e2 306#undef ROUND_TYPE_ALIGN
d84c6db8 307#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \
9c2675e7 308 ((TARGET_64BIT \
309 && (TREE_CODE (STRUCT) == RECORD_TYPE \
310 || TREE_CODE (STRUCT) == UNION_TYPE \
311 || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \
312 && TARGET_ALIGN_NATURAL == 0) \
d84c6db8 313 ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
8eaf2dd1 314 : MAX ((COMPUTED), (SPECIFIED)))
315
dea85af0 316/* Use the default for compiling target libs. */
317#ifdef IN_TARGET_LIBS
318#undef TARGET_ALIGN_NATURAL
319#define TARGET_ALIGN_NATURAL 1
320#endif
321
8eaf2dd1 322/* Indicate that jump tables go in the text section. */
367a6c4c 323#undef JUMP_TABLES_IN_TEXT_SECTION
527d5be8 324#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
8eaf2dd1 325
5f4cd670 326/* The linux ppc64 ABI isn't explicit on whether aggregates smaller
327 than a doubleword should be padded upward or downward. You could
328 reasonably assume that they follow the normal rules for structure
329 layout treating the parameter area as any other block of memory,
50d82890 330 then map the reg param area to registers. i.e. pad upward.
751e10d1 331 Setting both of the following defines results in this behavior.
5f4cd670 332 Setting just the first one will result in aggregates that fit in a
333 doubleword being padded downward, and others being padded upward.
334 Not a bad idea as this results in struct { int x; } being passed
335 the same way as an int. */
336#define AGGREGATE_PADDING_FIXED TARGET_64BIT
337#define AGGREGATES_PAD_UPWARD_ALWAYS 0
338
5f4cd670 339/* Specify padding for the last element of a block move between
340 registers and memory. FIRST is nonzero if this is the only
341 element. */
342#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
d7ab0e3d 343 (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
5f4cd670 344
dbb4f0b5 345/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
346 process. */
347#define OS_MISSING_POWERPC64 !TARGET_64BIT
348
d9993a19 349#ifdef SINGLE_LIBC
350#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
981702f2 351#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
352#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
f2d678af 353#undef OPTION_MUSL
354#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
d9993a19 355#else
c923aba8 356#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
981702f2 357#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
358#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
f2d678af 359#undef OPTION_MUSL
360#define OPTION_MUSL (linux_libc == LIBC_MUSL)
d9993a19 361#endif
c923aba8 362
30f690e0 363/* Determine what functions are present at the runtime;
364 this includes full c99 runtime and sincos. */
365#undef TARGET_LIBC_HAS_FUNCTION
0cc3ad67 366#define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
dbb4f0b5 367
3a5a28e2 368#undef TARGET_OS_CPP_BUILTINS
253cf589 369#define TARGET_OS_CPP_BUILTINS() \
527d5be8 370 do \
371 { \
cdfc6004 372 if (strcmp (rs6000_abi_name, "linux") == 0) \
373 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
527d5be8 374 if (TARGET_64BIT) \
375 { \
376 builtin_define ("__PPC__"); \
377 builtin_define ("__PPC64__"); \
378 builtin_define ("__powerpc__"); \
379 builtin_define ("__powerpc64__"); \
70b94afd 380 if (!DOT_SYMBOLS) \
381 builtin_define ("_CALL_LINUX"); \
527d5be8 382 builtin_assert ("cpu=powerpc64"); \
383 builtin_assert ("machine=powerpc64"); \
384 } \
385 else \
386 { \
387 builtin_define_std ("PPC"); \
388 builtin_define_std ("powerpc"); \
389 builtin_assert ("cpu=powerpc"); \
390 builtin_assert ("machine=powerpc"); \
391 TARGET_OS_SYSV_CPP_BUILTINS (); \
392 } \
393 } \
5b2c8acb 394 while (0)
8eaf2dd1 395
03385ed3 396#define GNU_USER_TARGET_D_OS_VERSIONS() \
397 do { \
398 builtin_version ("linux"); \
399 if (OPTION_GLIBC) \
400 builtin_version ("CRuntime_Glibc"); \
401 else if (OPTION_UCLIBC) \
402 builtin_version ("CRuntime_UClibc"); \
403 else if (OPTION_BIONIC) \
404 builtin_version ("CRuntime_Bionic"); \
405 else if (OPTION_MUSL) \
406 builtin_version ("CRuntime_Musl"); \
407 } while (0)
408
2eb52fc1 409#undef CPP_OS_DEFAULT_SPEC
78de65bc 410#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
8eaf2dd1 411
367a6c4c 412#undef LINK_SHLIB_SPEC
62645df4 413#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
414 %{static-pie:-static -pie --no-dynamic-linker -z text}"
8eaf2dd1 415
2eb52fc1 416#undef LIB_DEFAULT_SPEC
8eaf2dd1 417#define LIB_DEFAULT_SPEC "%(lib_linux)"
418
2eb52fc1 419#undef STARTFILE_DEFAULT_SPEC
8eaf2dd1 420#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
421
422#undef ENDFILE_DEFAULT_SPEC
423#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
424
425#undef LINK_START_DEFAULT_SPEC
426#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
427
428#undef LINK_OS_DEFAULT_SPEC
429#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
430
78de65bc 431#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
432
238f342d 433#ifdef LINUX64_DEFAULT_ABI_ELFv2
78de65bc 434#define GLIBC_DYNAMIC_LINKER64 \
435"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
436":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
238f342d 437#else
78de65bc 438#define GLIBC_DYNAMIC_LINKER64 \
439"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
440":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
238f342d 441#endif
78de65bc 442
cdfc6004 443#undef MUSL_DYNAMIC_LINKER32
02f43d0e 444#define MUSL_DYNAMIC_LINKER32 \
445 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
cdfc6004 446#undef MUSL_DYNAMIC_LINKER64
02f43d0e 447#define MUSL_DYNAMIC_LINKER64 \
448 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
449
a6245fde 450#undef DEFAULT_ASM_ENDIAN
d80dc920 451#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
a6245fde 452#define DEFAULT_ASM_ENDIAN " -mlittle"
23c6c8a2 453#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
454 " -m elf32lppclinux", \
455 " -m elf32lppclinux")
456#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
457 " -m elf64lppc", \
458 " -m elf64lppc")
d80dc920 459#else
a6245fde 460#define DEFAULT_ASM_ENDIAN " -mbig"
23c6c8a2 461#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \
462 " -m elf32lppclinux", \
463 " -m elf32ppclinux")
464#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \
465 " -m elf64lppc", \
466 " -m elf64ppc")
d80dc920 467#endif
c490c13b 468
d80dc920 469#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
62645df4 470 %{!static-pie: \
471 %{rdynamic:-export-dynamic} \
472 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
78de65bc 473 %(link_os_extra_spec32)"
3c6e13d9 474
d80dc920 475#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
62645df4 476 %{!static-pie: \
477 %{rdynamic:-export-dynamic} \
478 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
78de65bc 479 %(link_os_extra_spec64)"
8eaf2dd1 480
ab6b1bb4 481/* Use gnu-user.h LINK_GCC_SEQUENCE_SPEC for linux. */
482#undef LINK_GCC_C_SEQUENCE_SPEC
483#define LINK_GCC_C_SEQUENCE_SPEC \
484 "%{mads|myellowknife|mmvme|msim:%G %L %G;" \
485 "!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \
486 ":%G %L %G}"
487
367a6c4c 488#undef TOC_SECTION_ASM_OP
527d5be8 489#define TOC_SECTION_ASM_OP \
490 (TARGET_64BIT \
491 ? "\t.section\t\".toc\",\"aw\"" \
492 : "\t.section\t\".got\",\"aw\"")
8eaf2dd1 493
367a6c4c 494#undef MINIMAL_TOC_SECTION_ASM_OP
527d5be8 495#define MINIMAL_TOC_SECTION_ASM_OP \
496 (TARGET_64BIT \
497 ? "\t.section\t\".toc1\",\"aw\"" \
aead0c9c 498 : (flag_pic \
527d5be8 499 ? "\t.section\t\".got2\",\"aw\"" \
500 : "\t.section\t\".got1\",\"aw\""))
8eaf2dd1 501
8eaf2dd1 502/* Must be at least as big as our pointer type. */
527d5be8 503#undef SIZE_TYPE
504#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
8eaf2dd1 505
527d5be8 506#undef PTRDIFF_TYPE
507#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
8eaf2dd1 508
527d5be8 509#undef WCHAR_TYPE
510#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
8eaf2dd1 511#undef WCHAR_TYPE_SIZE
512#define WCHAR_TYPE_SIZE 32
513
367a6c4c 514#undef RS6000_MCOUNT
2eb52fc1 515#define RS6000_MCOUNT "_mcount"
367a6c4c 516
1a66c8d5 517#ifdef __powerpc64__
518/* _init and _fini functions are built from bits spread across many
519 object files, each potentially with a different TOC pointer. For
520 that reason, place a nop after the call so that the linker can
521 restore the TOC pointer if a TOC adjusting call stub is needed. */
66ebfa67 522#if DOT_SYMBOLS
1a66c8d5 523#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
524 asm (SECTION_OP "\n" \
525" bl ." #FUNC "\n" \
526" nop\n" \
527" .previous");
66ebfa67 528#else
529#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
530 asm (SECTION_OP "\n" \
531" bl " #FUNC "\n" \
532" nop\n" \
533" .previous");
534#endif
1a66c8d5 535#endif
536
367a6c4c 537/* FP save and restore routines. */
538#undef SAVE_FP_PREFIX
527d5be8 539#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
367a6c4c 540#undef SAVE_FP_SUFFIX
cac0aa5a 541#define SAVE_FP_SUFFIX ""
367a6c4c 542#undef RESTORE_FP_PREFIX
527d5be8 543#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
367a6c4c 544#undef RESTORE_FP_SUFFIX
cac0aa5a 545#define RESTORE_FP_SUFFIX ""
367a6c4c 546
8eaf2dd1 547/* Dwarf2 debugging. */
367a6c4c 548#undef PREFERRED_DEBUGGING_TYPE
2eb52fc1 549#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
550
ee0125fb 551/* This is how to declare the size of a function. */
552#undef ASM_DECLARE_FUNCTION_SIZE
553#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
554 do \
555 { \
556 if (!flag_inhibit_size_directive) \
557 { \
527d5be8 558 fputs ("\t.size\t", (FILE)); \
66ebfa67 559 if (TARGET_64BIT && DOT_SYMBOLS) \
527d5be8 560 putc ('.', (FILE)); \
ee0125fb 561 assemble_name ((FILE), (FNAME)); \
527d5be8 562 fputs (",.-", (FILE)); \
66ebfa67 563 rs6000_output_function_entry (FILE, FNAME); \
ee0125fb 564 putc ('\n', (FILE)); \
565 } \
566 } \
567 while (0)
568
e911aedf 569/* Return nonzero if this entry is to be written into the constant
8eaf2dd1 570 pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
571 or a CONST containing one of them. If -mfp-in-toc (the default),
572 we also do this for floating-point constants. We actually can only
573 do this if the FP formats of the target and host machines are the
574 same, but we can't check that since not every file that uses
5aa800ab 575 the macros includes real.h. We also do this when we can write an
576 integer into the TOC and the entry is not larger than a TOC entry,
577 but not for -mcmodel=medium where we'll use a toc-relative load for
578 constants outside the TOC. */
8eaf2dd1 579
580#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
581#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
582 (TARGET_TOC \
583 && (GET_CODE (X) == SYMBOL_REF \
584 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
585 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
586 || GET_CODE (X) == LABEL_REF \
587 || (GET_CODE (X) == CONST_INT \
5aa800ab 588 && TARGET_CMODEL != CMODEL_MEDIUM \
8eaf2dd1 589 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
590 || (GET_CODE (X) == CONST_DOUBLE \
527d5be8 591 && ((TARGET_64BIT \
ecaa8a98 592 && (TARGET_MINIMAL_TOC \
e284b8fb 593 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
527d5be8 594 && ! TARGET_NO_FP_IN_TOC))) \
595 || (!TARGET_64BIT \
596 && !TARGET_NO_FP_IN_TOC \
e284b8fb 597 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
527d5be8 598 && BITS_PER_WORD == HOST_BITS_PER_INT)))))
8eaf2dd1 599
13864c73 600/* Select a format to encode pointers in exception handling data. CODE
601 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
602 true if the symbol may be affected by dynamic relocations. */
603#undef ASM_PREFERRED_EH_DATA_FORMAT
604#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
aead0c9c 605 (TARGET_64BIT || flag_pic \
527d5be8 606 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
607 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \
608 : DW_EH_PE_absptr)
609
610/* For backward compatibility, we must continue to use the AIX
611 structure return convention. */
612#undef DRAFT_V4_STRUCT_RET
613#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
614
0d55f4d0 615#ifdef TARGET_LIBC_PROVIDES_SSP
616/* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
617 ppc64 glibc provides it at -0x7010(13). */
618#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
619#endif
baad77c2 620
621#define POWERPC_LINUX
2dde0cc6 622
623/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */
624#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
625#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
626#endif
d09d3bcf 627
628/* Static stack checking is supported by means of probes. */
629#define STACK_CHECK_STATIC_BUILTIN 1
630
631/* The default value isn't sufficient in 64-bit mode. */
632#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
4c866b9b 633
634/* Software floating point support for exceptions and rounding modes
635 depends on the C library in use. */
636#undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
637#define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
638 rs6000_linux_float_exceptions_rounding_supported_p
6eb68b8f 639
640/* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
641 on glibc 2.19 or greater. */
642#if TARGET_GLIBC_MAJOR > 2 \
643 || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
644#define RS6000_GLIBC_ATOMIC_FENV 1
645#endif
7d29bba9 646
647/* The IEEE 128-bit emulator is only built on Linux systems. Flag that we
648 should enable the type handling for KFmode on VSX systems even if we are not
649 enabling the __float128 keyword. */
650#undef TARGET_FLOAT128_ENABLE_TYPE
651#define TARGET_FLOAT128_ENABLE_TYPE 1