1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995-2017 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
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 /* Header files should be C++ aware in general. */
27 #undef NO_IMPLICIT_EXTERN_C
28 #define NO_IMPLICIT_EXTERN_C
30 /* Yes! We are ELF. */
31 #define TARGET_OBJECT_FORMAT OBJECT_ELF
33 /* Default ABI to compile code for. */
34 #define DEFAULT_ABI rs6000_current_abi
36 /* Default ABI to use. */
37 #define RS6000_ABI_NAME "sysv"
39 /* Override rs6000.h definition. */
40 #undef ASM_DEFAULT_SPEC
41 #define ASM_DEFAULT_SPEC "-mppc"
43 #define TARGET_TOC (TARGET_64BIT \
44 || (TARGET_MINIMAL_TOC \
46 || DEFAULT_ABI != ABI_V4)
48 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
49 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
50 #define TARGET_PROTOTYPE target_prototype
51 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
52 #define TARGET_NO_TOC (! TARGET_TOC)
53 #define TARGET_NO_EABI (! TARGET_EABI)
54 #define TARGET_REGNAMES rs6000_regnames
57 #undef TARGET_SECURE_PLT
58 #define TARGET_SECURE_PLT secure_plt
61 #define SDATA_DEFAULT_SIZE 8
63 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
64 get control in TARGET_OPTION_OVERRIDE. */
66 #define SUBTARGET_OVERRIDE_OPTIONS \
68 if (!global_options_set.x_g_switch_value) \
69 g_switch_value = SDATA_DEFAULT_SIZE; \
71 if (rs6000_abi_name == NULL) \
72 rs6000_abi_name = RS6000_ABI_NAME; \
74 if (!strcmp (rs6000_abi_name, "sysv")) \
75 rs6000_current_abi = ABI_V4; \
76 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
78 rs6000_current_abi = ABI_V4; \
79 rs6000_isa_flags &= ~ OPTION_MASK_EABI; \
81 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
82 || !strcmp (rs6000_abi_name, "eabi")) \
84 rs6000_current_abi = ABI_V4; \
85 rs6000_isa_flags |= OPTION_MASK_EABI; \
87 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
88 rs6000_current_abi = ABI_AIX; \
89 else if (!strcmp (rs6000_abi_name, "freebsd") \
90 || !strcmp (rs6000_abi_name, "linux")) \
93 rs6000_current_abi = ABI_AIX; \
95 rs6000_current_abi = ABI_V4; \
97 else if (!strcmp (rs6000_abi_name, "netbsd")) \
98 rs6000_current_abi = ABI_V4; \
99 else if (!strcmp (rs6000_abi_name, "openbsd")) \
100 rs6000_current_abi = ABI_V4; \
101 else if (!strcmp (rs6000_abi_name, "i960-old")) \
103 rs6000_current_abi = ABI_V4; \
104 rs6000_isa_flags |= (OPTION_MASK_LITTLE_ENDIAN | OPTION_MASK_EABI); \
105 rs6000_isa_flags &= ~OPTION_MASK_STRICT_ALIGN; \
106 TARGET_NO_BITFIELD_WORD = 1; \
110 rs6000_current_abi = ABI_V4; \
111 error ("bad value for -mcall-%s", rs6000_abi_name); \
114 if (rs6000_sdata_name) \
116 if (!strcmp (rs6000_sdata_name, "none")) \
117 rs6000_sdata = SDATA_NONE; \
118 else if (!strcmp (rs6000_sdata_name, "data")) \
119 rs6000_sdata = SDATA_DATA; \
120 else if (!strcmp (rs6000_sdata_name, "default")) \
121 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
122 else if (!strcmp (rs6000_sdata_name, "sysv")) \
123 rs6000_sdata = SDATA_SYSV; \
124 else if (!strcmp (rs6000_sdata_name, "eabi")) \
125 rs6000_sdata = SDATA_EABI; \
127 error ("bad value for -msdata=%s", rs6000_sdata_name); \
129 else if (DEFAULT_ABI == ABI_V4) \
131 rs6000_sdata = SDATA_DATA; \
132 rs6000_sdata_name = "data"; \
136 rs6000_sdata = SDATA_NONE; \
137 rs6000_sdata_name = "none"; \
140 if (TARGET_RELOCATABLE && \
141 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
143 rs6000_sdata = SDATA_DATA; \
144 error ("-mrelocatable and -msdata=%s are incompatible", \
145 rs6000_sdata_name); \
148 else if (flag_pic && DEFAULT_ABI == ABI_V4 \
149 && (rs6000_sdata == SDATA_EABI \
150 || rs6000_sdata == SDATA_SYSV)) \
152 rs6000_sdata = SDATA_DATA; \
153 error ("-f%s and -msdata=%s are incompatible", \
154 (flag_pic > 1) ? "PIC" : "pic", \
155 rs6000_sdata_name); \
158 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
159 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
161 rs6000_sdata = SDATA_NONE; \
162 error ("-msdata=%s and -mcall-%s are incompatible", \
163 rs6000_sdata_name, rs6000_abi_name); \
166 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
168 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
170 rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \
171 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
174 if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \
176 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
177 error ("-mrelocatable and -mcall-%s are incompatible", \
181 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \
184 error ("-fPIC and -mcall-%s are incompatible", \
188 if (TARGET_SECURE_PLT != secure_plt) \
190 error ("-msecure-plt not supported by your assembler"); \
193 if (flag_pic > 1 && DEFAULT_ABI == ABI_V4) \
195 /* Note: flag_pic should not change any option flags that would \
196 be invalid with or pessimise -fno-PIC code. LTO turns off \
197 flag_pic when linking/recompiling a fixed position executable. \
198 However, if the objects were originally compiled with -fPIC, \
199 then other target options forced on here by -fPIC are restored \
200 when recompiling those objects without -fPIC. In particular \
201 TARGET_RELOCATABLE must not be enabled here by flag_pic. */ \
202 rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \
203 TARGET_NO_FP_IN_TOC = 1; \
206 if (TARGET_RELOCATABLE) \
210 TARGET_NO_FP_IN_TOC = 1; \
214 #ifndef RS6000_BI_ARCH
215 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
217 if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT) \
218 error ("-m%s not supported in this configuration", \
219 (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32"); \
223 /* Override rs6000.h definition. */
224 #undef TARGET_DEFAULT
225 #define TARGET_DEFAULT 0
227 /* Override rs6000.h definition. */
228 #undef PROCESSOR_DEFAULT
229 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
232 /* System V.4 uses register 13 as a pointer to the small data area,
233 so it is not available to the normal user. */
236 /* Override default big endianism definitions in rs6000.h. */
237 #undef BYTES_BIG_ENDIAN
238 #undef WORDS_BIG_ENDIAN
239 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
240 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
242 /* Put jump tables in read-only memory, rather than in .text. */
243 #define JUMP_TABLES_IN_TEXT_SECTION 0
245 /* Prefix and suffix to use to saving floating point. */
246 #define SAVE_FP_PREFIX "_savefpr_"
247 #define SAVE_FP_SUFFIX ""
249 /* Prefix and suffix to use to restoring floating point. */
250 #define RESTORE_FP_PREFIX "_restfpr_"
251 #define RESTORE_FP_SUFFIX ""
253 /* Type used for size_t, as a string used in a declaration. */
255 #define SIZE_TYPE "unsigned int"
257 /* Type used for ptrdiff_t, as a string used in a declaration. */
258 #define PTRDIFF_TYPE "int"
261 #define WCHAR_TYPE "long int"
263 #undef WCHAR_TYPE_SIZE
264 #define WCHAR_TYPE_SIZE 32
266 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
267 /* Override elfos.h definition. */
268 #undef PCC_BITFIELD_TYPE_MATTERS
269 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
271 #undef BITFIELD_NBYTES_LIMITED
272 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
274 /* Define this macro to be the value 1 if instructions will fail to
275 work if given data not on the nominal alignment. If instructions
276 will merely go slower in that case, define this macro as 0. */
277 #undef STRICT_ALIGNMENT
278 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
280 /* Define this macro if you wish to preserve a certain alignment for
281 the stack pointer, greater than what the hardware enforces. The
282 definition is a C expression for the desired alignment (measured
283 in bits). This macro must evaluate to a value equal to or larger
285 For the SYSV ABI and variants the alignment of the stack pointer
286 is usually controlled manually in rs6000.c. However, to maintain
287 alignment across alloca () in all circumstances,
288 PREFERRED_STACK_BOUNDARY needs to be set as well.
289 This has the additional advantage of allowing a bigger maximum
290 alignment of user objects on the stack. */
292 #undef PREFERRED_STACK_BOUNDARY
293 #define PREFERRED_STACK_BOUNDARY 128
295 /* Real stack boundary as mandated by the appropriate ABI. */
296 #define ABI_STACK_BOUNDARY \
297 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
299 /* An expression for the alignment of a structure field FIELD if the
300 alignment computed in the usual way is COMPUTED. */
301 #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
302 (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \
305 #undef BIGGEST_FIELD_ALIGNMENT
307 /* Use ELF style section commands. */
309 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
311 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
313 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
315 /* Override elfos.h definition. */
316 #undef INIT_SECTION_ASM_OP
317 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
319 /* Override elfos.h definition. */
320 #undef FINI_SECTION_ASM_OP
321 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
323 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
325 /* Put PC relative got entries in .got2. */
326 #define MINIMAL_TOC_SECTION_ASM_OP \
327 (flag_pic ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
329 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
330 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
331 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
333 /* Override default elf definitions. */
334 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
335 #undef TARGET_ASM_RELOC_RW_MASK
336 #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
337 #undef TARGET_ASM_SELECT_RTX_SECTION
338 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
340 /* Return nonzero if this entry is to be written into the constant pool
341 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
342 containing one of them. If -mfp-in-toc (the default), we also do
343 this for floating-point constants. We actually can only do this
344 if the FP formats of the target and host machines are the same, but
345 we can't check that since not every file that uses these target macros
348 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
349 allow floating point constants in the TOC if -mrelocatable. */
351 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
352 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
354 && (GET_CODE (X) == SYMBOL_REF \
355 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
356 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
357 || GET_CODE (X) == LABEL_REF \
358 || (GET_CODE (X) == CONST_INT \
359 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
360 || (!TARGET_NO_FP_IN_TOC \
361 && GET_CODE (X) == CONST_DOUBLE \
362 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
363 && BITS_PER_WORD == HOST_BITS_PER_INT)))
365 /* These macros generate the special .type and .size directives which
366 are used to set the corresponding fields of the linker symbol table
367 entries in an ELF object file under SVR4. These macros also output
368 the starting labels for the relevant functions/objects. */
370 /* Write the extra assembler code needed to declare a function properly.
371 Some svr4 assemblers need to also have something extra said about the
372 function's return value. We allow for that here. */
374 /* Override elfos.h definition. */
375 #undef ASM_DECLARE_FUNCTION_NAME
376 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
377 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
379 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
380 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
382 #define LOCAL_LABEL_PREFIX "."
383 #define USER_LABEL_PREFIX ""
385 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
386 asm_fprintf (FILE, "%L%s", PREFIX)
388 /* Globalizing directive for a label. */
389 #define GLOBAL_ASM_OP "\t.globl "
391 /* This says how to output assembler code to declare an
392 uninitialized internal linkage data object. Under SVR4,
393 the linker seems to want the alignment of data objects
394 to depend on their types. We do exactly that here. */
396 #define LOCAL_ASM_OP "\t.local\t"
398 #define LCOMM_ASM_OP "\t.lcomm\t"
400 /* Describe how to emit uninitialized local items. */
401 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
403 if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \
405 switch_to_section (sbss_section); \
406 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
407 ASM_OUTPUT_LABEL (FILE, NAME); \
408 ASM_OUTPUT_SKIP (FILE, SIZE); \
409 if (!flag_inhibit_size_directive && (SIZE) > 0) \
410 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
414 fprintf (FILE, "%s", LCOMM_ASM_OP); \
415 assemble_name ((FILE), (NAME)); \
416 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
417 (SIZE), (ALIGN) / BITS_PER_UNIT); \
419 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
422 /* Describe how to emit uninitialized external linkage items. */
423 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
425 ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \
428 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
429 /* To support -falign-* switches we need to use .p2align so
430 that alignment directives in code sections will be padded
431 with no-op instructions, rather than zeroes. */
432 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
435 if ((MAX_SKIP) == 0) \
436 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
438 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
442 /* This is how to output code to push a register on the stack.
443 It need not be very fast code.
445 On the rs6000, we must keep the backchain up to date. In order
446 to simplify things, always allocate 16 bytes for a push (System V
447 wants to keep stack aligned to a 16 byte boundary). */
449 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
451 if (DEFAULT_ABI == ABI_V4) \
453 "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n", \
454 reg_names[1], reg_names[1], reg_names[REGNO], \
458 /* This is how to output an insn to pop a register from the stack.
459 It need not be very fast code. */
461 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
463 if (DEFAULT_ABI == ABI_V4) \
465 "\tlwz %s,12(%s)\n\taddi %s,%s,16\n", \
466 reg_names[REGNO], reg_names[1], reg_names[1], \
470 extern int fixuplabelno
;
472 /* Handle constructors specially for -mrelocatable. */
473 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
474 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
476 /* This is the end of what might become sysv4.h. */
478 /* Use DWARF 2 debugging information by default. */
479 #undef PREFERRED_DEBUGGING_TYPE
480 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
482 /* Historically we have also supported stabs debugging. */
483 #define DBX_DEBUGGING_INFO 1
485 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
486 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
488 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
490 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
491 assemble_name (FILE, NAME)
493 /* We have to output the stabs for the function name *first*, before
494 outputting its label. */
496 #define DBX_FUNCTION_FIRST
498 /* This is the end of what might become sysv4dbx.h. */
500 #define TARGET_OS_SYSV_CPP_BUILTINS() \
503 if (rs6000_isa_flags_explicit \
504 & OPTION_MASK_RELOCATABLE) \
505 builtin_define ("_RELOCATABLE"); \
509 #ifndef TARGET_OS_CPP_BUILTINS
510 #define TARGET_OS_CPP_BUILTINS() \
513 builtin_define_std ("PPC"); \
514 builtin_define_std ("unix"); \
515 builtin_define ("__svr4__"); \
516 builtin_assert ("system=unix"); \
517 builtin_assert ("system=svr4"); \
518 builtin_assert ("cpu=powerpc"); \
519 builtin_assert ("machine=powerpc"); \
520 TARGET_OS_SYSV_CPP_BUILTINS (); \
525 /* Select one of BIG_OPT, LITTLE_OPT or DEFAULT_OPT depending
526 on various -mbig, -mlittle and -mcall- options. */
527 #define ENDIAN_SELECT(BIG_OPT, LITTLE_OPT, DEFAULT_OPT) \
528 "%{mlittle|mlittle-endian:" LITTLE_OPT ";" \
529 "mbig|mbig-endian:" BIG_OPT ";" \
530 "mcall-i960-old:" LITTLE_OPT ";" \
533 #define DEFAULT_ASM_ENDIAN " -mbig"
536 #define ASM_SPEC "%(asm_cpu) \
537 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
538 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
539 %{memb|msdata=eabi: -memb}" \
540 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
542 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
543 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
545 #ifndef LINK_SECURE_PLT_DEFAULT_SPEC
546 #define LINK_SECURE_PLT_DEFAULT_SPEC ""
549 /* Pass -G xxx to the compiler. */
551 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
552 "%{meabi: %{!mcall-*: -mcall-sysv }} \
553 %{!meabi: %{!mno-eabi: \
554 %{mrelocatable: -meabi } \
555 %{mcall-freebsd: -mno-eabi } \
556 %{mcall-i960-old: -meabi } \
557 %{mcall-linux: -mno-eabi } \
558 %{mcall-netbsd: -mno-eabi } \
559 %{mcall-openbsd: -mno-eabi }}} \
560 %{msdata: -msdata=default} \
561 %{mno-sdata: -msdata=none} \
562 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
565 /* Default starting address if specified. */
566 #define LINK_START_SPEC "\
567 %{mads : %(link_start_ads) ; \
568 myellowknife : %(link_start_yellowknife) ; \
569 mmvme : %(link_start_mvme) ; \
570 msim : %(link_start_sim) ; \
571 mcall-freebsd: %(link_start_freebsd) ; \
572 mcall-linux : %(link_start_linux) ; \
573 mcall-netbsd : %(link_start_netbsd) ; \
574 mcall-openbsd: %(link_start_openbsd) ; \
575 : %(link_start_default) }"
577 #define LINK_START_DEFAULT_SPEC ""
578 #define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC
582 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
585 %{!T*: %(link_start) } \
586 %{!static: %{!mbss-plt: %(link_secure_plt)}} \
589 /* Shared libraries are not default. */
590 #define LINK_SHLIB_SPEC "\
591 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
593 %{shared:-G -dy -z text } \
594 %{symbolic:-Bsymbolic -G -dy -z text }"
596 /* Any specific OS flags. */
597 #define LINK_OS_SPEC "\
598 %{mads : %(link_os_ads) ; \
599 myellowknife : %(link_os_yellowknife) ; \
600 mmvme : %(link_os_mvme) ; \
601 msim : %(link_os_sim) ; \
602 mcall-freebsd: %(link_os_freebsd) ; \
603 mcall-linux : %(link_os_linux) ; \
604 mcall-netbsd : %(link_os_netbsd) ; \
605 mcall-openbsd: %(link_os_openbsd) ; \
606 : %(link_os_default) }"
608 #define LINK_OS_DEFAULT_SPEC ""
610 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
611 %<msingle-float %<mdouble-float}"
613 /* Override rs6000.h definition. */
615 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
616 %{mads : %(cpp_os_ads) ; \
617 myellowknife : %(cpp_os_yellowknife) ; \
618 mmvme : %(cpp_os_mvme) ; \
619 msim : %(cpp_os_sim) ; \
620 mcall-freebsd: %(cpp_os_freebsd) ; \
621 mcall-linux : %(cpp_os_linux) ; \
622 mcall-netbsd : %(cpp_os_netbsd) ; \
623 mcall-openbsd: %(cpp_os_openbsd) ; \
624 : %(cpp_os_default) }"
626 #define CPP_OS_DEFAULT_SPEC ""
628 #undef STARTFILE_SPEC
629 #define STARTFILE_SPEC "\
630 %{mads : %(startfile_ads) ; \
631 myellowknife : %(startfile_yellowknife) ; \
632 mmvme : %(startfile_mvme) ; \
633 msim : %(startfile_sim) ; \
634 mcall-freebsd: %(startfile_freebsd) ; \
635 mcall-linux : %(startfile_linux) ; \
636 mcall-netbsd : %(startfile_netbsd) ; \
637 mcall-openbsd: %(startfile_openbsd) ; \
638 : %(startfile_default) }"
640 #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
644 %{mads : %(lib_ads) ; \
645 myellowknife : %(lib_yellowknife) ; \
646 mmvme : %(lib_mvme) ; \
647 msim : %(lib_sim) ; \
648 mcall-freebsd: %(lib_freebsd) ; \
649 mcall-linux : %(lib_linux) ; \
650 mcall-netbsd : %(lib_netbsd) ; \
651 mcall-openbsd: %(lib_openbsd) ; \
654 #define LIB_DEFAULT_SPEC "-lc"
657 #define ENDFILE_SPEC "\
658 %{mads : %(endfile_ads) ; \
659 myellowknife : %(endfile_yellowknife) ; \
660 mmvme : %(endfile_mvme) ; \
661 msim : %(endfile_sim) ; \
662 mcall-freebsd: %(endfile_freebsd) ; \
663 mcall-linux : %(endfile_linux) ; \
664 mcall-netbsd : %(endfile_netbsd) ; \
665 mcall-openbsd: %(endfile_openbsd) ; \
666 : %(crtsavres_default) %(endfile_default) }"
668 #define CRTSAVRES_DEFAULT_SPEC ""
670 #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
672 /* Motorola ADS support. */
673 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
675 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
677 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
679 #define LINK_START_ADS_SPEC "-T ads.ld%s"
681 #define LINK_OS_ADS_SPEC ""
683 #define CPP_OS_ADS_SPEC ""
685 /* Motorola Yellowknife support. */
686 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
688 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
690 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
692 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
694 #define LINK_OS_YELLOWKNIFE_SPEC ""
696 #define CPP_OS_YELLOWKNIFE_SPEC ""
698 /* Motorola MVME support. */
699 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
701 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
703 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
705 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
707 #define LINK_OS_MVME_SPEC ""
709 #define CPP_OS_MVME_SPEC ""
711 /* PowerPC simulator based on netbsd system calls support. */
712 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
714 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
716 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
718 #define LINK_START_SIM_SPEC ""
720 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
722 #define CPP_OS_SIM_SPEC ""
724 /* FreeBSD support. */
726 #define CPP_OS_FREEBSD_SPEC "\
727 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
728 -Acpu=powerpc -Amachine=powerpc"
730 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
731 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
732 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
733 #define LINK_START_FREEBSD_SPEC ""
735 #define LINK_OS_FREEBSD_SPEC "\
736 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
738 %{assert*} %{R*} %{rpath*} %{defsym*} \
739 %{shared:-Bshareable %{h*} %{soname*}} \
742 %{rdynamic: -export-dynamic} \
743 -dynamic-linker %(fbsd_dynamic_linker) } \
744 %{static:-Bstatic}} \
745 %{symbolic:-Bsymbolic}"
747 /* GNU/Linux support. */
748 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
749 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
750 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
752 #if ENABLE_OFFLOADING == 1
753 #define CRTOFFLOADBEGIN "%{fopenacc|fopenmp:crtoffloadbegin%O%s}"
754 #define CRTOFFLOADEND "%{fopenacc|fopenmp:crtoffloadend%O%s}"
756 #define CRTOFFLOADBEGIN ""
757 #define CRTOFFLOADEND ""
761 #define STARTFILE_LINUX_SPEC "\
762 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
763 %{mnewlib:ecrti.o%s;:crti.o%s} \
764 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
767 #define STARTFILE_LINUX_SPEC "\
768 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
769 %{mnewlib:ecrti.o%s;:crti.o%s} \
770 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
774 #define ENDFILE_LINUX_SPEC "\
775 %{shared|pie:crtendS.o%s;:crtend.o%s} \
776 %{mnewlib:ecrtn.o%s;:crtn.o%s} \
779 #define LINK_START_LINUX_SPEC ""
781 #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
783 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
784 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
785 #define MUSL_DYNAMIC_LINKER \
786 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
787 #if DEFAULT_LIBC == LIBC_UCLIBC
788 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
789 "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
790 #elif DEFAULT_LIBC == LIBC_MUSL
791 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
792 "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
793 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
794 #define CHOOSE_DYNAMIC_LINKER(G, U, M) \
795 "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
797 #error "Unsupported DEFAULT_LIBC"
799 #define GNU_USER_DYNAMIC_LINKER \
800 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
803 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
804 %{rdynamic:-export-dynamic} \
805 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
807 #if defined(HAVE_LD_EH_FRAME_HDR)
808 # define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
811 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
814 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
815 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
816 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
818 /* NetBSD support. */
819 #define LIB_NETBSD_SPEC "\
822 #define STARTFILE_NETBSD_SPEC "\
824 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
826 #define ENDFILE_NETBSD_SPEC "\
827 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
830 #define LINK_START_NETBSD_SPEC "\
833 #define LINK_OS_NETBSD_SPEC "\
834 %{!shared: %{!static: \
835 %{rdynamic:-export-dynamic} \
836 -dynamic-linker /usr/libexec/ld.elf_so}}"
838 #define CPP_OS_NETBSD_SPEC "\
839 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
841 /* OpenBSD support. */
842 #ifndef LIB_OPENBSD_SPEC
843 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
846 #ifndef STARTFILE_OPENBSD_SPEC
847 #define STARTFILE_OPENBSD_SPEC "\
848 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
849 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
852 #ifndef ENDFILE_OPENBSD_SPEC
853 #define ENDFILE_OPENBSD_SPEC "\
854 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
857 #ifndef LINK_START_OPENBSD_SPEC
858 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
861 #ifndef LINK_OS_OPENBSD_SPEC
862 #define LINK_OS_OPENBSD_SPEC ""
865 #ifndef CPP_OS_OPENBSD_SPEC
866 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
869 /* Define any extra SPECS that the compiler needs to generate. */
870 /* Override rs6000.h definition. */
871 #undef SUBTARGET_EXTRA_SPECS
872 #define SUBTARGET_EXTRA_SPECS \
873 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
874 { "lib_ads", LIB_ADS_SPEC }, \
875 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
876 { "lib_mvme", LIB_MVME_SPEC }, \
877 { "lib_sim", LIB_SIM_SPEC }, \
878 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
879 { "lib_linux", LIB_LINUX_SPEC }, \
880 { "lib_netbsd", LIB_NETBSD_SPEC }, \
881 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
882 { "lib_default", LIB_DEFAULT_SPEC }, \
883 { "startfile_ads", STARTFILE_ADS_SPEC }, \
884 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
885 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
886 { "startfile_sim", STARTFILE_SIM_SPEC }, \
887 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
888 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
889 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
890 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
891 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
892 { "endfile_ads", ENDFILE_ADS_SPEC }, \
893 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
894 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
895 { "endfile_sim", ENDFILE_SIM_SPEC }, \
896 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
897 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
898 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
899 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
900 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
901 { "link_shlib", LINK_SHLIB_SPEC }, \
902 { "link_start", LINK_START_SPEC }, \
903 { "link_start_ads", LINK_START_ADS_SPEC }, \
904 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
905 { "link_start_mvme", LINK_START_MVME_SPEC }, \
906 { "link_start_sim", LINK_START_SIM_SPEC }, \
907 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
908 { "link_start_linux", LINK_START_LINUX_SPEC }, \
909 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
910 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
911 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
912 { "link_os", LINK_OS_SPEC }, \
913 { "link_os_ads", LINK_OS_ADS_SPEC }, \
914 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
915 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
916 { "link_os_sim", LINK_OS_SIM_SPEC }, \
917 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
918 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
919 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
920 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
921 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
922 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
923 { "link_secure_plt", LINK_SECURE_PLT_SPEC }, \
924 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
925 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
926 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
927 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
928 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
929 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
930 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
931 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
932 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
933 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
934 SUBSUBTARGET_EXTRA_SPECS
936 #define SUBSUBTARGET_EXTRA_SPECS
938 /* Define this macro as a C expression for the initializer of an
939 array of string to tell the driver program which options are
940 defaults for this target and thus do not need to be handled
941 specially when using `MULTILIB_OPTIONS'.
943 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
944 the target makefile fragment or if none of the options listed in
945 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
947 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
949 /* Define this macro if the code for function profiling should come
950 before the function prologue. Normally, the profiling code comes
952 #define PROFILE_BEFORE_PROLOGUE 1
954 /* Function name to call to do profiling. */
955 #define RS6000_MCOUNT "_mcount"
957 /* Select a format to encode pointers in exception handling data. CODE
958 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
959 true if the symbol may be affected by dynamic relocations. */
960 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
962 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
966 #define DOUBLE_INT_ASM_OP "\t.quad\t"
968 /* Generate entries in .fixup for relocatable addresses. */
969 #define RELOCATABLE_NEEDS_FIXUP 1
971 #define TARGET_ASM_FILE_END rs6000_elf_file_end
973 #undef TARGET_ASAN_SHADOW_OFFSET
974 #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
976 /* This target uses the sysv4.opt file. */
977 #define TARGET_USES_SYSV4_OPT 1
979 /* Include order changes for musl, same as in generic linux.h. */
980 #if DEFAULT_LIBC == LIBC_MUSL
981 #define INCLUDE_DEFAULTS_MUSL_GPP \
982 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
983 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
984 { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
985 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
986 { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
987 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
989 #ifdef LOCAL_INCLUDE_DIR
990 #define INCLUDE_DEFAULTS_MUSL_LOCAL \
991 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
992 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
994 #define INCLUDE_DEFAULTS_MUSL_LOCAL
997 #ifdef PREFIX_INCLUDE_DIR
998 #define INCLUDE_DEFAULTS_MUSL_PREFIX \
999 { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
1001 #define INCLUDE_DEFAULTS_MUSL_PREFIX
1004 #ifdef CROSS_INCLUDE_DIR
1005 #define INCLUDE_DEFAULTS_MUSL_CROSS \
1006 { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
1008 #define INCLUDE_DEFAULTS_MUSL_CROSS
1011 #ifdef TOOL_INCLUDE_DIR
1012 #define INCLUDE_DEFAULTS_MUSL_TOOL \
1013 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
1015 #define INCLUDE_DEFAULTS_MUSL_TOOL
1018 #ifdef NATIVE_SYSTEM_HEADER_DIR
1019 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
1020 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
1021 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
1023 #define INCLUDE_DEFAULTS_MUSL_NATIVE
1026 #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
1027 # undef INCLUDE_DEFAULTS_MUSL_LOCAL
1028 # define INCLUDE_DEFAULTS_MUSL_LOCAL
1029 # undef INCLUDE_DEFAULTS_MUSL_NATIVE
1030 # define INCLUDE_DEFAULTS_MUSL_NATIVE
1032 # undef INCLUDE_DEFAULTS_MUSL_CROSS
1033 # define INCLUDE_DEFAULTS_MUSL_CROSS
1036 #undef INCLUDE_DEFAULTS
1037 #define INCLUDE_DEFAULTS \
1039 INCLUDE_DEFAULTS_MUSL_GPP \
1040 INCLUDE_DEFAULTS_MUSL_LOCAL \
1041 INCLUDE_DEFAULTS_MUSL_PREFIX \
1042 INCLUDE_DEFAULTS_MUSL_CROSS \
1043 INCLUDE_DEFAULTS_MUSL_TOOL \
1044 INCLUDE_DEFAULTS_MUSL_NATIVE \
1045 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
1046 { 0, 0, 0, 0, 0, 0 } \