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