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 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 2, 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 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the
20 Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA. */
23 /* Header files should be C++ aware in general. */
24 #define NO_IMPLICIT_EXTERN_C
26 /* Yes! We are ELF. */
27 #define TARGET_OBJECT_FORMAT OBJECT_ELF
29 /* Default ABI to compile code for. */
30 #define DEFAULT_ABI rs6000_current_abi
32 /* Default ABI to use. */
33 #define RS6000_ABI_NAME "sysv"
35 /* Override rs6000.h definition. */
36 #undef ASM_DEFAULT_SPEC
37 #define ASM_DEFAULT_SPEC "-mppc"
39 /* Small data support types. */
40 enum rs6000_sdata_type {
41 SDATA_NONE, /* No small data support. */
42 SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */
43 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */
44 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */
47 extern enum rs6000_sdata_type rs6000_sdata;
49 /* V.4/eabi switches. */
50 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */
51 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
52 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */
53 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */
54 #define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */
55 #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
56 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
57 #define MASK_NO_BITFIELD_WORD 0x00800000 /* Bitfields cannot cross word boundaries */
59 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
60 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
61 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
62 #define TARGET_EABI (target_flags & MASK_EABI)
63 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
64 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
65 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
66 #define TARGET_NO_BITFIELD_WORD (target_flags & MASK_NO_BITFIELD_WORD)
67 #define TARGET_TOC ((target_flags & MASK_64BIT) \
68 || ((target_flags & (MASK_RELOCATABLE \
69 | MASK_MINIMAL_TOC)) \
71 || DEFAULT_ABI == ABI_AIX)
73 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
74 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
75 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
76 #define TARGET_NO_TOC (! TARGET_TOC)
77 #define TARGET_NO_EABI (! TARGET_EABI)
79 /* Strings provided by SUBTARGET_OPTIONS */
80 extern const char *rs6000_abi_name;
81 extern const char *rs6000_sdata_name;
82 extern const char *rs6000_tls_size_string; /* For -mtls-size= */
84 /* Override rs6000.h definition. */
85 #undef SUBTARGET_OPTIONS
86 #define SUBTARGET_OPTIONS \
87 { "call-", &rs6000_abi_name, N_("Select ABI calling convention"), 0}, \
88 { "sdata=", &rs6000_sdata_name, N_("Select method for sdata handling"), 0}, \
89 { "tls-size=", &rs6000_tls_size_string, \
90 N_("Specify bit size of immediate TLS offsets"), 0 }
92 #define SDATA_DEFAULT_SIZE 8
94 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
95 the same as -mminimal-toc. */
96 /* Override rs6000.h definition. */
97 #undef SUBTARGET_SWITCHES
98 #define SUBTARGET_SWITCHES \
99 { "bit-align", -MASK_NO_BITFIELD_TYPE, \
100 N_("Align to the base type of the bit-field") }, \
101 { "no-bit-align", MASK_NO_BITFIELD_TYPE, \
102 N_("Don't align to the base type of the bit-field") }, \
103 { "strict-align", MASK_STRICT_ALIGN, \
104 N_("Don't assume that unaligned accesses are handled by the system") }, \
105 { "no-strict-align", -MASK_STRICT_ALIGN, \
106 N_("Assume that unaligned accesses are handled by the system") }, \
107 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
108 N_("Produce code relocatable at runtime") }, \
109 { "no-relocatable", -MASK_RELOCATABLE, \
110 N_("Don't produce code relocatable at runtime") }, \
111 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
112 N_("Produce code relocatable at runtime") }, \
113 { "no-relocatable-lib", -MASK_RELOCATABLE, \
114 N_("Don't produce code relocatable at runtime") }, \
115 { "little-endian", MASK_LITTLE_ENDIAN, \
116 N_("Produce little endian code") }, \
117 { "little", MASK_LITTLE_ENDIAN, \
118 N_("Produce little endian code") }, \
119 { "big-endian", -MASK_LITTLE_ENDIAN, \
120 N_("Produce big endian code") }, \
121 { "big", -MASK_LITTLE_ENDIAN, \
122 N_("Produce big endian code") }, \
123 { "no-toc", 0, N_("no description yet") }, \
124 { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
125 { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
126 { "prototype", MASK_PROTOTYPE, \
127 N_("Assume all variable arg functions are prototyped") }, \
128 { "no-prototype", -MASK_PROTOTYPE, \
129 N_("Non-prototyped functions might take a variable number of args") }, \
130 { "no-traceback", 0, N_("no description yet") }, \
131 { "eabi", MASK_EABI, N_("Use EABI") }, \
132 { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \
133 { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \
134 { "no-bit-word", MASK_NO_BITFIELD_WORD, \
135 N_("Do not allow bit-fields to cross word boundaries") }, \
136 { "regnames", MASK_REGNAMES, \
137 N_("Use alternate register names") }, \
138 { "no-regnames", -MASK_REGNAMES, \
139 N_("Don't use alternate register names") }, \
140 { "sdata", 0, N_("no description yet") }, \
141 { "no-sdata", 0, N_("no description yet") }, \
143 N_("Link with libsim.a, libc.a and sim-crt0.o") }, \
145 N_("Link with libads.a, libc.a and crt0.o") }, \
146 { "yellowknife", 0, \
147 N_("Link with libyk.a, libc.a and crt0.o") }, \
149 N_("Link with libmvme.a, libc.a and crt0.o") }, \
151 N_("Set the PPC_EMB bit in the ELF flags header") }, \
152 { "windiss", 0, N_("Use the WindISS simulator") }, \
153 { "shlib", 0, N_("no description yet") }, \
154 { "64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC, \
155 N_("Generate 64-bit code") }, \
156 { "32", - (MASK_64BIT | MASK_POWERPC64), \
157 N_("Generate 32-bit code") }, \
158 EXTRA_SUBTARGET_SWITCHES \
159 { "newlib", 0, N_("no description yet") },
161 /* This is meant to be redefined in the host dependent files. */
162 #define EXTRA_SUBTARGET_SWITCHES
164 /* Sometimes certain combinations of command options do not make sense
165 on a particular target machine. You can define a macro
166 `OVERRIDE_OPTIONS' to take account of this. This macro, if
167 defined, is executed once just after all the command options have
170 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
173 #define SUBTARGET_OVERRIDE_OPTIONS \
176 g_switch_value = SDATA_DEFAULT_SIZE; \
178 if (rs6000_abi_name == NULL) \
179 rs6000_abi_name = RS6000_ABI_NAME; \
181 if (!strcmp (rs6000_abi_name, "sysv")) \
182 rs6000_current_abi = ABI_V4; \
183 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
185 rs6000_current_abi = ABI_V4; \
186 target_flags &= ~ MASK_EABI; \
188 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
189 || !strcmp (rs6000_abi_name, "eabi")) \
191 rs6000_current_abi = ABI_V4; \
192 target_flags |= MASK_EABI; \
194 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
195 rs6000_current_abi = ABI_AIX; \
196 else if (!strcmp (rs6000_abi_name, "freebsd")) \
197 rs6000_current_abi = ABI_V4; \
198 else if (!strcmp (rs6000_abi_name, "linux")) \
199 rs6000_current_abi = ABI_V4; \
200 else if (!strcmp (rs6000_abi_name, "gnu")) \
201 rs6000_current_abi = ABI_V4; \
202 else if (!strcmp (rs6000_abi_name, "netbsd")) \
203 rs6000_current_abi = ABI_V4; \
204 else if (!strcmp (rs6000_abi_name, "openbsd")) \
205 rs6000_current_abi = ABI_V4; \
206 else if (!strcmp (rs6000_abi_name, "i960-old")) \
208 rs6000_current_abi = ABI_V4; \
209 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \
210 | MASK_NO_BITFIELD_WORD); \
211 target_flags &= ~MASK_STRICT_ALIGN; \
215 rs6000_current_abi = ABI_V4; \
216 error ("bad value for -mcall-%s", rs6000_abi_name); \
219 if (rs6000_sdata_name) \
221 if (!strcmp (rs6000_sdata_name, "none")) \
222 rs6000_sdata = SDATA_NONE; \
223 else if (!strcmp (rs6000_sdata_name, "data")) \
224 rs6000_sdata = SDATA_DATA; \
225 else if (!strcmp (rs6000_sdata_name, "default")) \
226 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
227 else if (!strcmp (rs6000_sdata_name, "sysv")) \
228 rs6000_sdata = SDATA_SYSV; \
229 else if (!strcmp (rs6000_sdata_name, "eabi")) \
230 rs6000_sdata = SDATA_EABI; \
232 error ("bad value for -msdata=%s", rs6000_sdata_name); \
234 else if (DEFAULT_ABI == ABI_V4) \
236 rs6000_sdata = SDATA_DATA; \
237 rs6000_sdata_name = "data"; \
241 rs6000_sdata = SDATA_NONE; \
242 rs6000_sdata_name = "none"; \
245 if (TARGET_RELOCATABLE && \
246 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
248 rs6000_sdata = SDATA_DATA; \
249 error ("-mrelocatable and -msdata=%s are incompatible", \
250 rs6000_sdata_name); \
253 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
254 && (rs6000_sdata == SDATA_EABI \
255 || rs6000_sdata == SDATA_SYSV)) \
257 rs6000_sdata = SDATA_DATA; \
258 error ("-f%s and -msdata=%s are incompatible", \
259 (flag_pic > 1) ? "PIC" : "pic", \
260 rs6000_sdata_name); \
263 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
264 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
266 rs6000_sdata = SDATA_NONE; \
267 error ("-msdata=%s and -mcall-%s are incompatible", \
268 rs6000_sdata_name, rs6000_abi_name); \
271 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
273 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
275 target_flags |= MASK_MINIMAL_TOC; \
276 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
279 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
281 target_flags &= ~MASK_RELOCATABLE; \
282 error ("-mrelocatable and -mcall-%s are incompatible", \
286 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
289 error ("-fPIC and -mcall-%s are incompatible", \
293 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
295 target_flags &= ~MASK_LITTLE_ENDIAN; \
296 error ("-mcall-aixdesc must be big endian"); \
299 /* Treat -fPIC the same as -mrelocatable. */ \
300 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
301 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
303 else if (TARGET_RELOCATABLE) \
307 #ifndef RS6000_BI_ARCH
308 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
310 if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
311 error ("-m%s not supported in this configuration", \
312 (target_flags & MASK_64BIT) ? "64" : "32"); \
316 /* Override rs6000.h definition. */
317 #undef TARGET_DEFAULT
318 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
320 /* Override rs6000.h definition. */
321 #undef PROCESSOR_DEFAULT
322 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
325 /* System V.4 uses register 13 as a pointer to the small data area,
326 so it is not available to the normal user. */
329 /* Size of the V.4 varargs area if needed. */
330 /* Override rs6000.h definition. */
331 #undef RS6000_VARARGS_AREA
332 #define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
334 /* Override default big endianism definitions in rs6000.h. */
335 #undef BYTES_BIG_ENDIAN
336 #undef WORDS_BIG_ENDIAN
337 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
338 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
340 /* Define this to set the endianness to use in libgcc2.c, which can
341 not depend on target_flags. */
342 #if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
343 #define LIBGCC2_WORDS_BIG_ENDIAN 1
345 #define LIBGCC2_WORDS_BIG_ENDIAN 0
348 /* Define cutoff for using external functions to save floating point.
349 Currently on V.4, always use inline stores. */
350 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
352 /* Put jump tables in read-only memory, rather than in .text. */
353 #define JUMP_TABLES_IN_TEXT_SECTION 0
355 /* Prefix and suffix to use to saving floating point. */
356 #define SAVE_FP_PREFIX "_savefpr_"
357 #define SAVE_FP_SUFFIX "_l"
359 /* Prefix and suffix to use to restoring floating point. */
360 #define RESTORE_FP_PREFIX "_restfpr_"
361 #define RESTORE_FP_SUFFIX "_l"
363 /* Type used for ptrdiff_t, as a string used in a declaration. */
364 #define PTRDIFF_TYPE "int"
366 /* Type used for wchar_t, as a string used in a declaration. */
367 /* Override svr4.h definition. */
369 #define WCHAR_TYPE "long int"
371 /* Width of wchar_t in bits. */
372 /* Override svr4.h definition. */
373 #undef WCHAR_TYPE_SIZE
374 #define WCHAR_TYPE_SIZE 32
376 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
377 /* Override elfos.h definition. */
378 #undef PCC_BITFIELD_TYPE_MATTERS
379 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
381 #undef BITFIELD_NBYTES_LIMITED
382 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
384 /* Define this macro to be the value 1 if instructions will fail to
385 work if given data not on the nominal alignment. If instructions
386 will merely go slower in that case, define this macro as 0. */
387 #undef STRICT_ALIGNMENT
388 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
390 /* Define this macro if you wish to preserve a certain alignment for
391 the stack pointer, greater than what the hardware enforces. The
392 definition is a C expression for the desired alignment (measured
393 in bits). This macro must evaluate to a value equal to or larger
395 For the SYSV ABI and variants the alignment of the stack pointer
396 is usually controlled manually in rs6000.c. However, to maintain
397 alignment across alloca () in all circumstances,
398 PREFERRED_STACK_BOUNDARY needs to be set as well.
399 This has the additional advantage of allowing a bigger maximum
400 alignment of user objects on the stack. */
402 #undef PREFERRED_STACK_BOUNDARY
403 #define PREFERRED_STACK_BOUNDARY 128
405 /* Real stack boundary as mandated by the appropriate ABI. */
406 #define ABI_STACK_BOUNDARY \
407 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
409 /* An expression for the alignment of a structure field FIELD if the
410 alignment computed in the usual way is COMPUTED. */
411 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
412 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
415 /* Define this macro as an expression for the alignment of a type
416 (given by TYPE as a tree node) if the alignment computed in the
417 usual way is COMPUTED and the alignment explicitly specified was
419 #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
420 ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) \
421 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \
422 : MAX (COMPUTED, SPECIFIED))
424 #undef BIGGEST_FIELD_ALIGNMENT
426 /* Use ELF style section commands. */
428 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
430 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
432 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
434 /* Override elfos.h definition. */
435 #undef INIT_SECTION_ASM_OP
436 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
438 /* Override elfos.h definition. */
439 #undef FINI_SECTION_ASM_OP
440 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
442 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
444 /* Put PC relative got entries in .got2. */
445 #define MINIMAL_TOC_SECTION_ASM_OP \
446 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
447 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
449 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
450 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
451 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
453 /* Besides the usual ELF sections, we need a toc section. */
454 /* Override elfos.h definition. */
455 #undef EXTRA_SECTIONS
456 #define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
458 /* Override elfos.h definition. */
459 #undef EXTRA_SECTION_FUNCTIONS
460 #define EXTRA_SECTION_FUNCTIONS \
461 TOC_SECTION_FUNCTION \
462 SDATA_SECTION_FUNCTION \
463 SDATA2_SECTION_FUNCTION \
464 SBSS_SECTION_FUNCTION \
465 INIT_SECTION_FUNCTION \
466 FINI_SECTION_FUNCTION
468 #define TOC_SECTION_FUNCTION \
472 if (in_section != in_toc) \
474 in_section = in_toc; \
475 if (DEFAULT_ABI == ABI_AIX \
476 && TARGET_MINIMAL_TOC \
477 && !TARGET_RELOCATABLE) \
479 if (! toc_initialized) \
481 toc_initialized = 1; \
482 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
483 (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \
484 fprintf (asm_out_file, "\t.tc "); \
485 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
486 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
487 fprintf (asm_out_file, "\n"); \
489 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
490 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
491 fprintf (asm_out_file, " = .+32768\n"); \
494 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
496 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
497 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
500 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
501 if (! toc_initialized) \
503 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
504 fprintf (asm_out_file, " = .+32768\n"); \
505 toc_initialized = 1; \
511 extern int in_toc_section (void); \
512 int in_toc_section (void) \
514 return in_section == in_toc; \
517 #define SDATA_SECTION_FUNCTION \
519 sdata_section (void) \
521 if (in_section != in_sdata) \
523 in_section = in_sdata; \
524 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
528 #define SDATA2_SECTION_FUNCTION \
530 sdata2_section (void) \
532 if (in_section != in_sdata2) \
534 in_section = in_sdata2; \
535 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
539 #define SBSS_SECTION_FUNCTION \
541 sbss_section (void) \
543 if (in_section != in_sbss) \
545 in_section = in_sbss; \
546 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
550 #define INIT_SECTION_FUNCTION \
552 init_section (void) \
554 if (in_section != in_init) \
556 in_section = in_init; \
557 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
561 #define FINI_SECTION_FUNCTION \
563 fini_section (void) \
565 if (in_section != in_fini) \
567 in_section = in_fini; \
568 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
572 /* Override default elf definitions. */
573 #undef TARGET_ASM_SELECT_RTX_SECTION
574 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
575 #undef TARGET_ASM_SELECT_SECTION
576 #define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section
577 #define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section
579 /* Return nonzero if this entry is to be written into the constant pool
580 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
581 containing one of them. If -mfp-in-toc (the default), we also do
582 this for floating-point constants. We actually can only do this
583 if the FP formats of the target and host machines are the same, but
584 we can't check that since not every file that uses
585 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
587 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
588 allow floating point constants in the TOC if -mrelocatable. */
590 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
591 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
593 && (GET_CODE (X) == SYMBOL_REF \
594 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
595 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
596 || GET_CODE (X) == LABEL_REF \
597 || (GET_CODE (X) == CONST_INT \
598 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
599 || (!TARGET_NO_FP_IN_TOC \
600 && !TARGET_RELOCATABLE \
601 && GET_CODE (X) == CONST_DOUBLE \
602 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
603 && BITS_PER_WORD == HOST_BITS_PER_INT)))
605 /* These macros generate the special .type and .size directives which
606 are used to set the corresponding fields of the linker symbol table
607 entries in an ELF object file under SVR4. These macros also output
608 the starting labels for the relevant functions/objects. */
610 /* Write the extra assembler code needed to declare a function properly.
611 Some svr4 assemblers need to also have something extra said about the
612 function's return value. We allow for that here. */
614 extern int rs6000_pic_labelno;
616 /* Override elfos.h definition. */
617 #undef ASM_DECLARE_FUNCTION_NAME
618 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
619 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
621 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
622 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
624 #define LOCAL_LABEL_PREFIX "."
625 #define USER_LABEL_PREFIX ""
627 /* svr4.h overrides (*targetm.asm_out.internal_label). */
629 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
630 asm_fprintf (FILE, "%L%s", PREFIX)
632 /* Globalizing directive for a label. */
633 #define GLOBAL_ASM_OP "\t.globl "
635 /* This says how to output assembler code to declare an
636 uninitialized internal linkage data object. Under SVR4,
637 the linker seems to want the alignment of data objects
638 to depend on their types. We do exactly that here. */
640 #define LOCAL_ASM_OP "\t.local\t"
642 #define LCOMM_ASM_OP "\t.lcomm\t"
644 /* Override elfos.h definition. */
645 #undef ASM_OUTPUT_ALIGNED_LOCAL
646 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
648 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
649 && (SIZE) <= g_switch_value) \
652 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
653 ASM_OUTPUT_LABEL (FILE, NAME); \
654 ASM_OUTPUT_SKIP (FILE, SIZE); \
655 if (!flag_inhibit_size_directive && (SIZE) > 0) \
656 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
660 fprintf (FILE, "%s", LCOMM_ASM_OP); \
661 assemble_name ((FILE), (NAME)); \
662 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
663 (SIZE), (ALIGN) / BITS_PER_UNIT); \
665 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
668 /* Describe how to emit uninitialized external linkage items. */
669 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
671 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
674 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
675 /* To support -falign-* switches we need to use .p2align so
676 that alignment directives in code sections will be padded
677 with no-op instructions, rather than zeroes. */
678 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
681 if ((MAX_SKIP) == 0) \
682 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
684 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
688 /* This is how to output code to push a register on the stack.
689 It need not be very fast code.
691 On the rs6000, we must keep the backchain up to date. In order
692 to simplify things, always allocate 16 bytes for a push (System V
693 wants to keep stack aligned to a 16 byte boundary). */
695 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
697 if (DEFAULT_ABI == ABI_V4) \
699 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
700 reg_names[1], reg_names[1], reg_names[REGNO], \
704 /* This is how to output an insn to pop a register from the stack.
705 It need not be very fast code. */
707 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
709 if (DEFAULT_ABI == ABI_V4) \
711 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
712 reg_names[REGNO], reg_names[1], reg_names[1], \
716 /* Switch Recognition by gcc.c. Add -G xx support. */
718 /* Override svr4.h definition. */
719 #undef SWITCH_TAKES_ARG
720 #define SWITCH_TAKES_ARG(CHAR) \
721 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
722 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
723 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
724 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
725 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
727 extern int fixuplabelno;
729 /* Handle constructors specially for -mrelocatable. */
730 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
731 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
733 /* This is the end of what might become sysv4.h. */
735 /* Use DWARF 2 debugging information by default. */
736 #undef PREFERRED_DEBUGGING_TYPE
737 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
739 /* Historically we have also supported stabs debugging. */
740 #define DBX_DEBUGGING_INFO 1
742 #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
744 /* Map register numbers held in the call frame info that gcc has
745 collected using DWARF_FRAME_REGNUM to those that should be output in
746 .debug_frame and .eh_frame. We continue to use gcc hard reg numbers
747 for .eh_frame, but use the numbers mandated by the various ABIs for
748 .debug_frame. rs6000_emit_prologue has translated any combination of
749 CR2, CR3, CR4 saves to a save of CR2. The actual code emitted saves
750 the whole of CR, so we map CR2_REGNO to the DWARF reg for CR. */
751 #define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) \
752 ((FOR_EH) ? (REGNO) \
753 : (REGNO) == CR2_REGNO ? 64 \
754 : DBX_REGISTER_NUMBER (REGNO))
756 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
757 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
758 #define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags
760 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
762 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
763 assemble_name (FILE, NAME)
765 /* We have to output the stabs for the function name *first*, before
766 outputting its label. */
768 #define DBX_FUNCTION_FIRST
770 /* This is the end of what might become sysv4dbx.h. */
772 #ifndef TARGET_VERSION
773 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
776 #define TARGET_OS_SYSV_CPP_BUILTINS() \
781 builtin_define ("__pic__=1"); \
782 builtin_define ("__PIC__=1"); \
784 else if (flag_pic == 2) \
786 builtin_define ("__pic__=2"); \
787 builtin_define ("__PIC__=2"); \
789 if (target_flags_explicit \
790 & MASK_RELOCATABLE) \
791 builtin_define ("_RELOCATABLE"); \
795 #ifndef TARGET_OS_CPP_BUILTINS
796 #define TARGET_OS_CPP_BUILTINS() \
799 builtin_define_std ("PPC"); \
800 builtin_define_std ("unix"); \
801 builtin_define ("__svr4__"); \
802 builtin_assert ("system=unix"); \
803 builtin_assert ("system=svr4"); \
804 builtin_assert ("cpu=powerpc"); \
805 builtin_assert ("machine=powerpc"); \
806 TARGET_OS_SYSV_CPP_BUILTINS (); \
811 /* Pass various options to the assembler. */
812 /* Override svr4.h definition. */
814 #define ASM_SPEC "%(asm_cpu) \
815 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
816 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
817 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
818 %{memb|msdata|msdata=eabi: -memb} \
819 %{mlittle|mlittle-endian:-mlittle; \
820 mbig|mbig-endian :-mbig; \
827 mcall-i960-old :-mlittle}"
829 #define CC1_ENDIAN_BIG_SPEC ""
831 #define CC1_ENDIAN_LITTLE_SPEC "\
832 %{!mstrict-align: %{!mno-strict-align: \
838 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
840 /* Pass -G xxx to the compiler and set correct endian mode. */
841 #define CC1_SPEC "%{G*} \
842 %{mlittle|mlittle-endian: %(cc1_endian_little); \
843 mbig |mbig-endian : %(cc1_endian_big); \
849 mcall-gnu : -mbig %(cc1_endian_big); \
850 mcall-i960-old : -mlittle %(cc1_endian_little); \
851 : %(cc1_endian_default)} \
852 %{mno-sdata: -msdata=none } \
853 %{meabi: %{!mcall-*: -mcall-sysv }} \
854 %{!meabi: %{!mno-eabi: \
855 %{mrelocatable: -meabi } \
856 %{mcall-freebsd: -mno-eabi } \
857 %{mcall-i960-old: -meabi } \
858 %{mcall-linux: -mno-eabi } \
859 %{mcall-gnu: -mno-eabi } \
860 %{mcall-netbsd: -mno-eabi } \
861 %{mcall-openbsd: -mno-eabi }}} \
862 %{msdata: -msdata=default} \
863 %{mno-sdata: -msdata=none} \
866 /* Don't put -Y P,<path> for cross compilers. */
867 #ifndef CROSS_COMPILE
868 #define LINK_PATH_SPEC "\
870 %{!nostdlib: %{!YP,*: \
872 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
873 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
874 %{!R*: %{!L*: -R /usr/ucblib}} \
876 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
877 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
880 #define LINK_PATH_SPEC ""
883 /* Default starting address if specified. */
884 #define LINK_START_SPEC "\
885 %{mads : %(link_start_ads) ; \
886 myellowknife : %(link_start_yellowknife) ; \
887 mmvme : %(link_start_mvme) ; \
888 msim : %(link_start_sim) ; \
889 mwindiss : %(link_start_windiss) ; \
890 mcall-freebsd: %(link_start_freebsd) ; \
891 mcall-linux : %(link_start_linux) ; \
892 mcall-gnu : %(link_start_gnu) ; \
893 mcall-netbsd : %(link_start_netbsd) ; \
894 mcall-openbsd: %(link_start_openbsd) ; \
895 : %(link_start_default) }"
897 #define LINK_START_DEFAULT_SPEC ""
899 /* Override svr4.h definition. */
902 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
906 %{!Wl,-T*: %{!T*: %(link_start) }} \
910 /* For now, turn off shared libraries by default. */
911 #ifndef SHARED_LIB_SUPPORT
912 #define NO_SHARED_LIB_SUPPORT
915 #ifndef NO_SHARED_LIB_SUPPORT
916 /* Shared libraries are default. */
917 #define LINK_SHLIB_SPEC "\
918 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
920 %{static:-dn -Bstatic} \
921 %{shared:-G -dy -z text} \
922 %{symbolic:-Bsymbolic -G -dy -z text}"
925 /* Shared libraries are not default. */
926 #define LINK_SHLIB_SPEC "\
927 %{mshlib: %(link_path) } \
928 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
930 %{shared:-G -dy -z text %(link_path) } \
931 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
934 /* Override the default target of the linker. */
935 #define LINK_TARGET_SPEC "\
936 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
937 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
938 %{mcall-i960-old: --oformat elf32-powerpcle} \
941 /* Any specific OS flags. */
942 #define LINK_OS_SPEC "\
943 %{mads : %(link_os_ads) ; \
944 myellowknife : %(link_os_yellowknife) ; \
945 mmvme : %(link_os_mvme) ; \
946 msim : %(link_os_sim) ; \
947 mwindiss : %(link_os_windiss) ; \
948 mcall-freebsd: %(link_os_freebsd) ; \
949 mcall-linux : %(link_os_linux) ; \
950 mcall-gnu : %(link_os_gnu) ; \
951 mcall-netbsd : %(link_os_netbsd) ; \
952 mcall-openbsd: %(link_os_openbsd) ; \
953 : %(link_os_default) }"
955 #define LINK_OS_DEFAULT_SPEC ""
957 /* Override rs6000.h definition. */
959 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
960 %{mads : %(cpp_os_ads) ; \
961 myellowknife : %(cpp_os_yellowknife) ; \
962 mmvme : %(cpp_os_mvme) ; \
963 msim : %(cpp_os_sim) ; \
964 mwindiss : %(cpp_os_windiss) ; \
965 mcall-freebsd: %(cpp_os_freebsd) ; \
966 mcall-linux : %(cpp_os_linux) ; \
967 mcall-gnu : %(cpp_os_gnu) ; \
968 mcall-netbsd : %(cpp_os_netbsd) ; \
969 mcall-openbsd: %(cpp_os_openbsd) ; \
970 : %(cpp_os_default) }"
972 #define CPP_OS_DEFAULT_SPEC ""
974 /* Override svr4.h definition. */
975 #undef STARTFILE_SPEC
976 #define STARTFILE_SPEC "\
977 %{mads : %(startfile_ads) ; \
978 myellowknife : %(startfile_yellowknife) ; \
979 mmvme : %(startfile_mvme) ; \
980 msim : %(startfile_sim) ; \
981 mwindiss : %(startfile_windiss) ; \
982 mcall-freebsd: %(startfile_freebsd) ; \
983 mcall-linux : %(startfile_linux) ; \
984 mcall-gnu : %(startfile_gnu) ; \
985 mcall-netbsd : %(startfile_netbsd) ; \
986 mcall-openbsd: %(startfile_openbsd) ; \
987 : %(startfile_default) }"
989 #define STARTFILE_DEFAULT_SPEC ""
991 /* Override svr4.h definition. */
994 %{mads : %(lib_ads) ; \
995 myellowknife : %(lib_yellowknife) ; \
996 mmvme : %(lib_mvme) ; \
997 msim : %(lib_sim) ; \
998 mwindiss : %(lib_windiss) ; \
999 mcall-freebsd: %(lib_freebsd) ; \
1000 mcall-linux : %(lib_linux) ; \
1001 mcall-gnu : %(lib_gnu) ; \
1002 mcall-netbsd : %(lib_netbsd) ; \
1003 mcall-openbsd: %(lib_openbsd) ; \
1006 #define LIB_DEFAULT_SPEC ""
1008 /* Override svr4.h definition. */
1010 #define ENDFILE_SPEC "\
1011 %{mads : crtsavres.o%s %(endfile_ads) ; \
1012 myellowknife : crtsavres.o%s %(endfile_yellowknife) ; \
1013 mmvme : crtsavres.o%s %(endfile_mvme) ; \
1014 msim : crtsavres.o%s %(endfile_sim) ; \
1015 mwindiss : %(endfile_windiss) ; \
1016 mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \
1017 mcall-linux : crtsavres.o%s %(endfile_linux) ; \
1018 mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \
1019 mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \
1020 mcall-openbsd: crtsavres.o%s %(endfile_openbsd) ; \
1021 : %(crtsavres_default) %(endfile_default) }"
1023 #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
1025 #define ENDFILE_DEFAULT_SPEC ""
1027 /* Motorola ADS support. */
1028 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1030 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1032 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
1034 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1036 #define LINK_OS_ADS_SPEC ""
1038 #define CPP_OS_ADS_SPEC ""
1040 /* Motorola Yellowknife support. */
1041 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1043 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1045 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
1047 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1049 #define LINK_OS_YELLOWKNIFE_SPEC ""
1051 #define CPP_OS_YELLOWKNIFE_SPEC ""
1053 /* Motorola MVME support. */
1054 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1056 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1058 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
1060 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
1062 #define LINK_OS_MVME_SPEC ""
1064 #define CPP_OS_MVME_SPEC ""
1066 /* PowerPC simulator based on netbsd system calls support. */
1067 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1069 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
1071 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
1073 #define LINK_START_SIM_SPEC ""
1075 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
1077 #define CPP_OS_SIM_SPEC ""
1079 /* FreeBSD support. */
1081 #define CPP_OS_FREEBSD_SPEC "\
1082 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
1083 -Acpu=powerpc -Amachine=powerpc"
1085 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
1086 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
1087 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
1088 #define LINK_START_FREEBSD_SPEC ""
1090 #define LINK_OS_FREEBSD_SPEC "\
1091 %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
1094 %{assert*} %{R*} %{rpath*} %{defsym*} \
1095 %{shared:-Bshareable %{h*} %{soname*}} \
1098 %{rdynamic: -export-dynamic} \
1099 %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
1100 %{static:-Bstatic}} \
1101 %{symbolic:-Bsymbolic}"
1103 /* GNU/Linux support. */
1104 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1105 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
1106 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
1109 #define STARTFILE_LINUX_SPEC "\
1110 %{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
1111 %{mnewlib:ecrti.o%s;:crti.o%s} \
1112 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1114 #define STARTFILE_LINUX_SPEC "\
1115 %{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}} \
1116 %{mnewlib:ecrti.o%s;:crti.o%s} \
1117 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1120 #define ENDFILE_LINUX_SPEC "\
1121 %{shared|pie:crtendS.o%s;:crtend.o%s} \
1122 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
1124 #define LINK_START_LINUX_SPEC ""
1126 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1127 %{rdynamic:-export-dynamic} \
1128 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1130 #if defined(HAVE_LD_EH_FRAME_HDR)
1131 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1134 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1137 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1138 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1139 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1141 /* GNU/Hurd support. */
1142 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
1143 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1144 %{profile:-lc_p} %{!profile:-lc}}}"
1146 #define STARTFILE_GNU_SPEC "\
1147 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
1148 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1149 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1150 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1152 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1153 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1155 #define LINK_START_GNU_SPEC ""
1157 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1158 %{rdynamic:-export-dynamic} \
1159 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1161 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
1163 %{!ansi: -Dunix -D__unix}} \
1164 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1166 /* NetBSD support. */
1167 #define LIB_NETBSD_SPEC "\
1168 %{profile:-lgmon -lc_p} %{!profile:-lc}"
1170 #define STARTFILE_NETBSD_SPEC "\
1171 ncrti.o%s crt0.o%s \
1172 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1174 #define ENDFILE_NETBSD_SPEC "\
1175 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1178 #define LINK_START_NETBSD_SPEC "\
1181 #define LINK_OS_NETBSD_SPEC "\
1182 %{!shared: %{!static: \
1183 %{rdynamic:-export-dynamic} \
1184 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
1186 #define CPP_OS_NETBSD_SPEC "\
1187 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
1189 /* OpenBSD support. */
1190 #ifndef LIB_OPENBSD_SPEC
1191 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
1194 #ifndef STARTFILE_OPENBSD_SPEC
1195 #define STARTFILE_OPENBSD_SPEC "\
1196 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1197 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1200 #ifndef ENDFILE_OPENBSD_SPEC
1201 #define ENDFILE_OPENBSD_SPEC "\
1202 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
1205 #ifndef LINK_START_OPENBSD_SPEC
1206 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
1209 #ifndef LINK_OS_OPENBSD_SPEC
1210 #define LINK_OS_OPENBSD_SPEC ""
1213 #ifndef CPP_OS_OPENBSD_SPEC
1214 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
1217 /* WindISS support. */
1219 #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
1221 #define CPP_OS_WINDISS_SPEC "\
1225 %{!msoft-float: -D__hardfp} \
1228 #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1230 #define ENDFILE_WINDISS_SPEC "crtend.o%s"
1232 #define LINK_START_WINDISS_SPEC ""
1234 #define LINK_OS_WINDISS_SPEC ""
1236 /* Define any extra SPECS that the compiler needs to generate. */
1237 /* Override rs6000.h definition. */
1238 #undef SUBTARGET_EXTRA_SPECS
1239 #define SUBTARGET_EXTRA_SPECS \
1240 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
1241 { "lib_ads", LIB_ADS_SPEC }, \
1242 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1243 { "lib_mvme", LIB_MVME_SPEC }, \
1244 { "lib_sim", LIB_SIM_SPEC }, \
1245 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
1246 { "lib_gnu", LIB_GNU_SPEC }, \
1247 { "lib_linux", LIB_LINUX_SPEC }, \
1248 { "lib_netbsd", LIB_NETBSD_SPEC }, \
1249 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
1250 { "lib_windiss", LIB_WINDISS_SPEC }, \
1251 { "lib_default", LIB_DEFAULT_SPEC }, \
1252 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1253 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1254 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1255 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1256 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
1257 { "startfile_gnu", STARTFILE_GNU_SPEC }, \
1258 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1259 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
1260 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
1261 { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \
1262 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1263 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1264 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1265 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1266 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1267 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
1268 { "endfile_gnu", ENDFILE_GNU_SPEC }, \
1269 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1270 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
1271 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
1272 { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \
1273 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1274 { "link_path", LINK_PATH_SPEC }, \
1275 { "link_shlib", LINK_SHLIB_SPEC }, \
1276 { "link_target", LINK_TARGET_SPEC }, \
1277 { "link_start", LINK_START_SPEC }, \
1278 { "link_start_ads", LINK_START_ADS_SPEC }, \
1279 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1280 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1281 { "link_start_sim", LINK_START_SIM_SPEC }, \
1282 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
1283 { "link_start_gnu", LINK_START_GNU_SPEC }, \
1284 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1285 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
1286 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
1287 { "link_start_windiss", LINK_START_WINDISS_SPEC }, \
1288 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1289 { "link_os", LINK_OS_SPEC }, \
1290 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1291 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1292 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1293 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1294 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
1295 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1296 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
1297 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
1298 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
1299 { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
1300 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1301 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1302 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1303 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1304 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1305 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1306 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1307 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1308 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
1309 { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
1310 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1311 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
1312 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
1313 { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \
1314 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
1315 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
1316 SUBSUBTARGET_EXTRA_SPECS
1318 #define SUBSUBTARGET_EXTRA_SPECS
1320 /* Define this macro as a C expression for the initializer of an
1321 array of string to tell the driver program which options are
1322 defaults for this target and thus do not need to be handled
1323 specially when using `MULTILIB_OPTIONS'.
1325 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1326 the target makefile fragment or if none of the options listed in
1327 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1329 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1331 /* Define this macro if the code for function profiling should come
1332 before the function prologue. Normally, the profiling code comes
1334 #define PROFILE_BEFORE_PROLOGUE 1
1336 /* Function name to call to do profiling. */
1337 #define RS6000_MCOUNT "_mcount"
1339 /* Define this macro (to a value of 1) if you want to support the
1340 Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1341 pack(pop)'. The pack(push,<n>) pragma specifies the maximum
1342 alignment (in bytes) of fields within a structure, in much the
1343 same way as the __aligned__' and __packed__' __attribute__'s
1344 do. A pack value of zero resets the behavior to the default.
1345 Successive invocations of this pragma cause the previous values to
1346 be stacked, so that invocations of #pragma pack(pop)' will return
1347 to the previous value. */
1349 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
1351 /* Select a format to encode pointers in exception handling data. CODE
1352 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1353 true if the symbol may be affected by dynamic relocations. */
1354 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1355 ((flag_pic || TARGET_RELOCATABLE) \
1356 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1359 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1361 /* Generate entries in .fixup for relocatable addresses. */
1362 #define RELOCATABLE_NEEDS_FIXUP 1