rs6000 (SAVE_INLINE_VRS, [...]): Define.
[official-gcc.git] / gcc / config / rs6000 / sysv4.h
blob8737bb14ee0e6b408800da5b0f6da905385c30b0
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, 2011
4 Free Software Foundation, Inc.
5 Contributed by Cygnus Support.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 3, or (at your
12 option) any later version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
28 /* Header files should be C++ aware in general. */
29 #undef NO_IMPLICIT_EXTERN_C
30 #define NO_IMPLICIT_EXTERN_C
32 /* Yes! We are ELF. */
33 #define TARGET_OBJECT_FORMAT OBJECT_ELF
35 /* Default ABI to compile code for. */
36 #define DEFAULT_ABI rs6000_current_abi
38 /* Default ABI to use. */
39 #define RS6000_ABI_NAME "sysv"
41 /* Override rs6000.h definition. */
42 #undef ASM_DEFAULT_SPEC
43 #define ASM_DEFAULT_SPEC "-mppc"
45 #define TARGET_TOC ((target_flags & MASK_64BIT) \
46 || ((target_flags & (MASK_RELOCATABLE \
47 | MASK_MINIMAL_TOC)) \
48 && flag_pic > 1) \
49 || DEFAULT_ABI == ABI_AIX)
51 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
52 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
53 #define TARGET_PROTOTYPE target_prototype
54 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
55 #define TARGET_NO_TOC (! TARGET_TOC)
56 #define TARGET_NO_EABI (! TARGET_EABI)
57 #define TARGET_REGNAMES rs6000_regnames
59 #ifdef HAVE_AS_REL16
60 #undef TARGET_SECURE_PLT
61 #define TARGET_SECURE_PLT secure_plt
62 #endif
64 #define SDATA_DEFAULT_SIZE 8
66 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
67 get control in TARGET_OPTION_OVERRIDE. */
69 #define SUBTARGET_OVERRIDE_OPTIONS \
70 do { \
71 if (!global_options_set.x_g_switch_value) \
72 g_switch_value = SDATA_DEFAULT_SIZE; \
74 if (rs6000_abi_name == NULL) \
75 rs6000_abi_name = RS6000_ABI_NAME; \
77 if (!strcmp (rs6000_abi_name, "sysv")) \
78 rs6000_current_abi = ABI_V4; \
79 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
80 { \
81 rs6000_current_abi = ABI_V4; \
82 target_flags &= ~ MASK_EABI; \
83 } \
84 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
85 || !strcmp (rs6000_abi_name, "eabi")) \
86 { \
87 rs6000_current_abi = ABI_V4; \
88 target_flags |= MASK_EABI; \
89 } \
90 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
91 rs6000_current_abi = ABI_AIX; \
92 else if (!strcmp (rs6000_abi_name, "freebsd") \
93 || !strcmp (rs6000_abi_name, "linux")) \
94 { \
95 if (TARGET_64BIT) \
96 rs6000_current_abi = ABI_AIX; \
97 else \
98 rs6000_current_abi = ABI_V4; \
99 } \
100 else if (!strcmp (rs6000_abi_name, "netbsd")) \
101 rs6000_current_abi = ABI_V4; \
102 else if (!strcmp (rs6000_abi_name, "openbsd")) \
103 rs6000_current_abi = ABI_V4; \
104 else if (!strcmp (rs6000_abi_name, "i960-old")) \
106 rs6000_current_abi = ABI_V4; \
107 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI); \
108 target_flags &= ~MASK_STRICT_ALIGN; \
109 TARGET_NO_BITFIELD_WORD = 1; \
111 else \
113 rs6000_current_abi = ABI_V4; \
114 error ("bad value for -mcall-%s", rs6000_abi_name); \
117 if (rs6000_sdata_name) \
119 if (!strcmp (rs6000_sdata_name, "none")) \
120 rs6000_sdata = SDATA_NONE; \
121 else if (!strcmp (rs6000_sdata_name, "data")) \
122 rs6000_sdata = SDATA_DATA; \
123 else if (!strcmp (rs6000_sdata_name, "default")) \
124 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
125 else if (!strcmp (rs6000_sdata_name, "sysv")) \
126 rs6000_sdata = SDATA_SYSV; \
127 else if (!strcmp (rs6000_sdata_name, "eabi")) \
128 rs6000_sdata = SDATA_EABI; \
129 else \
130 error ("bad value for -msdata=%s", rs6000_sdata_name); \
132 else if (DEFAULT_ABI == ABI_V4) \
134 rs6000_sdata = SDATA_DATA; \
135 rs6000_sdata_name = "data"; \
137 else \
139 rs6000_sdata = SDATA_NONE; \
140 rs6000_sdata_name = "none"; \
143 if (TARGET_RELOCATABLE && \
144 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
146 rs6000_sdata = SDATA_DATA; \
147 error ("-mrelocatable and -msdata=%s are incompatible", \
148 rs6000_sdata_name); \
151 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
152 && (rs6000_sdata == SDATA_EABI \
153 || rs6000_sdata == SDATA_SYSV)) \
155 rs6000_sdata = SDATA_DATA; \
156 error ("-f%s and -msdata=%s are incompatible", \
157 (flag_pic > 1) ? "PIC" : "pic", \
158 rs6000_sdata_name); \
161 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
162 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
164 rs6000_sdata = SDATA_NONE; \
165 error ("-msdata=%s and -mcall-%s are incompatible", \
166 rs6000_sdata_name, rs6000_abi_name); \
169 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
171 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
173 target_flags |= MASK_MINIMAL_TOC; \
174 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
177 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
179 target_flags &= ~MASK_RELOCATABLE; \
180 error ("-mrelocatable and -mcall-%s are incompatible", \
181 rs6000_abi_name); \
184 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
186 flag_pic = 0; \
187 error ("-fPIC and -mcall-%s are incompatible", \
188 rs6000_abi_name); \
191 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
193 target_flags &= ~MASK_LITTLE_ENDIAN; \
194 error ("-mcall-aixdesc must be big endian"); \
197 if (TARGET_SECURE_PLT != secure_plt) \
199 error ("-msecure-plt not supported by your assembler"); \
202 /* Treat -fPIC the same as -mrelocatable. */ \
203 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
205 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC; \
206 TARGET_NO_FP_IN_TOC = 1; \
209 else if (TARGET_RELOCATABLE) \
210 if (!flag_pic) \
211 flag_pic = 2; \
212 } while (0)
214 #ifndef RS6000_BI_ARCH
215 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
216 do { \
217 if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
218 error ("-m%s not supported in this configuration", \
219 (target_flags & MASK_64BIT) ? "64" : "32"); \
220 } while (0)
221 #endif
223 /* Override rs6000.h definition. */
224 #undef TARGET_DEFAULT
225 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
227 /* Override rs6000.h definition. */
228 #undef PROCESSOR_DEFAULT
229 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
231 /* SVR4 only defined for PowerPC, so short-circuit POWER patterns. */
232 #undef TARGET_POWER
233 #define TARGET_POWER 0
235 #define FIXED_R2 1
236 /* System V.4 uses register 13 as a pointer to the small data area,
237 so it is not available to the normal user. */
238 #define FIXED_R13 1
240 /* Override default big endianism definitions in rs6000.h. */
241 #undef BYTES_BIG_ENDIAN
242 #undef WORDS_BIG_ENDIAN
243 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
244 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
246 /* Define cutoff for using external functions to save floating point.
247 When optimizing for size, use external functions when profitable. */
248 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 \
249 || (FIRST_REG) == 63 \
250 || !optimize_size)
252 /* And similarly for general purpose registers. */
253 #define GP_SAVE_INLINE(FIRST_REG) (!optimize_size)
255 /* And vector registers. */
256 #define V_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == LAST_ALTIVEC_REGNO \
257 || !optimize_size)
259 /* Put jump tables in read-only memory, rather than in .text. */
260 #define JUMP_TABLES_IN_TEXT_SECTION 0
262 /* Prefix and suffix to use to saving floating point. */
263 #define SAVE_FP_PREFIX "_savefpr_"
264 #define SAVE_FP_SUFFIX ""
266 /* Prefix and suffix to use to restoring floating point. */
267 #define RESTORE_FP_PREFIX "_restfpr_"
268 #define RESTORE_FP_SUFFIX ""
270 /* Type used for size_t, as a string used in a declaration. */
271 #undef SIZE_TYPE
272 #define SIZE_TYPE "unsigned int"
274 /* Type used for ptrdiff_t, as a string used in a declaration. */
275 #define PTRDIFF_TYPE "int"
277 #undef WCHAR_TYPE
278 #define WCHAR_TYPE "long int"
280 #undef WCHAR_TYPE_SIZE
281 #define WCHAR_TYPE_SIZE 32
283 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
284 /* Override elfos.h definition. */
285 #undef PCC_BITFIELD_TYPE_MATTERS
286 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
288 #undef BITFIELD_NBYTES_LIMITED
289 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
291 /* Define this macro to be the value 1 if instructions will fail to
292 work if given data not on the nominal alignment. If instructions
293 will merely go slower in that case, define this macro as 0. */
294 #undef STRICT_ALIGNMENT
295 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
297 /* Define this macro if you wish to preserve a certain alignment for
298 the stack pointer, greater than what the hardware enforces. The
299 definition is a C expression for the desired alignment (measured
300 in bits). This macro must evaluate to a value equal to or larger
301 than STACK_BOUNDARY.
302 For the SYSV ABI and variants the alignment of the stack pointer
303 is usually controlled manually in rs6000.c. However, to maintain
304 alignment across alloca () in all circumstances,
305 PREFERRED_STACK_BOUNDARY needs to be set as well.
306 This has the additional advantage of allowing a bigger maximum
307 alignment of user objects on the stack. */
309 #undef PREFERRED_STACK_BOUNDARY
310 #define PREFERRED_STACK_BOUNDARY 128
312 /* Real stack boundary as mandated by the appropriate ABI. */
313 #define ABI_STACK_BOUNDARY \
314 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
316 /* An expression for the alignment of a structure field FIELD if the
317 alignment computed in the usual way is COMPUTED. */
318 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
319 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
320 ? 128 : COMPUTED)
322 #undef BIGGEST_FIELD_ALIGNMENT
324 /* Use ELF style section commands. */
326 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
328 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
330 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
332 /* Override elfos.h definition. */
333 #undef INIT_SECTION_ASM_OP
334 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
336 /* Override elfos.h definition. */
337 #undef FINI_SECTION_ASM_OP
338 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
340 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
342 /* Put PC relative got entries in .got2. */
343 #define MINIMAL_TOC_SECTION_ASM_OP \
344 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
345 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
347 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
348 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
349 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
351 /* Override default elf definitions. */
352 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
353 #undef TARGET_ASM_RELOC_RW_MASK
354 #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
355 #undef TARGET_ASM_SELECT_RTX_SECTION
356 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
358 /* Return nonzero if this entry is to be written into the constant pool
359 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
360 containing one of them. If -mfp-in-toc (the default), we also do
361 this for floating-point constants. We actually can only do this
362 if the FP formats of the target and host machines are the same, but
363 we can't check that since not every file that uses these target macros
364 includes real.h.
366 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
367 allow floating point constants in the TOC if -mrelocatable. */
369 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
370 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
371 (TARGET_TOC \
372 && (GET_CODE (X) == SYMBOL_REF \
373 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
374 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
375 || GET_CODE (X) == LABEL_REF \
376 || (GET_CODE (X) == CONST_INT \
377 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
378 || (!TARGET_NO_FP_IN_TOC \
379 && !TARGET_RELOCATABLE \
380 && GET_CODE (X) == CONST_DOUBLE \
381 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
382 && BITS_PER_WORD == HOST_BITS_PER_INT)))
384 /* These macros generate the special .type and .size directives which
385 are used to set the corresponding fields of the linker symbol table
386 entries in an ELF object file under SVR4. These macros also output
387 the starting labels for the relevant functions/objects. */
389 /* Write the extra assembler code needed to declare a function properly.
390 Some svr4 assemblers need to also have something extra said about the
391 function's return value. We allow for that here. */
393 /* Override elfos.h definition. */
394 #undef ASM_DECLARE_FUNCTION_NAME
395 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
396 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
398 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
399 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
401 #define LOCAL_LABEL_PREFIX "."
402 #define USER_LABEL_PREFIX ""
404 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
405 asm_fprintf (FILE, "%L%s", PREFIX)
407 /* Globalizing directive for a label. */
408 #define GLOBAL_ASM_OP "\t.globl "
410 /* This says how to output assembler code to declare an
411 uninitialized internal linkage data object. Under SVR4,
412 the linker seems to want the alignment of data objects
413 to depend on their types. We do exactly that here. */
415 #define LOCAL_ASM_OP "\t.local\t"
417 #define LCOMM_ASM_OP "\t.lcomm\t"
419 /* Describe how to emit uninitialized local items. */
420 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
421 do { \
422 if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \
424 switch_to_section (sbss_section); \
425 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
426 ASM_OUTPUT_LABEL (FILE, NAME); \
427 ASM_OUTPUT_SKIP (FILE, SIZE); \
428 if (!flag_inhibit_size_directive && (SIZE) > 0) \
429 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
431 else \
433 fprintf (FILE, "%s", LCOMM_ASM_OP); \
434 assemble_name ((FILE), (NAME)); \
435 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
436 (SIZE), (ALIGN) / BITS_PER_UNIT); \
438 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
439 } while (0)
441 /* Describe how to emit uninitialized external linkage items. */
442 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
443 do { \
444 ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \
445 } while (0)
447 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
448 /* To support -falign-* switches we need to use .p2align so
449 that alignment directives in code sections will be padded
450 with no-op instructions, rather than zeroes. */
451 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
452 if ((LOG) != 0) \
454 if ((MAX_SKIP) == 0) \
455 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
456 else \
457 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
459 #endif
461 /* This is how to output code to push a register on the stack.
462 It need not be very fast code.
464 On the rs6000, we must keep the backchain up to date. In order
465 to simplify things, always allocate 16 bytes for a push (System V
466 wants to keep stack aligned to a 16 byte boundary). */
468 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
469 do { \
470 if (DEFAULT_ABI == ABI_V4) \
471 asm_fprintf (FILE, \
472 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
473 reg_names[1], reg_names[1], reg_names[REGNO], \
474 reg_names[1]); \
475 } while (0)
477 /* This is how to output an insn to pop a register from the stack.
478 It need not be very fast code. */
480 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
481 do { \
482 if (DEFAULT_ABI == ABI_V4) \
483 asm_fprintf (FILE, \
484 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
485 reg_names[REGNO], reg_names[1], reg_names[1], \
486 reg_names[1]); \
487 } while (0)
489 extern int fixuplabelno;
491 /* Handle constructors specially for -mrelocatable. */
492 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
493 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
495 /* This is the end of what might become sysv4.h. */
497 /* Use DWARF 2 debugging information by default. */
498 #undef PREFERRED_DEBUGGING_TYPE
499 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
501 /* Historically we have also supported stabs debugging. */
502 #define DBX_DEBUGGING_INFO 1
504 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
505 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
507 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
509 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
510 assemble_name (FILE, NAME)
512 /* We have to output the stabs for the function name *first*, before
513 outputting its label. */
515 #define DBX_FUNCTION_FIRST
517 /* This is the end of what might become sysv4dbx.h. */
519 #define TARGET_OS_SYSV_CPP_BUILTINS() \
520 do \
522 if (target_flags_explicit \
523 & MASK_RELOCATABLE) \
524 builtin_define ("_RELOCATABLE"); \
526 while (0)
528 #ifndef TARGET_OS_CPP_BUILTINS
529 #define TARGET_OS_CPP_BUILTINS() \
530 do \
532 builtin_define_std ("PPC"); \
533 builtin_define_std ("unix"); \
534 builtin_define ("__svr4__"); \
535 builtin_assert ("system=unix"); \
536 builtin_assert ("system=svr4"); \
537 builtin_assert ("cpu=powerpc"); \
538 builtin_assert ("machine=powerpc"); \
539 TARGET_OS_SYSV_CPP_BUILTINS (); \
541 while (0)
542 #endif
544 #undef ASM_SPEC
545 #define ASM_SPEC "%(asm_cpu) \
546 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
547 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
548 %{memb|msdata=eabi: -memb} \
549 %{mlittle|mlittle-endian:-mlittle; \
550 mbig|mbig-endian :-mbig; \
551 mcall-aixdesc | \
552 mcall-freebsd | \
553 mcall-netbsd | \
554 mcall-openbsd | \
555 mcall-linux :-mbig; \
556 mcall-i960-old :-mlittle}"
558 #define CC1_ENDIAN_BIG_SPEC ""
560 #define CC1_ENDIAN_LITTLE_SPEC "\
561 %{!mstrict-align: %{!mno-strict-align: \
562 %{!mcall-i960-old: \
563 -mstrict-align \
567 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
569 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
570 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
571 #endif
573 /* Pass -G xxx to the compiler and set correct endian mode. */
574 #define CC1_SPEC "%{G*} %(cc1_cpu) \
575 %{mlittle|mlittle-endian: %(cc1_endian_little); \
576 mbig |mbig-endian : %(cc1_endian_big); \
577 mcall-aixdesc | \
578 mcall-freebsd | \
579 mcall-netbsd | \
580 mcall-openbsd | \
581 mcall-linux : -mbig %(cc1_endian_big); \
582 mcall-i960-old : -mlittle %(cc1_endian_little); \
583 : %(cc1_endian_default)} \
584 %{meabi: %{!mcall-*: -mcall-sysv }} \
585 %{!meabi: %{!mno-eabi: \
586 %{mrelocatable: -meabi } \
587 %{mcall-freebsd: -mno-eabi } \
588 %{mcall-i960-old: -meabi } \
589 %{mcall-linux: -mno-eabi } \
590 %{mcall-netbsd: -mno-eabi } \
591 %{mcall-openbsd: -mno-eabi }}} \
592 %{msdata: -msdata=default} \
593 %{mno-sdata: -msdata=none} \
594 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
595 %{profile: -p}"
597 /* Default starting address if specified. */
598 #define LINK_START_SPEC "\
599 %{mads : %(link_start_ads) ; \
600 myellowknife : %(link_start_yellowknife) ; \
601 mmvme : %(link_start_mvme) ; \
602 msim : %(link_start_sim) ; \
603 mcall-freebsd: %(link_start_freebsd) ; \
604 mcall-linux : %(link_start_linux) ; \
605 mcall-netbsd : %(link_start_netbsd) ; \
606 mcall-openbsd: %(link_start_openbsd) ; \
607 : %(link_start_default) }"
609 #define LINK_START_DEFAULT_SPEC ""
611 #undef LINK_SPEC
612 #define LINK_SPEC "\
613 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
614 %{R*} \
615 %(link_shlib) \
616 %{!T*: %(link_start) } \
617 %(link_target) \
618 %(link_os)"
620 /* Shared libraries are not default. */
621 #define LINK_SHLIB_SPEC "\
622 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
623 %{static: } \
624 %{shared:-G -dy -z text } \
625 %{symbolic:-Bsymbolic -G -dy -z text }"
627 /* Override the default target of the linker. */
628 #define LINK_TARGET_SPEC "\
629 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
630 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
631 %{mcall-i960-old: --oformat elf32-powerpcle} \
632 }}}}"
634 /* Any specific OS flags. */
635 #define LINK_OS_SPEC "\
636 %{mads : %(link_os_ads) ; \
637 myellowknife : %(link_os_yellowknife) ; \
638 mmvme : %(link_os_mvme) ; \
639 msim : %(link_os_sim) ; \
640 mcall-freebsd: %(link_os_freebsd) ; \
641 mcall-linux : %(link_os_linux) ; \
642 mcall-netbsd : %(link_os_netbsd) ; \
643 mcall-openbsd: %(link_os_openbsd) ; \
644 : %(link_os_default) }"
646 #define LINK_OS_DEFAULT_SPEC ""
648 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
649 %<msingle-float %<mdouble-float}"
651 /* Override rs6000.h definition. */
652 #undef CPP_SPEC
653 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
654 %{mads : %(cpp_os_ads) ; \
655 myellowknife : %(cpp_os_yellowknife) ; \
656 mmvme : %(cpp_os_mvme) ; \
657 msim : %(cpp_os_sim) ; \
658 mcall-freebsd: %(cpp_os_freebsd) ; \
659 mcall-linux : %(cpp_os_linux) ; \
660 mcall-netbsd : %(cpp_os_netbsd) ; \
661 mcall-openbsd: %(cpp_os_openbsd) ; \
662 : %(cpp_os_default) }"
664 #define CPP_OS_DEFAULT_SPEC ""
666 #undef STARTFILE_SPEC
667 #define STARTFILE_SPEC "\
668 %{mads : %(startfile_ads) ; \
669 myellowknife : %(startfile_yellowknife) ; \
670 mmvme : %(startfile_mvme) ; \
671 msim : %(startfile_sim) ; \
672 mcall-freebsd: %(startfile_freebsd) ; \
673 mcall-linux : %(startfile_linux) ; \
674 mcall-netbsd : %(startfile_netbsd) ; \
675 mcall-openbsd: %(startfile_openbsd) ; \
676 : %(startfile_default) }"
678 #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
680 #undef LIB_SPEC
681 #define LIB_SPEC "\
682 %{mads : %(lib_ads) ; \
683 myellowknife : %(lib_yellowknife) ; \
684 mmvme : %(lib_mvme) ; \
685 msim : %(lib_sim) ; \
686 mcall-freebsd: %(lib_freebsd) ; \
687 mcall-linux : %(lib_linux) ; \
688 mcall-netbsd : %(lib_netbsd) ; \
689 mcall-openbsd: %(lib_openbsd) ; \
690 : %(lib_default) }"
692 #define LIB_DEFAULT_SPEC "-lc"
694 #undef ENDFILE_SPEC
695 #define ENDFILE_SPEC "\
696 %{mads : %(endfile_ads) ; \
697 myellowknife : %(endfile_yellowknife) ; \
698 mmvme : %(endfile_mvme) ; \
699 msim : %(endfile_sim) ; \
700 mcall-freebsd: %(endfile_freebsd) ; \
701 mcall-linux : %(endfile_linux) ; \
702 mcall-netbsd : %(endfile_netbsd) ; \
703 mcall-openbsd: %(endfile_openbsd) ; \
704 : %(crtsavres_default) %(endfile_default) }"
706 #define CRTSAVRES_DEFAULT_SPEC ""
708 #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
710 /* Motorola ADS support. */
711 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
713 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
715 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
717 #define LINK_START_ADS_SPEC "-T ads.ld%s"
719 #define LINK_OS_ADS_SPEC ""
721 #define CPP_OS_ADS_SPEC ""
723 /* Motorola Yellowknife support. */
724 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
726 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
728 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
730 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
732 #define LINK_OS_YELLOWKNIFE_SPEC ""
734 #define CPP_OS_YELLOWKNIFE_SPEC ""
736 /* Motorola MVME support. */
737 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
739 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
741 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
743 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
745 #define LINK_OS_MVME_SPEC ""
747 #define CPP_OS_MVME_SPEC ""
749 /* PowerPC simulator based on netbsd system calls support. */
750 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
752 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
754 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
756 #define LINK_START_SIM_SPEC ""
758 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
760 #define CPP_OS_SIM_SPEC ""
762 /* FreeBSD support. */
764 #define CPP_OS_FREEBSD_SPEC "\
765 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
766 -Acpu=powerpc -Amachine=powerpc"
768 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
769 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
770 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
771 #define LINK_START_FREEBSD_SPEC ""
773 #define LINK_OS_FREEBSD_SPEC "\
774 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
775 %{v:-V} \
776 %{assert*} %{R*} %{rpath*} %{defsym*} \
777 %{shared:-Bshareable %{h*} %{soname*}} \
778 %{!shared: \
779 %{!static: \
780 %{rdynamic: -export-dynamic} \
781 -dynamic-linker %(fbsd_dynamic_linker) } \
782 %{static:-Bstatic}} \
783 %{symbolic:-Bsymbolic}"
785 /* GNU/Linux support. */
786 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
787 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
788 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
790 #ifdef HAVE_LD_PIE
791 #define STARTFILE_LINUX_SPEC "\
792 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
793 %{mnewlib:ecrti.o%s;:crti.o%s} \
794 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
795 #else
796 #define STARTFILE_LINUX_SPEC "\
797 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
798 %{mnewlib:ecrti.o%s;:crti.o%s} \
799 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
800 #endif
802 #define ENDFILE_LINUX_SPEC "\
803 %{shared|pie:crtendS.o%s;:crtend.o%s} \
804 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
806 #define LINK_START_LINUX_SPEC ""
808 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
809 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
810 #if DEFAULT_LIBC == LIBC_UCLIBC
811 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
812 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
813 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
814 #else
815 #error "Unsupported DEFAULT_LIBC"
816 #endif
817 #define GNU_USER_DYNAMIC_LINKER \
818 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
820 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
821 %{rdynamic:-export-dynamic} \
822 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
824 #if defined(HAVE_LD_EH_FRAME_HDR)
825 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
826 #endif
828 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
829 %{!undef: \
830 %{!ansi: \
831 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
832 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
833 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
835 /* NetBSD support. */
836 #define LIB_NETBSD_SPEC "\
837 -lc"
839 #define STARTFILE_NETBSD_SPEC "\
840 ncrti.o%s crt0.o%s \
841 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
843 #define ENDFILE_NETBSD_SPEC "\
844 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
845 ncrtn.o%s"
847 #define LINK_START_NETBSD_SPEC "\
850 #define LINK_OS_NETBSD_SPEC "\
851 %{!shared: %{!static: \
852 %{rdynamic:-export-dynamic} \
853 -dynamic-linker /usr/libexec/ld.elf_so}}"
855 #define CPP_OS_NETBSD_SPEC "\
856 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
858 /* OpenBSD support. */
859 #ifndef LIB_OPENBSD_SPEC
860 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
861 #endif
863 #ifndef STARTFILE_OPENBSD_SPEC
864 #define STARTFILE_OPENBSD_SPEC "\
865 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
866 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
867 #endif
869 #ifndef ENDFILE_OPENBSD_SPEC
870 #define ENDFILE_OPENBSD_SPEC "\
871 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
872 #endif
874 #ifndef LINK_START_OPENBSD_SPEC
875 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
876 #endif
878 #ifndef LINK_OS_OPENBSD_SPEC
879 #define LINK_OS_OPENBSD_SPEC ""
880 #endif
882 #ifndef CPP_OS_OPENBSD_SPEC
883 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
884 #endif
886 /* Define any extra SPECS that the compiler needs to generate. */
887 /* Override rs6000.h definition. */
888 #undef SUBTARGET_EXTRA_SPECS
889 #define SUBTARGET_EXTRA_SPECS \
890 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
891 { "lib_ads", LIB_ADS_SPEC }, \
892 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
893 { "lib_mvme", LIB_MVME_SPEC }, \
894 { "lib_sim", LIB_SIM_SPEC }, \
895 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
896 { "lib_linux", LIB_LINUX_SPEC }, \
897 { "lib_netbsd", LIB_NETBSD_SPEC }, \
898 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
899 { "lib_default", LIB_DEFAULT_SPEC }, \
900 { "startfile_ads", STARTFILE_ADS_SPEC }, \
901 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
902 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
903 { "startfile_sim", STARTFILE_SIM_SPEC }, \
904 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
905 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
906 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
907 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
908 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
909 { "endfile_ads", ENDFILE_ADS_SPEC }, \
910 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
911 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
912 { "endfile_sim", ENDFILE_SIM_SPEC }, \
913 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
914 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
915 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
916 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
917 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
918 { "link_shlib", LINK_SHLIB_SPEC }, \
919 { "link_target", LINK_TARGET_SPEC }, \
920 { "link_start", LINK_START_SPEC }, \
921 { "link_start_ads", LINK_START_ADS_SPEC }, \
922 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
923 { "link_start_mvme", LINK_START_MVME_SPEC }, \
924 { "link_start_sim", LINK_START_SIM_SPEC }, \
925 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
926 { "link_start_linux", LINK_START_LINUX_SPEC }, \
927 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
928 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
929 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
930 { "link_os", LINK_OS_SPEC }, \
931 { "link_os_ads", LINK_OS_ADS_SPEC }, \
932 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
933 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
934 { "link_os_sim", LINK_OS_SIM_SPEC }, \
935 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
936 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
937 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
938 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
939 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
940 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
941 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
942 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
943 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
944 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
945 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
946 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
947 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
948 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
949 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
950 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
951 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
952 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
953 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
954 SUBSUBTARGET_EXTRA_SPECS
956 #define SUBSUBTARGET_EXTRA_SPECS
958 /* Define this macro as a C expression for the initializer of an
959 array of string to tell the driver program which options are
960 defaults for this target and thus do not need to be handled
961 specially when using `MULTILIB_OPTIONS'.
963 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
964 the target makefile fragment or if none of the options listed in
965 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
967 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
969 /* Define this macro if the code for function profiling should come
970 before the function prologue. Normally, the profiling code comes
971 after. */
972 #define PROFILE_BEFORE_PROLOGUE 1
974 /* Function name to call to do profiling. */
975 #define RS6000_MCOUNT "_mcount"
977 /* Select a format to encode pointers in exception handling data. CODE
978 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
979 true if the symbol may be affected by dynamic relocations. */
980 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
981 ((flag_pic || TARGET_RELOCATABLE) \
982 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
983 : DW_EH_PE_absptr)
985 #define DOUBLE_INT_ASM_OP "\t.quad\t"
987 /* Generate entries in .fixup for relocatable addresses. */
988 #define RELOCATABLE_NEEDS_FIXUP 1
990 #define TARGET_ASM_FILE_END rs6000_elf_file_end
992 /* This target uses the sysv4.opt file. */
993 #define TARGET_USES_SYSV4_OPT 1
995 #undef DBX_REGISTER_NUMBER