1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published
10 by the Free Software Foundation; either version 3, or (at your
11 option) any later version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 /* Header files should be C++ aware in general. */
28 #undef NO_IMPLICIT_EXTERN_C
29 #define NO_IMPLICIT_EXTERN_C
31 /* Yes! We are ELF. */
32 #define TARGET_OBJECT_FORMAT OBJECT_ELF
34 /* Default ABI to compile code for. */
35 #define DEFAULT_ABI rs6000_current_abi
37 /* Default ABI to use. */
38 #define RS6000_ABI_NAME "sysv"
40 /* Override rs6000.h definition. */
41 #undef ASM_DEFAULT_SPEC
42 #define ASM_DEFAULT_SPEC "-mppc"
44 #define TARGET_TOC ((target_flags & MASK_64BIT) \
45 || ((target_flags & (MASK_RELOCATABLE \
46 | MASK_MINIMAL_TOC)) \
48 || DEFAULT_ABI == ABI_AIX)
50 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
51 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
52 #define TARGET_PROTOTYPE target_prototype
53 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
54 #define TARGET_NO_TOC (! TARGET_TOC)
55 #define TARGET_NO_EABI (! TARGET_EABI)
56 #define TARGET_REGNAMES rs6000_regnames
59 #undef TARGET_SECURE_PLT
60 #define TARGET_SECURE_PLT secure_plt
63 #define SDATA_DEFAULT_SIZE 8
65 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
66 get control in TARGET_OPTION_OVERRIDE. */
68 #define SUBTARGET_OVERRIDE_OPTIONS \
70 if (!global_options_set.x_g_switch_value) \
71 g_switch_value = SDATA_DEFAULT_SIZE; \
73 if (rs6000_abi_name == NULL) \
74 rs6000_abi_name = RS6000_ABI_NAME; \
76 if (!strcmp (rs6000_abi_name, "sysv")) \
77 rs6000_current_abi = ABI_V4; \
78 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
80 rs6000_current_abi = ABI_V4; \
81 target_flags &= ~ MASK_EABI; \
83 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
84 || !strcmp (rs6000_abi_name, "eabi")) \
86 rs6000_current_abi = ABI_V4; \
87 target_flags |= MASK_EABI; \
89 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
90 rs6000_current_abi = ABI_AIX; \
91 else if (!strcmp (rs6000_abi_name, "freebsd")) \
92 rs6000_current_abi = ABI_V4; \
93 else if (!strcmp (rs6000_abi_name, "linux")) \
96 rs6000_current_abi = ABI_AIX; \
98 rs6000_current_abi = ABI_V4; \
100 else if (!strcmp (rs6000_abi_name, "gnu")) \
101 rs6000_current_abi = ABI_V4; \
102 else if (!strcmp (rs6000_abi_name, "netbsd")) \
103 rs6000_current_abi = ABI_V4; \
104 else if (!strcmp (rs6000_abi_name, "openbsd")) \
105 rs6000_current_abi = ABI_V4; \
106 else if (!strcmp (rs6000_abi_name, "i960-old")) \
108 rs6000_current_abi = ABI_V4; \
109 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI); \
110 target_flags &= ~MASK_STRICT_ALIGN; \
111 TARGET_NO_BITFIELD_WORD = 1; \
115 rs6000_current_abi = ABI_V4; \
116 error ("bad value for -mcall-%s", rs6000_abi_name); \
119 if (rs6000_sdata_name) \
121 if (!strcmp (rs6000_sdata_name, "none")) \
122 rs6000_sdata = SDATA_NONE; \
123 else if (!strcmp (rs6000_sdata_name, "data")) \
124 rs6000_sdata = SDATA_DATA; \
125 else if (!strcmp (rs6000_sdata_name, "default")) \
126 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
127 else if (!strcmp (rs6000_sdata_name, "sysv")) \
128 rs6000_sdata = SDATA_SYSV; \
129 else if (!strcmp (rs6000_sdata_name, "eabi")) \
130 rs6000_sdata = SDATA_EABI; \
132 error ("bad value for -msdata=%s", rs6000_sdata_name); \
134 else if (DEFAULT_ABI == ABI_V4) \
136 rs6000_sdata = SDATA_DATA; \
137 rs6000_sdata_name = "data"; \
141 rs6000_sdata = SDATA_NONE; \
142 rs6000_sdata_name = "none"; \
145 if (TARGET_RELOCATABLE && \
146 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
148 rs6000_sdata = SDATA_DATA; \
149 error ("-mrelocatable and -msdata=%s are incompatible", \
150 rs6000_sdata_name); \
153 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
154 && (rs6000_sdata == SDATA_EABI \
155 || rs6000_sdata == SDATA_SYSV)) \
157 rs6000_sdata = SDATA_DATA; \
158 error ("-f%s and -msdata=%s are incompatible", \
159 (flag_pic > 1) ? "PIC" : "pic", \
160 rs6000_sdata_name); \
163 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
164 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
166 rs6000_sdata = SDATA_NONE; \
167 error ("-msdata=%s and -mcall-%s are incompatible", \
168 rs6000_sdata_name, rs6000_abi_name); \
171 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
173 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
175 target_flags |= MASK_MINIMAL_TOC; \
176 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
179 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
181 target_flags &= ~MASK_RELOCATABLE; \
182 error ("-mrelocatable and -mcall-%s are incompatible", \
186 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
189 error ("-fPIC and -mcall-%s are incompatible", \
193 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
195 target_flags &= ~MASK_LITTLE_ENDIAN; \
196 error ("-mcall-aixdesc must be big endian"); \
199 if (TARGET_SECURE_PLT != secure_plt) \
201 error ("-msecure-plt not supported by your assembler"); \
204 /* Treat -fPIC the same as -mrelocatable. */ \
205 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
207 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC; \
208 TARGET_NO_FP_IN_TOC = 1; \
211 else if (TARGET_RELOCATABLE) \
216 #ifndef RS6000_BI_ARCH
217 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
219 if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
220 error ("-m%s not supported in this configuration", \
221 (target_flags & MASK_64BIT) ? "64" : "32"); \
225 /* Override rs6000.h definition. */
226 #undef TARGET_DEFAULT
227 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
229 /* Override rs6000.h definition. */
230 #undef PROCESSOR_DEFAULT
231 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
233 /* SVR4 only defined for PowerPC, so short-circuit POWER patterns. */
235 #define TARGET_POWER 0
238 /* System V.4 uses register 13 as a pointer to the small data area,
239 so it is not available to the normal user. */
242 /* Override default big endianism definitions in rs6000.h. */
243 #undef BYTES_BIG_ENDIAN
244 #undef WORDS_BIG_ENDIAN
245 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
246 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
248 /* Define cutoff for using external functions to save floating point.
249 When optimizing for size, use external functions when profitable. */
250 #define FP_SAVE_INLINE(FIRST_REG) (optimize_size \
251 ? ((FIRST_REG) == 62 \
252 || (FIRST_REG) == 63) \
254 /* And similarly for general purpose registers. */
255 #define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
258 /* Put jump tables in read-only memory, rather than in .text. */
259 #define JUMP_TABLES_IN_TEXT_SECTION 0
261 /* Prefix and suffix to use to saving floating point. */
262 #define SAVE_FP_PREFIX "_savefpr_"
263 #define SAVE_FP_SUFFIX ""
265 /* Prefix and suffix to use to restoring floating point. */
266 #define RESTORE_FP_PREFIX "_restfpr_"
267 #define RESTORE_FP_SUFFIX ""
269 /* Type used for size_t, as a string used in a declaration. */
271 #define SIZE_TYPE "unsigned int"
273 /* Type used for ptrdiff_t, as a string used in a declaration. */
274 #define PTRDIFF_TYPE "int"
277 #define WCHAR_TYPE "long int"
279 #undef WCHAR_TYPE_SIZE
280 #define WCHAR_TYPE_SIZE 32
282 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
283 /* Override elfos.h definition. */
284 #undef PCC_BITFIELD_TYPE_MATTERS
285 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
287 #undef BITFIELD_NBYTES_LIMITED
288 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
290 /* Define this macro to be the value 1 if instructions will fail to
291 work if given data not on the nominal alignment. If instructions
292 will merely go slower in that case, define this macro as 0. */
293 #undef STRICT_ALIGNMENT
294 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
296 /* Define this macro if you wish to preserve a certain alignment for
297 the stack pointer, greater than what the hardware enforces. The
298 definition is a C expression for the desired alignment (measured
299 in bits). This macro must evaluate to a value equal to or larger
301 For the SYSV ABI and variants the alignment of the stack pointer
302 is usually controlled manually in rs6000.c. However, to maintain
303 alignment across alloca () in all circumstances,
304 PREFERRED_STACK_BOUNDARY needs to be set as well.
305 This has the additional advantage of allowing a bigger maximum
306 alignment of user objects on the stack. */
308 #undef PREFERRED_STACK_BOUNDARY
309 #define PREFERRED_STACK_BOUNDARY 128
311 /* Real stack boundary as mandated by the appropriate ABI. */
312 #define ABI_STACK_BOUNDARY \
313 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
315 /* An expression for the alignment of a structure field FIELD if the
316 alignment computed in the usual way is COMPUTED. */
317 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
318 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
321 #undef BIGGEST_FIELD_ALIGNMENT
323 /* Use ELF style section commands. */
325 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
327 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
329 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
331 /* Override elfos.h definition. */
332 #undef INIT_SECTION_ASM_OP
333 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
335 /* Override elfos.h definition. */
336 #undef FINI_SECTION_ASM_OP
337 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
339 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
341 /* Put PC relative got entries in .got2. */
342 #define MINIMAL_TOC_SECTION_ASM_OP \
343 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
344 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
346 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
347 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
348 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
350 /* Override default elf definitions. */
351 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
352 #undef TARGET_ASM_RELOC_RW_MASK
353 #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
354 #undef TARGET_ASM_SELECT_RTX_SECTION
355 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
357 /* Return nonzero if this entry is to be written into the constant pool
358 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
359 containing one of them. If -mfp-in-toc (the default), we also do
360 this for floating-point constants. We actually can only do this
361 if the FP formats of the target and host machines are the same, but
362 we can't check that since not every file that uses these target macros
365 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
366 allow floating point constants in the TOC if -mrelocatable. */
368 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
369 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
371 && (GET_CODE (X) == SYMBOL_REF \
372 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
373 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
374 || GET_CODE (X) == LABEL_REF \
375 || (GET_CODE (X) == CONST_INT \
376 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
377 || (!TARGET_NO_FP_IN_TOC \
378 && !TARGET_RELOCATABLE \
379 && GET_CODE (X) == CONST_DOUBLE \
380 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
381 && BITS_PER_WORD == HOST_BITS_PER_INT)))
383 /* These macros generate the special .type and .size directives which
384 are used to set the corresponding fields of the linker symbol table
385 entries in an ELF object file under SVR4. These macros also output
386 the starting labels for the relevant functions/objects. */
388 /* Write the extra assembler code needed to declare a function properly.
389 Some svr4 assemblers need to also have something extra said about the
390 function's return value. We allow for that here. */
392 /* Override elfos.h definition. */
393 #undef ASM_DECLARE_FUNCTION_NAME
394 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
395 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
397 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
398 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
400 #define LOCAL_LABEL_PREFIX "."
401 #define USER_LABEL_PREFIX ""
403 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
404 asm_fprintf (FILE, "%L%s", PREFIX)
406 /* Globalizing directive for a label. */
407 #define GLOBAL_ASM_OP "\t.globl "
409 /* This says how to output assembler code to declare an
410 uninitialized internal linkage data object. Under SVR4,
411 the linker seems to want the alignment of data objects
412 to depend on their types. We do exactly that here. */
414 #define LOCAL_ASM_OP "\t.local\t"
416 #define LCOMM_ASM_OP "\t.lcomm\t"
418 /* Describe how to emit uninitialized local items. */
419 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
421 if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \
423 switch_to_section (sbss_section); \
424 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
425 ASM_OUTPUT_LABEL (FILE, NAME); \
426 ASM_OUTPUT_SKIP (FILE, SIZE); \
427 if (!flag_inhibit_size_directive && (SIZE) > 0) \
428 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
432 fprintf (FILE, "%s", LCOMM_ASM_OP); \
433 assemble_name ((FILE), (NAME)); \
434 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
435 (SIZE), (ALIGN) / BITS_PER_UNIT); \
437 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
440 /* Describe how to emit uninitialized external linkage items. */
441 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
443 ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \
446 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
447 /* To support -falign-* switches we need to use .p2align so
448 that alignment directives in code sections will be padded
449 with no-op instructions, rather than zeroes. */
450 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
453 if ((MAX_SKIP) == 0) \
454 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
456 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
460 /* This is how to output code to push a register on the stack.
461 It need not be very fast code.
463 On the rs6000, we must keep the backchain up to date. In order
464 to simplify things, always allocate 16 bytes for a push (System V
465 wants to keep stack aligned to a 16 byte boundary). */
467 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
469 if (DEFAULT_ABI == ABI_V4) \
471 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
472 reg_names[1], reg_names[1], reg_names[REGNO], \
476 /* This is how to output an insn to pop a register from the stack.
477 It need not be very fast code. */
479 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
481 if (DEFAULT_ABI == ABI_V4) \
483 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
484 reg_names[REGNO], reg_names[1], reg_names[1], \
488 extern int fixuplabelno;
490 /* Handle constructors specially for -mrelocatable. */
491 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
492 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
494 /* This is the end of what might become sysv4.h. */
496 /* Use DWARF 2 debugging information by default. */
497 #undef PREFERRED_DEBUGGING_TYPE
498 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
500 /* Historically we have also supported stabs debugging. */
501 #define DBX_DEBUGGING_INFO 1
503 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
504 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
506 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
508 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
509 assemble_name (FILE, NAME)
511 /* We have to output the stabs for the function name *first*, before
512 outputting its label. */
514 #define DBX_FUNCTION_FIRST
516 /* This is the end of what might become sysv4dbx.h. */
518 #ifndef TARGET_VERSION
519 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
522 #define TARGET_OS_SYSV_CPP_BUILTINS() \
525 if (target_flags_explicit \
526 & MASK_RELOCATABLE) \
527 builtin_define ("_RELOCATABLE"); \
531 #ifndef TARGET_OS_CPP_BUILTINS
532 #define TARGET_OS_CPP_BUILTINS() \
535 builtin_define_std ("PPC"); \
536 builtin_define_std ("unix"); \
537 builtin_define ("__svr4__"); \
538 builtin_assert ("system=unix"); \
539 builtin_assert ("system=svr4"); \
540 builtin_assert ("cpu=powerpc"); \
541 builtin_assert ("machine=powerpc"); \
542 TARGET_OS_SYSV_CPP_BUILTINS (); \
548 #define ASM_SPEC "%(asm_cpu) \
549 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
550 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
551 %{memb|msdata=eabi: -memb} \
552 %{mlittle|mlittle-endian:-mlittle; \
553 mbig|mbig-endian :-mbig; \
560 mcall-i960-old :-mlittle}"
562 #define CC1_ENDIAN_BIG_SPEC ""
564 #define CC1_ENDIAN_LITTLE_SPEC "\
565 %{!mstrict-align: %{!mno-strict-align: \
571 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
573 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
574 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
577 /* Pass -G xxx to the compiler and set correct endian mode. */
578 #define CC1_SPEC "%{G*} %(cc1_cpu) \
579 %{mlittle|mlittle-endian: %(cc1_endian_little); \
580 mbig |mbig-endian : %(cc1_endian_big); \
586 mcall-gnu : -mbig %(cc1_endian_big); \
587 mcall-i960-old : -mlittle %(cc1_endian_little); \
588 : %(cc1_endian_default)} \
589 %{meabi: %{!mcall-*: -mcall-sysv }} \
590 %{!meabi: %{!mno-eabi: \
591 %{mrelocatable: -meabi } \
592 %{mcall-freebsd: -mno-eabi } \
593 %{mcall-i960-old: -meabi } \
594 %{mcall-linux: -mno-eabi } \
595 %{mcall-gnu: -mno-eabi } \
596 %{mcall-netbsd: -mno-eabi } \
597 %{mcall-openbsd: -mno-eabi }}} \
598 %{msdata: -msdata=default} \
599 %{mno-sdata: -msdata=none} \
600 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
603 /* Don't put -Y P,<path> for cross compilers. */
604 #ifndef CROSS_DIRECTORY_STRUCTURE
605 #define LINK_PATH_SPEC "\
607 %{!nostdlib: %{!YP,*: \
609 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
610 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
611 %{!R*: %{!L*: -R /usr/ucblib}} \
613 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
614 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
617 #define LINK_PATH_SPEC ""
620 /* Default starting address if specified. */
621 #define LINK_START_SPEC "\
622 %{mads : %(link_start_ads) ; \
623 myellowknife : %(link_start_yellowknife) ; \
624 mmvme : %(link_start_mvme) ; \
625 msim : %(link_start_sim) ; \
626 mcall-freebsd: %(link_start_freebsd) ; \
627 mcall-linux : %(link_start_linux) ; \
628 mcall-gnu : %(link_start_gnu) ; \
629 mcall-netbsd : %(link_start_netbsd) ; \
630 mcall-openbsd: %(link_start_openbsd) ; \
631 : %(link_start_default) }"
633 #define LINK_START_DEFAULT_SPEC ""
637 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
641 %{!T*: %(link_start) } \
645 /* For now, turn off shared libraries by default. */
646 #ifndef SHARED_LIB_SUPPORT
647 #define NO_SHARED_LIB_SUPPORT
650 #ifndef NO_SHARED_LIB_SUPPORT
651 /* Shared libraries are default. */
652 #define LINK_SHLIB_SPEC "\
653 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
655 %{static:-dn -Bstatic} \
656 %{shared:-G -dy -z text} \
657 %{symbolic:-Bsymbolic -G -dy -z text}"
660 /* Shared libraries are not default. */
661 #define LINK_SHLIB_SPEC "\
662 %{mshlib: %(link_path) } \
663 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
665 %{shared:-G -dy -z text %(link_path) } \
666 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
669 /* Override the default target of the linker. */
670 #define LINK_TARGET_SPEC "\
671 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
672 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
673 %{mcall-i960-old: --oformat elf32-powerpcle} \
676 /* Any specific OS flags. */
677 #define LINK_OS_SPEC "\
678 %{mads : %(link_os_ads) ; \
679 myellowknife : %(link_os_yellowknife) ; \
680 mmvme : %(link_os_mvme) ; \
681 msim : %(link_os_sim) ; \
682 mcall-freebsd: %(link_os_freebsd) ; \
683 mcall-linux : %(link_os_linux) ; \
684 mcall-gnu : %(link_os_gnu) ; \
685 mcall-netbsd : %(link_os_netbsd) ; \
686 mcall-openbsd: %(link_os_openbsd) ; \
687 : %(link_os_default) }"
689 #define LINK_OS_DEFAULT_SPEC ""
691 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
692 %<msingle-float %<mdouble-float}"
694 /* Override rs6000.h definition. */
696 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
697 %{mads : %(cpp_os_ads) ; \
698 myellowknife : %(cpp_os_yellowknife) ; \
699 mmvme : %(cpp_os_mvme) ; \
700 msim : %(cpp_os_sim) ; \
701 mcall-freebsd: %(cpp_os_freebsd) ; \
702 mcall-linux : %(cpp_os_linux) ; \
703 mcall-gnu : %(cpp_os_gnu) ; \
704 mcall-netbsd : %(cpp_os_netbsd) ; \
705 mcall-openbsd: %(cpp_os_openbsd) ; \
706 : %(cpp_os_default) }"
708 #define CPP_OS_DEFAULT_SPEC ""
710 #undef STARTFILE_SPEC
711 #define STARTFILE_SPEC "\
712 %{mads : %(startfile_ads) ; \
713 myellowknife : %(startfile_yellowknife) ; \
714 mmvme : %(startfile_mvme) ; \
715 msim : %(startfile_sim) ; \
716 mcall-freebsd: %(startfile_freebsd) ; \
717 mcall-linux : %(startfile_linux) ; \
718 mcall-gnu : %(startfile_gnu) ; \
719 mcall-netbsd : %(startfile_netbsd) ; \
720 mcall-openbsd: %(startfile_openbsd) ; \
721 : %(startfile_default) }"
723 #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
727 %{mads : %(lib_ads) ; \
728 myellowknife : %(lib_yellowknife) ; \
729 mmvme : %(lib_mvme) ; \
730 msim : %(lib_sim) ; \
731 mcall-freebsd: %(lib_freebsd) ; \
732 mcall-linux : %(lib_linux) ; \
733 mcall-gnu : %(lib_gnu) ; \
734 mcall-netbsd : %(lib_netbsd) ; \
735 mcall-openbsd: %(lib_openbsd) ; \
738 #define LIB_DEFAULT_SPEC "-lc"
741 #define ENDFILE_SPEC "\
742 %{mads : %(endfile_ads) ; \
743 myellowknife : %(endfile_yellowknife) ; \
744 mmvme : %(endfile_mvme) ; \
745 msim : %(endfile_sim) ; \
746 mcall-freebsd: %(endfile_freebsd) ; \
747 mcall-linux : %(endfile_linux) ; \
748 mcall-gnu : %(endfile_gnu) ; \
749 mcall-netbsd : %(endfile_netbsd) ; \
750 mcall-openbsd: %(endfile_openbsd) ; \
751 : %(crtsavres_default) %(endfile_default) }"
753 #define CRTSAVRES_DEFAULT_SPEC ""
755 #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
757 /* Motorola ADS support. */
758 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
760 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
762 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
764 #define LINK_START_ADS_SPEC "-T ads.ld%s"
766 #define LINK_OS_ADS_SPEC ""
768 #define CPP_OS_ADS_SPEC ""
770 /* Motorola Yellowknife support. */
771 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
773 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
775 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
777 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
779 #define LINK_OS_YELLOWKNIFE_SPEC ""
781 #define CPP_OS_YELLOWKNIFE_SPEC ""
783 /* Motorola MVME support. */
784 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
786 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
788 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
790 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
792 #define LINK_OS_MVME_SPEC ""
794 #define CPP_OS_MVME_SPEC ""
796 /* PowerPC simulator based on netbsd system calls support. */
797 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
799 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
801 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
803 #define LINK_START_SIM_SPEC ""
805 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
807 #define CPP_OS_SIM_SPEC ""
809 /* FreeBSD support. */
811 #define CPP_OS_FREEBSD_SPEC "\
812 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
813 -Acpu=powerpc -Amachine=powerpc"
815 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
816 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
817 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
818 #define LINK_START_FREEBSD_SPEC ""
820 #define LINK_OS_FREEBSD_SPEC "\
821 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
823 %{assert*} %{R*} %{rpath*} %{defsym*} \
824 %{shared:-Bshareable %{h*} %{soname*}} \
827 %{rdynamic: -export-dynamic} \
828 -dynamic-linker %(fbsd_dynamic_linker) } \
829 %{static:-Bstatic}} \
830 %{symbolic:-Bsymbolic}"
832 /* GNU/Linux support. */
833 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
834 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
835 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
838 #define STARTFILE_LINUX_SPEC "\
839 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
840 %{mnewlib:ecrti.o%s;:crti.o%s} \
841 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
843 #define STARTFILE_LINUX_SPEC "\
844 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
845 %{mnewlib:ecrti.o%s;:crti.o%s} \
846 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
849 #define ENDFILE_LINUX_SPEC "\
850 %{shared|pie:crtendS.o%s;:crtend.o%s} \
851 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
853 #define LINK_START_LINUX_SPEC ""
855 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
856 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
857 #if DEFAULT_LIBC == LIBC_UCLIBC
858 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
859 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
860 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
862 #error "Unsupported DEFAULT_LIBC"
864 #define LINUX_DYNAMIC_LINKER \
865 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
867 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
868 %{rdynamic:-export-dynamic} \
869 -dynamic-linker " LINUX_DYNAMIC_LINKER "}}"
871 #if defined(HAVE_LD_EH_FRAME_HDR)
872 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
875 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
878 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
879 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
880 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
882 /* GNU/Hurd support. */
883 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
884 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
885 %{profile:-lc_p} %{!profile:-lc}}}"
887 #define STARTFILE_GNU_SPEC "\
888 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
889 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
890 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
891 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
893 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
894 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
896 #define LINK_START_GNU_SPEC ""
898 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
899 %{rdynamic:-export-dynamic} \
900 -dynamic-linker /lib/ld.so.1}}"
902 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
904 %{!ansi: -Dunix -D__unix}} \
905 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
907 /* NetBSD support. */
908 #define LIB_NETBSD_SPEC "\
909 %{profile:-lgmon -lc_p} %{!profile:-lc}"
911 #define STARTFILE_NETBSD_SPEC "\
913 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
915 #define ENDFILE_NETBSD_SPEC "\
916 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
919 #define LINK_START_NETBSD_SPEC "\
922 #define LINK_OS_NETBSD_SPEC "\
923 %{!shared: %{!static: \
924 %{rdynamic:-export-dynamic} \
925 -dynamic-linker /usr/libexec/ld.elf_so}}"
927 #define CPP_OS_NETBSD_SPEC "\
928 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
930 /* OpenBSD support. */
931 #ifndef LIB_OPENBSD_SPEC
932 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
935 #ifndef STARTFILE_OPENBSD_SPEC
936 #define STARTFILE_OPENBSD_SPEC "\
937 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
938 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
941 #ifndef ENDFILE_OPENBSD_SPEC
942 #define ENDFILE_OPENBSD_SPEC "\
943 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
946 #ifndef LINK_START_OPENBSD_SPEC
947 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
950 #ifndef LINK_OS_OPENBSD_SPEC
951 #define LINK_OS_OPENBSD_SPEC ""
954 #ifndef CPP_OS_OPENBSD_SPEC
955 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
958 /* Define any extra SPECS that the compiler needs to generate. */
959 /* Override rs6000.h definition. */
960 #undef SUBTARGET_EXTRA_SPECS
961 #define SUBTARGET_EXTRA_SPECS \
962 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
963 { "lib_ads", LIB_ADS_SPEC }, \
964 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
965 { "lib_mvme", LIB_MVME_SPEC }, \
966 { "lib_sim", LIB_SIM_SPEC }, \
967 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
968 { "lib_gnu", LIB_GNU_SPEC }, \
969 { "lib_linux", LIB_LINUX_SPEC }, \
970 { "lib_netbsd", LIB_NETBSD_SPEC }, \
971 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
972 { "lib_default", LIB_DEFAULT_SPEC }, \
973 { "startfile_ads", STARTFILE_ADS_SPEC }, \
974 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
975 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
976 { "startfile_sim", STARTFILE_SIM_SPEC }, \
977 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
978 { "startfile_gnu", STARTFILE_GNU_SPEC }, \
979 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
980 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
981 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
982 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
983 { "endfile_ads", ENDFILE_ADS_SPEC }, \
984 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
985 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
986 { "endfile_sim", ENDFILE_SIM_SPEC }, \
987 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
988 { "endfile_gnu", ENDFILE_GNU_SPEC }, \
989 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
990 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
991 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
992 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
993 { "link_path", LINK_PATH_SPEC }, \
994 { "link_shlib", LINK_SHLIB_SPEC }, \
995 { "link_target", LINK_TARGET_SPEC }, \
996 { "link_start", LINK_START_SPEC }, \
997 { "link_start_ads", LINK_START_ADS_SPEC }, \
998 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
999 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1000 { "link_start_sim", LINK_START_SIM_SPEC }, \
1001 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
1002 { "link_start_gnu", LINK_START_GNU_SPEC }, \
1003 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1004 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
1005 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
1006 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1007 { "link_os", LINK_OS_SPEC }, \
1008 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1009 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1010 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1011 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1012 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
1013 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1014 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
1015 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
1016 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
1017 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1018 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1019 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1020 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1021 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
1022 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1023 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1024 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1025 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1026 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
1027 { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
1028 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1029 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
1030 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
1031 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
1032 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
1033 SUBSUBTARGET_EXTRA_SPECS
1035 #define SUBSUBTARGET_EXTRA_SPECS
1037 /* Define this macro as a C expression for the initializer of an
1038 array of string to tell the driver program which options are
1039 defaults for this target and thus do not need to be handled
1040 specially when using `MULTILIB_OPTIONS'.
1042 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1043 the target makefile fragment or if none of the options listed in
1044 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1046 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1048 /* Define this macro if the code for function profiling should come
1049 before the function prologue. Normally, the profiling code comes
1051 #define PROFILE_BEFORE_PROLOGUE 1
1053 /* Function name to call to do profiling. */
1054 #define RS6000_MCOUNT "_mcount"
1056 /* Select a format to encode pointers in exception handling data. CODE
1057 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1058 true if the symbol may be affected by dynamic relocations. */
1059 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1060 ((flag_pic || TARGET_RELOCATABLE) \
1061 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1064 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1066 /* Generate entries in .fixup for relocatable addresses. */
1067 #define RELOCATABLE_NEEDS_FIXUP 1
1069 /* This target uses the sysv4.opt file. */
1070 #define TARGET_USES_SYSV4_OPT 1
1072 #undef DBX_REGISTER_NUMBER