1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* Yes! We are ELF. */
25 #define TARGET_OBJECT_FORMAT OBJECT_ELF
27 /* Default ABI to compile code for. */
28 #define DEFAULT_ABI rs6000_current_abi
30 /* Default ABI to use. */
31 #define RS6000_ABI_NAME "sysv"
33 /* Override rs6000.h definition. */
34 #undef ASM_DEFAULT_SPEC
35 #define ASM_DEFAULT_SPEC "-mppc"
37 /* Small data support types. */
38 enum rs6000_sdata_type {
39 SDATA_NONE, /* No small data support. */
40 SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */
41 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */
42 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */
45 extern enum rs6000_sdata_type rs6000_sdata;
47 /* V.4/eabi switches. */
48 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */
49 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
50 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */
51 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */
52 #define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */
53 #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
54 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
55 #define MASK_NO_BITFIELD_WORD 0x00800000 /* Bitfields cannot cross word boundaries */
57 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
58 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
59 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
60 #define TARGET_EABI (target_flags & MASK_EABI)
61 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
62 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
63 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
64 #define TARGET_NO_BITFIELD_WORD (target_flags & MASK_NO_BITFIELD_WORD)
65 #define TARGET_TOC ((target_flags & MASK_64BIT) \
66 || ((target_flags & (MASK_RELOCATABLE \
67 | MASK_MINIMAL_TOC)) \
69 || DEFAULT_ABI == ABI_AIX)
71 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
72 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
73 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
74 #define TARGET_NO_TOC (! TARGET_TOC)
75 #define TARGET_NO_EABI (! TARGET_EABI)
77 /* Strings provided by SUBTARGET_OPTIONS */
78 extern const char *rs6000_abi_name;
79 extern const char *rs6000_sdata_name;
81 /* Override rs6000.h definition. */
82 #undef SUBTARGET_OPTIONS
83 #define SUBTARGET_OPTIONS \
84 { "call-", &rs6000_abi_name, N_("Select ABI calling convention") }, \
85 { "sdata=", &rs6000_sdata_name, N_("Select method for sdata handling") }
87 /* Max # of bytes for variables to automatically be put into the .sdata
88 or .sdata2 sections. */
89 extern int g_switch_value; /* Value of the -G xx switch. */
90 extern int g_switch_set; /* Whether -G xx was passed. */
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, N_("no description yet") }, \
127 { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \
128 { "no-traceback", 0, N_("no description yet") }, \
129 { "eabi", MASK_EABI, N_("Use EABI") }, \
130 { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \
131 { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \
132 { "no-bit-word", MASK_NO_BITFIELD_WORD, \
133 N_("Do not allow bit-fields to cross word boundaries") }, \
134 { "regnames", MASK_REGNAMES, \
135 N_("Use alternate register names") }, \
136 { "no-regnames", -MASK_REGNAMES, \
137 N_("Don't use alternate register names") }, \
138 { "sdata", 0, N_("no description yet") }, \
139 { "no-sdata", 0, N_("no description yet") }, \
141 N_("Link with libsim.a, libc.a and sim-crt0.o") }, \
143 N_("Link with libads.a, libc.a and crt0.o") }, \
144 { "yellowknife", 0, \
145 N_("Link with libyk.a, libc.a and crt0.o") }, \
147 N_("Link with libmvme.a, libc.a and crt0.o") }, \
149 N_("Set the PPC_EMB bit in the ELF flags header") }, \
150 { "vxworks", 0, N_("no description yet") }, \
151 { "windiss", 0, N_("Use the WindISS simulator") }, \
152 { "shlib", 0, N_("no description yet") }, \
153 EXTRA_SUBTARGET_SWITCHES \
154 { "newlib", 0, N_("no description yet") },
156 /* This is meant to be redefined in the host dependent files. */
157 #define EXTRA_SUBTARGET_SWITCHES
159 /* Sometimes certain combinations of command options do not make sense
160 on a particular target machine. You can define a macro
161 `OVERRIDE_OPTIONS' to take account of this. This macro, if
162 defined, is executed once just after all the command options have
165 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
168 #define SUBTARGET_OVERRIDE_OPTIONS \
171 g_switch_value = SDATA_DEFAULT_SIZE; \
173 if (!strcmp (rs6000_abi_name, "sysv")) \
174 rs6000_current_abi = ABI_V4; \
175 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
177 rs6000_current_abi = ABI_V4; \
178 target_flags &= ~ MASK_EABI; \
180 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
181 || !strcmp (rs6000_abi_name, "eabi")) \
183 rs6000_current_abi = ABI_V4; \
184 target_flags |= MASK_EABI; \
186 else if (!strcmp (rs6000_abi_name, "aix")) \
188 rs6000_current_abi = ABI_AIX_NODESC; \
189 target_flags |= MASK_EABI; \
191 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
192 rs6000_current_abi = ABI_AIX; \
193 else if (!strcmp (rs6000_abi_name, "freebsd")) \
194 rs6000_current_abi = ABI_V4; \
195 else if (!strcmp (rs6000_abi_name, "linux")) \
196 rs6000_current_abi = ABI_V4; \
197 else if (!strcmp (rs6000_abi_name, "gnu")) \
198 rs6000_current_abi = ABI_V4; \
199 else if (!strcmp (rs6000_abi_name, "netbsd")) \
200 rs6000_current_abi = ABI_V4; \
201 else if (!strcmp (rs6000_abi_name, "i960-old")) \
203 rs6000_current_abi = ABI_V4; \
204 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \
205 | MASK_NO_BITFIELD_WORD); \
206 target_flags &= ~MASK_STRICT_ALIGN; \
210 rs6000_current_abi = ABI_V4; \
211 error ("bad value for -mcall-%s", rs6000_abi_name); \
214 if (rs6000_sdata_name) \
216 if (!strcmp (rs6000_sdata_name, "none")) \
217 rs6000_sdata = SDATA_NONE; \
218 else if (!strcmp (rs6000_sdata_name, "data")) \
219 rs6000_sdata = SDATA_DATA; \
220 else if (!strcmp (rs6000_sdata_name, "default")) \
221 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
222 else if (!strcmp (rs6000_sdata_name, "sysv")) \
223 rs6000_sdata = SDATA_SYSV; \
224 else if (!strcmp (rs6000_sdata_name, "eabi")) \
225 rs6000_sdata = SDATA_EABI; \
227 error ("bad value for -msdata=%s", rs6000_sdata_name); \
229 else if (DEFAULT_ABI == ABI_V4) \
231 rs6000_sdata = SDATA_DATA; \
232 rs6000_sdata_name = "data"; \
236 rs6000_sdata = SDATA_NONE; \
237 rs6000_sdata_name = "none"; \
240 if (TARGET_RELOCATABLE && \
241 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
243 rs6000_sdata = SDATA_DATA; \
244 error ("-mrelocatable and -msdata=%s are incompatible", \
245 rs6000_sdata_name); \
248 else if (flag_pic && \
249 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
251 rs6000_sdata = SDATA_DATA; \
252 error ("-f%s and -msdata=%s are incompatible", \
253 (flag_pic > 1) ? "PIC" : "pic", \
254 rs6000_sdata_name); \
257 if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
259 rs6000_sdata = SDATA_NONE; \
260 error ("-msdata=%s and -mcall-%s are incompatible", \
261 rs6000_sdata_name, rs6000_abi_name); \
264 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
266 target_flags |= MASK_MINIMAL_TOC; \
267 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
270 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
272 target_flags &= ~MASK_RELOCATABLE; \
273 error ("-mrelocatable and -mcall-%s are incompatible", \
277 if (flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
280 error ("-fPIC and -mcall-%s are incompatible", \
284 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
286 target_flags &= ~MASK_LITTLE_ENDIAN; \
287 error ("-mcall-aixdesc must be big endian"); \
290 /* Treat -fPIC the same as -mrelocatable. */ \
292 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
294 else if (TARGET_RELOCATABLE) \
300 /* Override rs6000.h definition. */
301 #undef TARGET_DEFAULT
302 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
304 /* Override rs6000.h definition. */
305 #undef PROCESSOR_DEFAULT
306 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
309 /* System V.4 uses register 13 as a pointer to the small data area,
310 so it is not available to the normal user. */
313 /* Size of the V.4 varargs area if needed. */
314 /* Override rs6000.h definition. */
315 #undef RS6000_VARARGS_AREA
316 #define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
318 /* Override default big endianism definitions in rs6000.h. */
319 #undef BYTES_BIG_ENDIAN
320 #undef WORDS_BIG_ENDIAN
321 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
322 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
324 /* Define this to set the endianness to use in libgcc2.c, which can
325 not depend on target_flags. */
326 #if !defined(_LITTLE_ENDIAN) && !defined(__sun__)
327 #define LIBGCC2_WORDS_BIG_ENDIAN 1
329 #define LIBGCC2_WORDS_BIG_ENDIAN 0
332 /* Define cutoff for using external functions to save floating point.
333 Currently on V.4, always use inline stores. */
334 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
336 /* Put jump tables in read-only memory, rather than in .text. */
337 #define JUMP_TABLES_IN_TEXT_SECTION 0
339 /* Prefix and suffix to use to saving floating point. */
340 #define SAVE_FP_PREFIX "_savefpr_"
341 #define SAVE_FP_SUFFIX "_l"
343 /* Prefix and suffix to use to restoring floating point. */
344 #define RESTORE_FP_PREFIX "_restfpr_"
345 #define RESTORE_FP_SUFFIX "_l"
347 /* Type used for ptrdiff_t, as a string used in a declaration. */
348 #define PTRDIFF_TYPE "int"
350 /* Type used for wchar_t, as a string used in a declaration. */
351 /* Override svr4.h definition. */
353 #define WCHAR_TYPE "long int"
355 /* Width of wchar_t in bits. */
356 /* Override svr4.h definition. */
357 #undef WCHAR_TYPE_SIZE
358 #define WCHAR_TYPE_SIZE 32
360 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
361 /* Override elfos.h definition. */
362 #undef PCC_BITFIELD_TYPE_MATTERS
363 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
365 #undef BITFIELD_NBYTES_LIMITED
366 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
368 /* Define this macro to be the value 1 if instructions will fail to
369 work if given data not on the nominal alignment. If instructions
370 will merely go slower in that case, define this macro as 0. */
371 #undef STRICT_ALIGNMENT
372 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
374 /* Alignment in bits of the stack boundary. Note, in order to allow building
375 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
376 versions, just use 64 as the stack boundary. */
377 #undef STACK_BOUNDARY
378 #define STACK_BOUNDARY (TARGET_ALTIVEC_ABI ? 128 : 64)
380 /* Real stack boundary as mandated by the appropriate ABI. */
381 #define ABI_STACK_BOUNDARY ((TARGET_EABI && !TARGET_ALTIVEC_ABI) ? 64 : 128)
383 /* An expression for the alignment of a structure field FIELD if the
384 alignment computed in the usual way is COMPUTED. */
385 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
386 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
389 /* Define this macro as an expression for the alignment of a type
390 (given by TYPE as a tree node) if the alignment computed in the
391 usual way is COMPUTED and the alignment explicitly specified was
393 #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
394 ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) \
395 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \
396 : MAX (COMPUTED, SPECIFIED))
398 #undef BIGGEST_FIELD_ALIGNMENT
399 #undef ADJUST_FIELD_ALIGN
401 /* Use ELF style section commands. */
403 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
405 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
407 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
409 /* Override elfos.h definition. */
410 #undef INIT_SECTION_ASM_OP
411 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
413 /* Override elfos.h definition. */
414 #undef FINI_SECTION_ASM_OP
415 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
417 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
419 /* Put PC relative got entries in .got2. */
420 #define MINIMAL_TOC_SECTION_ASM_OP \
421 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
423 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
424 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
425 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
427 /* Besides the usual ELF sections, we need a toc section. */
428 /* Override elfos.h definition. */
429 #undef EXTRA_SECTIONS
430 #define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
432 /* Override elfos.h definition. */
433 #undef EXTRA_SECTION_FUNCTIONS
434 #define EXTRA_SECTION_FUNCTIONS \
435 TOC_SECTION_FUNCTION \
436 SDATA_SECTION_FUNCTION \
437 SDATA2_SECTION_FUNCTION \
438 SBSS_SECTION_FUNCTION \
439 INIT_SECTION_FUNCTION \
440 FINI_SECTION_FUNCTION
442 #define TOC_SECTION_FUNCTION \
446 if (in_section != in_toc) \
448 in_section = in_toc; \
449 if (DEFAULT_ABI == ABI_AIX \
450 && TARGET_MINIMAL_TOC \
451 && !TARGET_RELOCATABLE) \
453 if (! toc_initialized) \
455 toc_initialized = 1; \
456 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
457 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
458 fprintf (asm_out_file, "\t.tc "); \
459 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
460 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
461 fprintf (asm_out_file, "\n"); \
463 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
464 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
465 fprintf (asm_out_file, " = .+32768\n"); \
468 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
470 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
471 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
474 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
475 if (! toc_initialized) \
477 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
478 fprintf (asm_out_file, " = .+32768\n"); \
479 toc_initialized = 1; \
485 extern int in_toc_section PARAMS ((void)); \
486 int in_toc_section () \
488 return in_section == in_toc; \
491 #define SDATA_SECTION_FUNCTION \
495 if (in_section != in_sdata) \
497 in_section = in_sdata; \
498 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
502 #define SDATA2_SECTION_FUNCTION \
506 if (in_section != in_sdata2) \
508 in_section = in_sdata2; \
509 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
513 #define SBSS_SECTION_FUNCTION \
517 if (in_section != in_sbss) \
519 in_section = in_sbss; \
520 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
524 #define INIT_SECTION_FUNCTION \
528 if (in_section != in_init) \
530 in_section = in_init; \
531 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
535 #define FINI_SECTION_FUNCTION \
539 if (in_section != in_fini) \
541 in_section = in_fini; \
542 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
546 /* Override default elf definitions. */
547 #undef TARGET_ASM_SELECT_RTX_SECTION
548 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
549 #undef TARGET_ASM_SELECT_SECTION
550 #define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section
551 #define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section
553 /* Return non-zero if this entry is to be written into the constant pool
554 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
555 containing one of them. If -mfp-in-toc (the default), we also do
556 this for floating-point constants. We actually can only do this
557 if the FP formats of the target and host machines are the same, but
558 we can't check that since not every file that uses
559 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
561 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
562 allow floating point constants in the TOC if -mrelocatable. */
564 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
565 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
567 && (GET_CODE (X) == SYMBOL_REF \
568 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
569 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
570 || GET_CODE (X) == LABEL_REF \
571 || (GET_CODE (X) == CONST_INT \
572 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
573 || (!TARGET_NO_FP_IN_TOC \
574 && !TARGET_RELOCATABLE \
575 && GET_CODE (X) == CONST_DOUBLE \
576 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
577 && BITS_PER_WORD == HOST_BITS_PER_INT)))
579 /* These macros generate the special .type and .size directives which
580 are used to set the corresponding fields of the linker symbol table
581 entries in an ELF object file under SVR4. These macros also output
582 the starting labels for the relevant functions/objects. */
584 /* Write the extra assembler code needed to declare a function properly.
585 Some svr4 assemblers need to also have something extra said about the
586 function's return value. We allow for that here. */
588 extern int rs6000_pic_labelno;
590 /* Override elfos.h definition. */
591 #undef ASM_DECLARE_FUNCTION_NAME
592 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
594 const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
596 if (TARGET_RELOCATABLE \
597 && (get_pool_size () != 0 || current_function_profile) \
602 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
604 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
605 fprintf (FILE, "\t%s ", init_ptr); \
606 assemble_name (FILE, buf); \
608 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
609 assemble_name (FILE, buf); \
613 fprintf (FILE, "%s", TYPE_ASM_OP); \
614 assemble_name (FILE, NAME); \
616 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
618 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
620 if (DEFAULT_ABI == ABI_AIX) \
622 const char *desc_name, *orig_name; \
624 orig_name = (*targetm.strip_name_encoding) (NAME); \
625 desc_name = orig_name; \
626 while (*desc_name == '.') \
629 if (TREE_PUBLIC (DECL)) \
630 fprintf (FILE, "\t.globl %s\n", desc_name); \
632 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
633 fprintf (FILE, "%s:\n", desc_name); \
634 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
635 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
636 if (DEFAULT_ABI == ABI_AIX) \
637 fprintf (FILE, "\t%s 0\n", init_ptr); \
638 fprintf (FILE, "\t.previous\n"); \
640 ASM_OUTPUT_LABEL (FILE, NAME); \
643 /* A C compound statement that outputs the assembler code for a thunk function,
644 used to implement C++ virtual function calls with multiple inheritance. The
645 thunk acts as a wrapper around a virtual function, adjusting the implicit
646 object parameter before handing control off to the real function.
648 First, emit code to add the integer DELTA to the location that contains the
649 incoming first argument. Assume that this argument contains a pointer, and
650 is the one used to pass the this' pointer in C++. This is the incoming
651 argument *before* the function prologue, e.g. %o0' on a sparc. The
652 addition must preserve the values of all other incoming arguments.
654 After the addition, emit code to jump to FUNCTION, which is a
655 FUNCTION_DECL'. This is a direct pure jump, not a call, and does not touch
656 the return address. Hence returning from FUNCTION will return to whoever
657 called the current thunk'.
659 The effect must be as if FUNCTION had been called directly with the adjusted
660 first argument. This macro is responsible for emitting all of the code for
661 a thunk function; FUNCTION_PROLOGUE' and FUNCTION_EPILOGUE' are not
664 The THUNK_FNDECL is redundant. (DELTA and FUNCTION have already been
665 extracted from it.) It might possibly be useful on some targets, but
668 If you do not define this macro, the target-independent code in the C++
669 frontend will generate a less efficient heavyweight thunk that calls
670 FUNCTION instead of jumping to it. The generic approach does not support
673 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
674 output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION)
676 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
677 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
679 #define LOCAL_LABEL_PREFIX "."
680 #define USER_LABEL_PREFIX ""
682 /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
684 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
685 asm_fprintf (FILE, "%L%s", PREFIX)
687 #define ASM_OUTPUT_LABEL(FILE,NAME) \
688 (assemble_name (FILE, NAME), fputs (":\n", FILE))
690 /* This is how to output a command to make the user-level label named NAME
691 defined for reference from other files. */
693 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
694 do { fputs ("\t.globl ", FILE); \
695 assemble_name (FILE, NAME); putc ('\n', FILE);} while (0)
697 /* This says how to output assembler code to declare an
698 uninitialized internal linkage data object. Under SVR4,
699 the linker seems to want the alignment of data objects
700 to depend on their types. We do exactly that here. */
702 #define LOCAL_ASM_OP "\t.local\t"
704 #define LCOMM_ASM_OP "\t.lcomm\t"
706 /* Override elfos.h definition. */
707 #undef ASM_OUTPUT_ALIGNED_LOCAL
708 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
710 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
711 && (SIZE) <= g_switch_value) \
714 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
715 ASM_OUTPUT_LABEL (FILE, NAME); \
716 ASM_OUTPUT_SKIP (FILE, SIZE); \
717 if (!flag_inhibit_size_directive && (SIZE) > 0) \
719 fprintf (FILE, "%s", SIZE_ASM_OP); \
720 assemble_name (FILE, NAME); \
721 fprintf (FILE, ",%d\n", SIZE); \
726 fprintf (FILE, "%s", LCOMM_ASM_OP); \
727 assemble_name ((FILE), (NAME)); \
728 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
732 /* Describe how to emit uninitialized external linkage items. */
733 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
735 ASM_GLOBALIZE_LABEL (FILE, NAME); \
736 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
739 /* Switch Recognition by gcc.c. Add -G xx support. */
741 /* Override svr4.h definition. */
742 #undef SWITCH_TAKES_ARG
743 #define SWITCH_TAKES_ARG(CHAR) \
744 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
745 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
746 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
747 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
748 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
751 /* Override elfos.h definition. */
752 #undef ASM_FILE_START
753 #define ASM_FILE_START(FILE) \
755 output_file_directive ((FILE), main_input_filename); \
756 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
760 extern int fixuplabelno;
762 /* Handle constructors specially for -mrelocatable. */
763 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
764 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
766 /* This is the end of what might become sysv4.h. */
768 /* Use DWARF 2 debugging information by default. */
769 #undef PREFERRED_DEBUGGING_TYPE
770 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
772 /* Historically we have also supported stabs debugging. */
773 #define DBX_DEBUGGING_INFO
775 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
776 #define TARGET_STRIP_NAME_ENCODING rs6000_elf_strip_name_encoding
778 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
780 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
781 assemble_name (FILE, NAME)
783 /* This is how to output a reference to a user-level label named NAME.
784 `assemble_name' uses this. */
786 /* Override elfos.h definition. */
787 #undef ASM_OUTPUT_LABELREF
788 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
790 const char *_name = NAME; \
795 fprintf (FILE, "%s", _name + 1); \
797 asm_fprintf (FILE, "%U%s", _name); \
800 /* But, to make this work, we have to output the stabs for the function
803 #define DBX_FUNCTION_FIRST
805 /* This is the end of what might become sysv4dbx.h. */
807 #ifndef TARGET_VERSION
808 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
811 #ifndef TARGET_OS_CPP_BUILTINS
812 #define TARGET_OS_CPP_BUILTINS() \
815 builtin_define_std ("PPC"); \
816 builtin_define_std ("unix"); \
817 builtin_define ("__svr4__"); \
818 builtin_assert ("system=unix"); \
819 builtin_assert ("system=svr4"); \
820 builtin_assert ("cpu=powerpc"); \
821 builtin_assert ("machine=powerpc"); \
826 /* Pass various options to the assembler. */
827 /* Override svr4.h definition. */
829 #define ASM_SPEC "%(asm_cpu) \
830 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
831 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
832 %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
833 %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
834 %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
835 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
836 %{mcall-freebsd: -mbig} \
837 %{mcall-i960-old: -mlittle} \
838 %{mcall-linux: -mbig} \
839 %{mcall-gnu: -mbig} \
840 %{mcall-netbsd: -mbig} \
843 #define CC1_ENDIAN_BIG_SPEC ""
845 #define CC1_ENDIAN_LITTLE_SPEC "\
846 %{!mstrict-align: %{!mno-strict-align: \
852 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
854 /* Pass -G xxx to the compiler and set correct endian mode. */
855 #define CC1_SPEC "%{G*} \
856 %{mlittle: %(cc1_endian_little)} %{!mlittle: %{mlittle-endian: %(cc1_endian_little)}} \
857 %{mbig: %(cc1_endian_big)} %{!mbig: %{mbig-endian: %(cc1_endian_big)}} \
858 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
859 %{mcall-aixdesc: -mbig %(cc1_endian_big) } \
860 %{mcall-freebsd: -mbig %(cc1_endian_big) } \
861 %{mcall-i960-old: -mlittle %(cc1_endian_little) } \
862 %{mcall-linux: -mbig %(cc1_endian_big) } \
863 %{mcall-gnu: -mbig %(cc1_endian_big) } \
864 %{mcall-netbsd: -mbig %(cc1_endian_big) } \
865 %{!mcall-aixdesc: %{!mcall-freebsd: %{!mcall-i960-old: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: \
866 %(cc1_endian_default) \
869 %{mno-sdata: -msdata=none } \
870 %{meabi: %{!mcall-*: -mcall-sysv }} \
871 %{!meabi: %{!mno-eabi: \
872 %{mrelocatable: -meabi } \
873 %{mcall-freebsd: -mno-eabi } \
874 %{mcall-i960-old: -meabi } \
875 %{mcall-linux: -mno-eabi } \
876 %{mcall-gnu: -mno-eabi } \
877 %{mcall-netbsd: -mno-eabi }}} \
878 %{msdata: -msdata=default} \
879 %{mno-sdata: -msdata=none} \
882 /* Don't put -Y P,<path> for cross compilers. */
883 #ifndef CROSS_COMPILE
884 #define LINK_PATH_SPEC "\
886 %{!nostdlib: %{!YP,*: \
888 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
889 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
890 %{!R*: %{!L*: -R /usr/ucblib}} \
892 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
893 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
896 #define LINK_PATH_SPEC ""
899 /* Default starting address if specified. */
900 #define LINK_START_SPEC "\
901 %{mads: %(link_start_ads) } \
902 %{myellowknife: %(link_start_yellowknife) } \
903 %{mmvme: %(link_start_mvme) } \
904 %{msim: %(link_start_sim) } \
905 %{mwindiss: %(link_start_windiss) } \
906 %{mcall-freebsd: %(link_start_freebsd) } \
907 %{mcall-linux: %(link_start_linux) } \
908 %{mcall-gnu: %(link_start_gnu) } \
909 %{mcall-netbsd: %(link_start_netbsd) } \
910 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
911 %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: \
912 %{!mcall-freebsd: %(link_start_default) }}}}}}}}}"
914 #define LINK_START_DEFAULT_SPEC ""
916 /* Override svr4.h definition. */
919 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
923 %{!Wl,-T*: %{!T*: %(link_start) }} \
927 /* For now, turn off shared libraries by default. */
928 #ifndef SHARED_LIB_SUPPORT
929 #define NO_SHARED_LIB_SUPPORT
932 #ifndef NO_SHARED_LIB_SUPPORT
933 /* Shared libraries are default. */
934 #define LINK_SHLIB_SPEC "\
935 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
937 %{static:-dn -Bstatic} \
938 %{shared:-G -dy -z text} \
939 %{symbolic:-Bsymbolic -G -dy -z text}"
942 /* Shared libraries are not default. */
943 #define LINK_SHLIB_SPEC "\
944 %{mshlib: %(link_path) } \
945 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
947 %{shared:-G -dy -z text %(link_path) } \
948 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
951 /* Override the default target of the linker. */
952 #define LINK_TARGET_SPEC "\
953 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
954 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
955 %{mcall-i960-old: --oformat elf32-powerpcle} \
958 /* Any specific OS flags. */
959 #define LINK_OS_SPEC "\
960 %{mads: %(link_os_ads) } \
961 %{myellowknife: %(link_os_yellowknife) } \
962 %{mmvme: %(link_os_mvme) } \
963 %{msim: %(link_os_sim) } \
964 %{mwindiss: %(link_os_windiss) } \
965 %{mcall-freebsd: %(link_os_freebsd) } \
966 %{mcall-linux: %(link_os_linux) } \
967 %{mcall-gnu: %(link_os_gnu) } \
968 %{mcall-netbsd: %(link_os_netbsd) } \
969 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
970 %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \
971 %{!mcall-netbsd: %(link_os_default) }}}}}}}}}"
973 #define LINK_OS_DEFAULT_SPEC ""
975 #define CPP_SYSV_SPEC \
976 "%{mrelocatable*: -D_RELOCATABLE} \
977 %{fpic: -D__PIC__=1 -D__pic__=1} \
978 %{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}}"
980 /* Override rs6000.h definition. */
982 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) \
983 %{mads: %(cpp_os_ads) } \
984 %{myellowknife: %(cpp_os_yellowknife) } \
985 %{mmvme: %(cpp_os_mvme) } \
986 %{msim: %(cpp_os_sim) } \
987 %{mwindiss: %(cpp_os_windiss) } \
988 %{mcall-freebsd: %(cpp_os_freebsd) } \
989 %{mcall-linux: %(cpp_os_linux) } \
990 %{mcall-gnu: %(cpp_os_gnu) } \
991 %{mcall-netbsd: %(cpp_os_netbsd) } \
992 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
993 %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \
994 %{!mcall-netbsd: %(cpp_os_default) }}}}}}}}}"
996 #define CPP_OS_DEFAULT_SPEC ""
998 /* Override svr4.h definition. */
999 #undef STARTFILE_SPEC
1000 #define STARTFILE_SPEC "\
1001 %{mads: %(startfile_ads) } \
1002 %{myellowknife: %(startfile_yellowknife) } \
1003 %{mmvme: %(startfile_mvme) } \
1004 %{msim: %(startfile_sim) } \
1005 %{mwindiss: %(startfile_windiss) } \
1006 %{mcall-freebsd: %(startfile_freebsd) } \
1007 %{mcall-linux: %(startfile_linux) } \
1008 %{mcall-gnu: %(startfile_gnu) } \
1009 %{mcall-netbsd: %(startfile_netbsd) } \
1010 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
1011 %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \
1012 %{!mcall-netbsd: %(startfile_default) }}}}}}}}}"
1014 #define STARTFILE_DEFAULT_SPEC ""
1016 /* Override svr4.h definition. */
1019 %{mads: %(lib_ads) } \
1020 %{myellowknife: %(lib_yellowknife) } \
1021 %{mmvme: %(lib_mvme) } \
1022 %{msim: %(lib_sim) } \
1023 %{mwindiss: %(lib_windiss) } \
1024 %{mcall-freebsd: %(lib_freebsd) } \
1025 %{mcall-linux: %(lib_linux) } \
1026 %{mcall-gnu: %(lib_gnu) } \
1027 %{mcall-netbsd: %(lib_netbsd) } \
1028 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
1029 %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \
1030 %{!mcall-netbsd: %(lib_default) }}}}}}}}}"
1032 #define LIB_DEFAULT_SPEC ""
1034 /* Override svr4.h definition. */
1036 #define ENDFILE_SPEC "\
1037 %{mads: crtsavres.o%s %(endfile_ads)} \
1038 %{myellowknife: crtsavres.o%s %(endfile_yellowknife)} \
1039 %{mmvme: crtsavres.o%s %(endfile_mvme)} \
1040 %{msim: crtsavres.o%s %(endfile_sim)} \
1041 %{mwindiss: %(endfile_windiss)} \
1042 %{mcall-freebsd: crtsavres.o%s %(endfile_freebsd) } \
1043 %{mcall-linux: crtsavres.o%s %(endfile_linux) } \
1044 %{mcall-gnu: crtsavres.o%s %(endfile_gnu) } \
1045 %{mcall-netbsd: crtsavres.o%s %(endfile_netbsd) } \
1046 %{mvxworks: crtsavres.o%s %(endfile_vxworks) } \
1047 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
1048 %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \
1049 %{!mcall-netbsd: %{!mvxworks: %(crtsavres_default) \
1050 %(endfile_default) }}}}}}}}}}"
1052 #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
1054 #define ENDFILE_DEFAULT_SPEC ""
1056 /* Motorola ADS support. */
1057 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1059 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1061 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
1063 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1065 #define LINK_OS_ADS_SPEC ""
1067 #define CPP_OS_ADS_SPEC ""
1069 /* Motorola Yellowknife support. */
1070 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1072 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1074 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
1076 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1078 #define LINK_OS_YELLOWKNIFE_SPEC ""
1080 #define CPP_OS_YELLOWKNIFE_SPEC ""
1082 /* Motorola MVME support. */
1083 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1085 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1087 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
1089 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
1091 #define LINK_OS_MVME_SPEC ""
1093 #define CPP_OS_MVME_SPEC ""
1095 /* PowerPC simulator based on netbsd system calls support. */
1096 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1098 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
1100 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
1102 #define LINK_START_SIM_SPEC ""
1104 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
1106 #define CPP_OS_SIM_SPEC ""
1108 /* FreeBSD support. */
1110 #define CPP_OS_FREEBSD_SPEC "\
1111 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
1112 -Acpu=powerpc -Amachine=powerpc"
1114 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
1115 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
1116 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
1117 #define LINK_START_FREEBSD_SPEC ""
1119 #define LINK_OS_FREEBSD_SPEC "\
1120 %{symbolic:-Bsymbolic}"
1122 /* GNU/Linux support. */
1123 #ifdef USE_GNULIBC_1
1124 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1127 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1128 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1129 %{profile:-lc_p} %{!profile:-lc}}}"
1132 #ifdef USE_GNULIBC_1
1133 #define STARTFILE_LINUX_SPEC "\
1134 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1135 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1136 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1138 #define STARTFILE_LINUX_SPEC "\
1139 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1140 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1141 %{static:crtbeginT.o%s} \
1142 %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
1145 #define ENDFILE_LINUX_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1146 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1148 #define LINK_START_LINUX_SPEC ""
1150 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1151 %{rdynamic:-export-dynamic} \
1152 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1154 #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
1155 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1158 #ifdef USE_GNULIBC_1
1159 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1162 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1163 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1164 -Asystem=unix -Asystem=posix"
1166 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1169 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1170 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1171 -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1174 /* GNU/Hurd support. */
1175 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
1176 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1177 %{profile:-lc_p} %{!profile:-lc}}}"
1179 #define STARTFILE_GNU_SPEC "\
1180 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
1181 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1182 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1183 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1185 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1186 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1188 #define LINK_START_GNU_SPEC ""
1190 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1191 %{rdynamic:-export-dynamic} \
1192 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1194 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
1196 %{!ansi: -Dunix -D__unix}} \
1197 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1199 /* NetBSD support. */
1200 #define LIB_NETBSD_SPEC "\
1201 %{profile:-lgmon -lc_p} %{!profile:-lc}"
1203 #define STARTFILE_NETBSD_SPEC "\
1204 ncrti.o%s crt0.o%s \
1205 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1207 #define ENDFILE_NETBSD_SPEC "\
1208 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1211 #define LINK_START_NETBSD_SPEC "\
1214 #define LINK_OS_NETBSD_SPEC "\
1215 %{!shared: %{!static: \
1216 %{rdynamic:-export-dynamic} \
1217 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
1219 #define CPP_OS_NETBSD_SPEC "\
1220 -D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__"
1222 /* VxWorks support. */
1223 /* VxWorks does all the library stuff itself. */
1224 #define LIB_VXWORKS_SPEC ""
1226 /* VxWorks provides the functionality of crt0.o and friends itself. */
1228 #define STARTFILE_VXWORKS_SPEC ""
1230 #define ENDFILE_VXWORKS_SPEC ""
1232 /* Because it uses ld -r, vxworks has no start/end files, nor starting
1235 #define LINK_START_VXWORKS_SPEC ""
1237 #define LINK_OS_VXWORKS_SPEC "-r"
1239 #define CPP_OS_VXWORKS_SPEC "\
1242 %{mpowerpc*: -DCPU=PPC603} \
1243 %{!mno-powerpc: -DCPU=PPC603}} \
1244 %{mcpu=powerpc: -DCPU=PPC603} \
1245 %{mcpu=401: -DCPU=PPC403} \
1246 %{mcpu=403: -DCPU=PPC403} \
1247 %{mcpu=405: -DCPU=PPC405} \
1248 %{mcpu=601: -DCPU=PPC601} \
1249 %{mcpu=602: -DCPU=PPC603} \
1250 %{mcpu=603: -DCPU=PPC603} \
1251 %{mcpu=603e: -DCPU=PPC603} \
1252 %{mcpu=ec603e: -DCPU=PPC603} \
1253 %{mcpu=604: -DCPU=PPC604} \
1254 %{mcpu=604e: -DCPU=PPC604} \
1255 %{mcpu=620: -DCPU=PPC604} \
1256 %{mcpu=740: -DCPU=PPC603} \
1257 %{mcpu=7450: -DCPU=PPC603} \
1258 %{mcpu=750: -DCPU=PPC603} \
1259 %{mcpu=801: -DCPU=PPC603} \
1260 %{mcpu=821: -DCPU=PPC603} \
1261 %{mcpu=823: -DCPU=PPC603} \
1262 %{mcpu=860: -DCPU=PPC603}"
1264 /* WindISS support. */
1266 #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
1268 #define CPP_OS_WINDISS_SPEC "\
1272 %{!msoft-float: -D__hardfp} \
1275 #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1277 #define ENDFILE_WINDISS_SPEC "crtend.o%s"
1279 #define LINK_START_WINDISS_SPEC ""
1281 #define LINK_OS_WINDISS_SPEC ""
1283 /* Define any extra SPECS that the compiler needs to generate. */
1284 /* Override rs6000.h definition. */
1285 #undef SUBTARGET_EXTRA_SPECS
1286 #define SUBTARGET_EXTRA_SPECS \
1287 { "cpp_sysv", CPP_SYSV_SPEC }, \
1288 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
1289 { "lib_ads", LIB_ADS_SPEC }, \
1290 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1291 { "lib_mvme", LIB_MVME_SPEC }, \
1292 { "lib_sim", LIB_SIM_SPEC }, \
1293 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
1294 { "lib_gnu", LIB_GNU_SPEC }, \
1295 { "lib_linux", LIB_LINUX_SPEC }, \
1296 { "lib_netbsd", LIB_NETBSD_SPEC }, \
1297 { "lib_vxworks", LIB_VXWORKS_SPEC }, \
1298 { "lib_windiss", LIB_WINDISS_SPEC }, \
1299 { "lib_default", LIB_DEFAULT_SPEC }, \
1300 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1301 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1302 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1303 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1304 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
1305 { "startfile_gnu", STARTFILE_GNU_SPEC }, \
1306 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1307 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
1308 { "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \
1309 { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \
1310 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1311 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1312 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1313 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1314 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1315 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
1316 { "endfile_gnu", ENDFILE_GNU_SPEC }, \
1317 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1318 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
1319 { "endfile_vxworks", ENDFILE_VXWORKS_SPEC }, \
1320 { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \
1321 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1322 { "link_path", LINK_PATH_SPEC }, \
1323 { "link_shlib", LINK_SHLIB_SPEC }, \
1324 { "link_target", LINK_TARGET_SPEC }, \
1325 { "link_start", LINK_START_SPEC }, \
1326 { "link_start_ads", LINK_START_ADS_SPEC }, \
1327 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1328 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1329 { "link_start_sim", LINK_START_SIM_SPEC }, \
1330 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
1331 { "link_start_gnu", LINK_START_GNU_SPEC }, \
1332 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1333 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
1334 { "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \
1335 { "link_start_windiss", LINK_START_WINDISS_SPEC }, \
1336 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1337 { "link_os", LINK_OS_SPEC }, \
1338 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1339 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1340 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1341 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1342 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
1343 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1344 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
1345 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
1346 { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \
1347 { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
1348 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1349 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1350 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1351 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1352 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1353 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1354 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1355 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1356 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
1357 { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
1358 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1359 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
1360 { "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \
1361 { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \
1362 { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
1364 /* Define this macro as a C expression for the initializer of an
1365 array of string to tell the driver program which options are
1366 defaults for this target and thus do not need to be handled
1367 specially when using `MULTILIB_OPTIONS'.
1369 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1370 the target makefile fragment or if none of the options listed in
1371 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1373 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1375 /* Define this macro if the code for function profiling should come
1376 before the function prologue. Normally, the profiling code comes
1378 #define PROFILE_BEFORE_PROLOGUE 1
1380 /* Function name to call to do profiling. */
1381 #define RS6000_MCOUNT "_mcount"
1383 /* Define this macro (to a value of 1) if you want to support the
1384 Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1385 pack(pop)'. The pack(push,<n>) pragma specifies the maximum
1386 alignment (in bytes) of fields within a structure, in much the
1387 same way as the __aligned__' and __packed__' __attribute__'s
1388 do. A pack value of zero resets the behaviour to the default.
1389 Successive invocations of this pragma cause the previous values to
1390 be stacked, so that invocations of #pragma pack(pop)' will return
1391 to the previous value. */
1393 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
1395 /* Define library calls for quad FP operations. These are all part of the
1396 PowerPC 32bit ABI. */
1397 #define ADDTF3_LIBCALL "_q_add"
1398 #define DIVTF3_LIBCALL "_q_div"
1399 #define EXTENDDFTF2_LIBCALL "_q_dtoq"
1400 #define EQTF2_LIBCALL "_q_feq"
1401 #define GETF2_LIBCALL "_q_fge"
1402 #define GTTF2_LIBCALL "_q_fgt"
1403 #define LETF2_LIBCALL "_q_fle"
1404 #define LTTF2_LIBCALL "_q_flt"
1405 #define NETF2_LIBCALL "_q_fne"
1406 #define FLOATSITF2_LIBCALL "_q_itoq"
1407 #define MULTF3_LIBCALL "_q_mul"
1408 #define NEGTF2_LIBCALL "_q_neg"
1409 #define TRUNCTFDF2_LIBCALL "_q_qtod"
1410 #define FIX_TRUNCTFSI2_LIBCALL "_q_qtoi"
1411 #define TRUNCTFSF2_LIBCALL "_q_qtos"
1412 #define FIXUNS_TRUNCTFSI2_LIBCALL "_q_qtou"
1413 #define SQRTTF_LIBCALL "_q_sqrt"
1414 #define EXTENDSFTF2_LIBCALL "_q_stoq"
1415 #define SUBTF3_LIBCALL "_q_sub"
1416 #define FLOATUNSSITF2_LIBCALL "_q_utoq"
1418 #define INIT_TARGET_OPTABS \
1420 if (TARGET_HARD_FLOAT) \
1422 add_optab->handlers[(int) TFmode].libfunc \
1423 = init_one_libfunc (ADDTF3_LIBCALL); \
1424 sub_optab->handlers[(int) TFmode].libfunc \
1425 = init_one_libfunc (SUBTF3_LIBCALL); \
1426 neg_optab->handlers[(int) TFmode].libfunc \
1427 = init_one_libfunc (NEGTF2_LIBCALL); \
1428 smul_optab->handlers[(int) TFmode].libfunc \
1429 = init_one_libfunc (MULTF3_LIBCALL); \
1430 sdiv_optab->handlers[(int) TFmode].libfunc \
1431 = init_one_libfunc (DIVTF3_LIBCALL); \
1432 eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL); \
1433 netf2_libfunc = init_one_libfunc (NETF2_LIBCALL); \
1434 gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL); \
1435 getf2_libfunc = init_one_libfunc (GETF2_LIBCALL); \
1436 lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL); \
1437 letf2_libfunc = init_one_libfunc (LETF2_LIBCALL); \
1438 trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL); \
1439 trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL); \
1440 extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL); \
1441 extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL); \
1442 floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL); \
1443 fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL); \
1444 fixunstfsi_libfunc \
1445 = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL); \
1446 if (TARGET_PPC_GPOPT || TARGET_POWER2) \
1447 sqrt_optab->handlers[(int) TFmode].libfunc \
1448 = init_one_libfunc (SQRTTF_LIBCALL); \
1452 /* Select a format to encode pointers in exception handling data. CODE
1453 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1454 true if the symbol may be affected by dynamic relocations. */
1455 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1456 ((flag_pic || TARGET_RELOCATABLE) \
1457 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1460 #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section
1462 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1464 /* Generate entries in .fixup for relocatable addresses. */
1465 #define RELOCATABLE_NEEDS_FIXUP