1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #include "rs6000/rs6000.h"
24 /* Use the regular svr4 definitions. */
28 /* Yes! We are ELF. */
29 #define TARGET_OBJECT_FORMAT OBJECT_ELF
31 /* Default ABI to compile code for. */
32 #define DEFAULT_ABI rs6000_current_abi
34 /* Default ABI to use. */
35 #define RS6000_ABI_NAME "sysv"
37 /* Override rs6000.h definition. */
38 #undef ASM_DEFAULT_SPEC
39 #define ASM_DEFAULT_SPEC "-mppc"
41 /* Override rs6000.h definition. */
42 #undef CPP_DEFAULT_SPEC
43 #define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
45 /* Small data support types. */
46 enum rs6000_sdata_type {
47 SDATA_NONE, /* No small data support. */
48 SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */
49 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */
50 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */
53 extern enum rs6000_sdata_type rs6000_sdata;
55 /* V.4/eabi switches. */
56 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */
57 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
58 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */
59 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */
60 #define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */
61 #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
62 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
64 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
65 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
66 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
67 #define TARGET_EABI (target_flags & MASK_EABI)
68 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
69 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
70 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
71 #define TARGET_TOC ((target_flags & MASK_64BIT) \
72 || ((target_flags & (MASK_RELOCATABLE \
73 | MASK_MINIMAL_TOC)) \
75 || DEFAULT_ABI == ABI_AIX)
77 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
78 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
79 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
80 #define TARGET_NO_TOC (! TARGET_TOC)
81 #define TARGET_NO_EABI (! TARGET_EABI)
83 /* Strings provided by SUBTARGET_OPTIONS */
84 extern const char *rs6000_abi_name;
85 extern const char *rs6000_sdata_name;
87 /* Override rs6000.h definition. */
88 #undef SUBTARGET_OPTIONS
89 #define SUBTARGET_OPTIONS \
90 { "call-", &rs6000_abi_name, "Select ABI calling convention." }, \
91 { "sdata=", &rs6000_sdata_name, "Select method for sdata handling." }
93 /* Max # of bytes for variables to automatically be put into the .sdata
94 or .sdata2 sections. */
95 extern int g_switch_value; /* Value of the -G xx switch. */
96 extern int g_switch_set; /* Whether -G xx was passed. */
98 #define SDATA_DEFAULT_SIZE 8
100 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
101 the same as -mminimal-toc. */
102 /* Override rs6000.h definition. */
103 #undef SUBTARGET_SWITCHES
104 #define SUBTARGET_SWITCHES \
105 { "bit-align", -MASK_NO_BITFIELD_TYPE, "Align to the base type of the bitfield." },\
106 { "no-bit-align", MASK_NO_BITFIELD_TYPE, "Don't align to the base type of the bitfield." },\
107 { "strict-align", MASK_STRICT_ALIGN, "Don't assume that unaligned accesses are handled by the system" },\
108 { "no-strict-align", -MASK_STRICT_ALIGN, "Assume that unaligned accesses are handled by the system" },\
109 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, "Produce code relocatable at runtime." },\
110 { "no-relocatable", -MASK_RELOCATABLE, "Don't produce code relocatable at runtime." },\
111 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, "Produce code relocatable at runtime." },\
112 { "no-relocatable-lib", -MASK_RELOCATABLE, "Don't produce code relocatable at runtime." },\
113 { "little-endian", MASK_LITTLE_ENDIAN, "Produce little endian code." }, \
114 { "little", MASK_LITTLE_ENDIAN, "Produce little endian code." }, \
115 { "big-endian", -MASK_LITTLE_ENDIAN, "Produce big endian code." }, \
116 { "big", -MASK_LITTLE_ENDIAN, "Produce big endian code." }, \
117 { "no-toc", 0, "no description yet" }, \
118 { "toc", MASK_MINIMAL_TOC, "no description yet" }, \
119 { "full-toc", MASK_MINIMAL_TOC, "no description yet" }, \
120 { "prototype", MASK_PROTOTYPE, "no description yet" }, \
121 { "no-prototype", -MASK_PROTOTYPE, "no description yet" }, \
122 { "no-traceback", 0, "no description yet" }, \
123 { "eabi", MASK_EABI, "Use EABI." }, \
124 { "no-eabi", -MASK_EABI, "Don't use EABI." }, \
125 { "regnames", MASK_REGNAMES, "Use alternate register names." }, \
126 { "no-regnames", -MASK_REGNAMES, "Don't use alternate register names." },\
127 { "sdata", 0, "no description yet" }, \
128 { "no-sdata", 0, "no description yet" }, \
129 { "sim", 0, "Link with libsim.a, libc.a and sim-crt0.o." }, \
130 { "ads", 0, "Link with libads.a, libc.a and crt0.o." }, \
131 { "yellowknife", 0, "Link with libyk.a, libc.a and crt0.o." }, \
132 { "mvme", 0, "Link with libmvme.a, libc.a and crt0.o." }, \
133 { "emb", 0, "Set the PPC_EMB bit in the ELF flags header" }, \
134 { "vxworks", 0, "no description yet" }, \
135 { "solaris-cclib", 0, "no description yet" }, \
136 { "shlib", 0, "no description yet" }, \
137 EXTRA_SUBTARGET_SWITCHES \
138 { "newlib", 0, "no description yet" },
140 /* This is meant to be redefined in the host dependent files. */
141 #define EXTRA_SUBTARGET_SWITCHES
143 /* Sometimes certain combinations of command options do not make sense
144 on a particular target machine. You can define a macro
145 `OVERRIDE_OPTIONS' to take account of this. This macro, if
146 defined, is executed once just after all the command options have
149 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
152 #define SUBTARGET_OVERRIDE_OPTIONS \
155 g_switch_value = SDATA_DEFAULT_SIZE; \
157 if (!strcmp (rs6000_abi_name, "sysv")) \
158 rs6000_current_abi = ABI_V4; \
159 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
161 rs6000_current_abi = ABI_V4; \
162 target_flags &= ~ MASK_EABI; \
164 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
165 || !strcmp (rs6000_abi_name, "eabi")) \
167 rs6000_current_abi = ABI_V4; \
168 target_flags |= MASK_EABI; \
170 else if (!strcmp (rs6000_abi_name, "aix")) \
172 rs6000_current_abi = ABI_AIX_NODESC; \
173 target_flags |= MASK_EABI; \
175 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
176 rs6000_current_abi = ABI_AIX; \
177 else if (!strcmp (rs6000_abi_name, "linux")) \
178 rs6000_current_abi = ABI_V4; \
179 else if (!strcmp (rs6000_abi_name, "solaris")) \
180 rs6000_current_abi = ABI_SOLARIS; \
183 rs6000_current_abi = ABI_V4; \
184 error ("Bad value for -mcall-%s", rs6000_abi_name); \
187 if (rs6000_sdata_name) \
189 if (!strcmp (rs6000_sdata_name, "none")) \
190 rs6000_sdata = SDATA_NONE; \
191 else if (!strcmp (rs6000_sdata_name, "data")) \
192 rs6000_sdata = SDATA_DATA; \
193 else if (!strcmp (rs6000_sdata_name, "default")) \
194 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
195 else if (!strcmp (rs6000_sdata_name, "sysv")) \
196 rs6000_sdata = SDATA_SYSV; \
197 else if (!strcmp (rs6000_sdata_name, "eabi")) \
198 rs6000_sdata = SDATA_EABI; \
200 error ("Bad value for -msdata=%s", rs6000_sdata_name); \
202 else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
204 rs6000_sdata = SDATA_DATA; \
205 rs6000_sdata_name = "data"; \
209 rs6000_sdata = SDATA_NONE; \
210 rs6000_sdata_name = "none"; \
213 if (TARGET_RELOCATABLE && \
214 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
216 rs6000_sdata = SDATA_DATA; \
217 error ("-mrelocatable and -msdata=%s are incompatible.", \
218 rs6000_sdata_name); \
221 else if (flag_pic && \
222 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
224 rs6000_sdata = SDATA_DATA; \
225 error ("-f%s and -msdata=%s are incompatible.", \
226 (flag_pic > 1) ? "PIC" : "pic", \
227 rs6000_sdata_name); \
230 if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4 \
231 && DEFAULT_ABI != ABI_SOLARIS) \
233 rs6000_sdata = SDATA_NONE; \
234 error ("-msdata=%s and -mcall-%s are incompatible.", \
235 rs6000_sdata_name, rs6000_abi_name); \
238 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
240 target_flags |= MASK_MINIMAL_TOC; \
241 error ("-mrelocatable and -mno-minimal-toc are incompatible."); \
244 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
246 target_flags &= ~MASK_RELOCATABLE; \
247 error ("-mrelocatable and -mcall-%s are incompatible.", \
251 if (flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
254 error ("-fPIC and -mcall-%s are incompatible.", \
258 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
260 target_flags &= ~MASK_LITTLE_ENDIAN; \
261 error ("-mcall-aixdesc must be big endian"); \
264 /* Treat -fPIC the same as -mrelocatable. */ \
266 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
268 else if (TARGET_RELOCATABLE) \
274 /* Override rs6000.h definition. */
275 #undef TARGET_DEFAULT
276 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
278 /* Override rs6000.h definition. */
279 #undef PROCESSOR_DEFAULT
280 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
282 /* System V.4 uses register 13 as a pointer to the small data area,
283 so it is not available to the normal user. */
287 /* Size of the V.4 varargs area if needed. */
288 /* Override rs6000.h definition. */
289 #undef RS6000_VARARGS_AREA
290 #define RS6000_VARARGS_AREA ((rs6000_sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
292 /* Override default big endianism definitions in rs6000.h. */
293 #undef BYTES_BIG_ENDIAN
294 #undef WORDS_BIG_ENDIAN
295 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
296 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
298 /* Define this to set the endianness to use in libgcc2.c, which can
299 not depend on target_flags. */
300 #if !defined(_LITTLE_ENDIAN) && !defined(__sun__)
301 #define LIBGCC2_WORDS_BIG_ENDIAN 1
303 #define LIBGCC2_WORDS_BIG_ENDIAN 0
306 /* Define cutoff for using external functions to save floating point.
307 Currently on V.4, always use inline stores. */
308 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
310 /* Put jump tables in read-only memory, rather than in .text. */
311 #define JUMP_TABLES_IN_TEXT_SECTION 0
313 /* Prefix and suffix to use to saving floating point. */
314 #define SAVE_FP_PREFIX "_savefpr_"
315 #define SAVE_FP_SUFFIX "_l"
317 /* Prefix and suffix to use to restoring floating point. */
318 #define RESTORE_FP_PREFIX "_restfpr_"
319 #define RESTORE_FP_SUFFIX "_l"
321 /* Type used for ptrdiff_t, as a string used in a declaration. */
322 #define PTRDIFF_TYPE "int"
324 /* Type used for wchar_t, as a string used in a declaration. */
325 /* Override svr4.h definition. */
327 #define WCHAR_TYPE "long int"
329 /* Width of wchar_t in bits. */
330 /* Override svr4.h definition. */
331 #undef WCHAR_TYPE_SIZE
332 #define WCHAR_TYPE_SIZE 32
334 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
335 /* Override elfos.h definition. */
336 #undef PCC_BITFIELD_TYPE_MATTERS
337 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
339 /* Define this macro to be the value 1 if instructions will fail to
340 work if given data not on the nominal alignment. If instructions
341 will merely go slower in that case, define this macro as 0. */
342 #undef STRICT_ALIGNMENT
343 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
345 /* Alignment in bits of the stack boundary. Note, in order to allow building
346 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
347 versions, just use 64 as the stack boundary. */
348 #undef STACK_BOUNDARY
349 #define STACK_BOUNDARY 64
351 /* Real stack boundary as mandated by the appropriate ABI. */
352 #define ABI_STACK_BOUNDARY ((TARGET_EABI) ? 64 : 128)
354 /* No data type wants to be aligned rounder than this. */
355 #undef BIGGEST_ALIGNMENT
356 #define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
358 #undef BIGGEST_FIELD_ALIGNMENT
359 #undef ADJUST_FIELD_ALIGN
360 #undef ROUND_TYPE_ALIGN
362 /* Use ELF style section commands. */
364 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
366 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
368 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
370 /* Override elfos.h definition. */
371 #undef INIT_SECTION_ASM_OP
372 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
374 /* Override elfos.h definition. */
375 #undef FINI_SECTION_ASM_OP
376 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
378 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
380 /* Put PC relative got entries in .got2. */
381 #define MINIMAL_TOC_SECTION_ASM_OP \
382 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
384 /* Put relocatable data in .data, not .rodata so initialized pointers can be updated. */
385 /* Override elfos.h definition. */
386 #undef CONST_SECTION_ASM_OP
387 #define CONST_SECTION_ASM_OP \
388 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".data\"\t# .rodata" : "\t.section\t\".rodata\"")
391 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
392 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
393 #define SBSS_SECTION_ASM_OP \
394 ((DEFAULT_ABI == ABI_SOLARIS) ? "\t.section\t\".sbss\",\"aw\"" : "\t.section\t\".sbss\",\"aw\",@nobits")
397 /* Besides the usual ELF sections, we need a toc section. */
398 /* Override elfos.h definition. */
399 #undef EXTRA_SECTIONS
400 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
402 /* Override elfos.h definition. */
403 #undef EXTRA_SECTION_FUNCTIONS
404 #define EXTRA_SECTION_FUNCTIONS \
405 CONST_SECTION_FUNCTION \
406 CTORS_SECTION_FUNCTION \
407 DTORS_SECTION_FUNCTION \
408 TOC_SECTION_FUNCTION \
409 SDATA_SECTION_FUNCTION \
410 SDATA2_SECTION_FUNCTION \
411 SBSS_SECTION_FUNCTION \
412 INIT_SECTION_FUNCTION \
413 FINI_SECTION_FUNCTION
415 #define TOC_SECTION_FUNCTION \
419 if (in_section != in_toc) \
421 in_section = in_toc; \
422 if (DEFAULT_ABI == ABI_AIX \
423 && TARGET_MINIMAL_TOC \
424 && !TARGET_RELOCATABLE) \
426 if (! toc_initialized) \
428 toc_initialized = 1; \
429 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
430 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
431 fprintf (asm_out_file, "\t.tc "); \
432 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
433 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
434 fprintf (asm_out_file, "\n"); \
436 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
437 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
438 fprintf (asm_out_file, " = .+32768\n"); \
441 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
443 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
444 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
447 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
448 if (! toc_initialized) \
450 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
451 fprintf (asm_out_file, " = .+32768\n"); \
452 toc_initialized = 1; \
458 #define SDATA_SECTION_FUNCTION \
462 if (in_section != in_sdata) \
464 in_section = in_sdata; \
465 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
469 #define SDATA2_SECTION_FUNCTION \
473 if (in_section != in_sdata2) \
475 in_section = in_sdata2; \
476 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
480 #define SBSS_SECTION_FUNCTION \
484 if (in_section != in_sbss) \
486 in_section = in_sbss; \
487 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
491 #define INIT_SECTION_FUNCTION \
495 if (in_section != in_init) \
497 in_section = in_init; \
498 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
502 #define FINI_SECTION_FUNCTION \
506 if (in_section != in_fini) \
508 in_section = in_fini; \
509 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
513 /* A C statement or statements to switch to the appropriate section
514 for output of RTX in mode MODE. You can assume that RTX is some
515 kind of constant in RTL. The argument MODE is redundant except in
516 the case of a `const_int' rtx. Select the section by calling
517 `text_section' or one of the alternatives for other sections.
519 Do not define this macro if you put all constants in the read-only
522 /* Override elfos.h definition. */
523 #undef SELECT_RTX_SECTION
524 #define SELECT_RTX_SECTION(MODE, X) rs6000_select_rtx_section (MODE, X)
526 /* A C statement or statements to switch to the appropriate
527 section for output of DECL. DECL is either a `VAR_DECL' node
528 or a constant of some sort. RELOC indicates whether forming
529 the initial value of DECL requires link-time relocations. */
531 /* Override elfos.h definition. */
532 #undef SELECT_SECTION
533 #define SELECT_SECTION(DECL,RELOC) rs6000_select_section (DECL, RELOC)
535 /* Return non-zero if this entry is to be written into the constant pool
536 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
537 containing one of them. If -mfp-in-toc (the default), we also do
538 this for floating-point constants. We actually can only do this
539 if the FP formats of the target and host machines are the same, but
540 we can't check that since not every file that uses
541 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
543 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
544 allow floating point constants in the TOC if -mrelocatable. */
546 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
547 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
549 && (GET_CODE (X) == SYMBOL_REF \
550 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
551 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
552 || GET_CODE (X) == LABEL_REF \
553 || (!TARGET_NO_FP_IN_TOC \
554 && !TARGET_RELOCATABLE \
555 && GET_CODE (X) == CONST_DOUBLE \
556 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
557 && BITS_PER_WORD == HOST_BITS_PER_INT)))
559 /* These macros generate the special .type and .size directives which
560 are used to set the corresponding fields of the linker symbol table
561 entries in an ELF object file under SVR4. These macros also output
562 the starting labels for the relevant functions/objects. */
564 /* Write the extra assembler code needed to declare a function properly.
565 Some svr4 assemblers need to also have something extra said about the
566 function's return value. We allow for that here. */
568 extern int rs6000_pic_labelno;
570 /* Override elfos.h definition. */
571 #undef ASM_DECLARE_FUNCTION_NAME
572 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
574 const char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
576 if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag) \
580 const char *buf_ptr; \
582 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
584 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
585 fprintf (FILE, "\t%s ", init_ptr); \
586 assemble_name (FILE, buf); \
588 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
589 assemble_name (FILE, buf); \
593 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
594 assemble_name (FILE, NAME); \
596 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
598 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
600 if (DEFAULT_ABI == ABI_AIX) \
602 const char *desc_name, *orig_name; \
604 STRIP_NAME_ENCODING (orig_name, NAME); \
605 desc_name = orig_name; \
606 while (*desc_name == '.') \
609 if (TREE_PUBLIC (DECL)) \
610 fprintf (FILE, "\t.globl %s\n", desc_name); \
612 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
613 fprintf (FILE, "%s:\n", desc_name); \
614 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
615 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
616 if (DEFAULT_ABI == ABI_AIX) \
617 fprintf (FILE, "\t%s 0\n", init_ptr); \
618 fprintf (FILE, "\t.previous\n"); \
620 ASM_OUTPUT_LABEL (FILE, NAME); \
623 /* A C compound statement that outputs the assembler code for a thunk function,
624 used to implement C++ virtual function calls with multiple inheritance. The
625 thunk acts as a wrapper around a virtual function, adjusting the implicit
626 object parameter before handing control off to the real function.
628 First, emit code to add the integer DELTA to the location that contains the
629 incoming first argument. Assume that this argument contains a pointer, and
630 is the one used to pass the this' pointer in C++. This is the incoming
631 argument *before* the function prologue, e.g. %o0' on a sparc. The
632 addition must preserve the values of all other incoming arguments.
634 After the addition, emit code to jump to FUNCTION, which is a
635 FUNCTION_DECL'. This is a direct pure jump, not a call, and does not touch
636 the return address. Hence returning from FUNCTION will return to whoever
637 called the current thunk'.
639 The effect must be as if FUNCTION had been called directly with the adjusted
640 first argument. This macro is responsible for emitting all of the code for
641 a thunk function; FUNCTION_PROLOGUE' and FUNCTION_EPILOGUE' are not
644 The THUNK_FNDECL is redundant. (DELTA and FUNCTION have already been
645 extracted from it.) It might possibly be useful on some targets, but
648 If you do not define this macro, the target-independent code in the C++
649 frontend will generate a less efficient heavyweight thunk that calls
650 FUNCTION instead of jumping to it. The generic approach does not support
653 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
654 output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION)
656 /* How to renumber registers for dbx and gdb. */
658 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
660 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
661 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
663 #define LOCAL_LABEL_PREFIX "."
664 #define USER_LABEL_PREFIX ""
666 /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
668 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
669 asm_fprintf (FILE, "%L%s", PREFIX)
671 #define ASM_OUTPUT_LABEL(FILE,NAME) \
672 (assemble_name (FILE, NAME), fputs (":\n", FILE))
674 /* This is how to output a command to make the user-level label named NAME
675 defined for reference from other files. */
677 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
678 do { fputs ("\t.globl ", FILE); \
679 assemble_name (FILE, NAME); putc ('\n', FILE);} while (0)
681 /* This is how to allocate empty space in some section. Use .space
682 instead of .zero because the Solaris PowerPC assembler doesn't
683 like it, and gas accepts either syntax. */
685 /* Override elfos.h definition. */
687 #define SKIP_ASM_OP ".space"
689 /* This says how to output assembler code to declare an
690 uninitialized internal linkage data object. Under SVR4,
691 the linker seems to want the alignment of data objects
692 to depend on their types. We do exactly that here. */
694 #define LOCAL_ASM_OP ".local"
696 #define LCOMM_ASM_OP ".lcomm"
698 /* Override elfos.h definition. */
699 #undef ASM_OUTPUT_ALIGNED_LOCAL
700 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
702 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
703 && (SIZE) <= g_switch_value) \
706 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
707 ASM_OUTPUT_LABEL (FILE, NAME); \
708 ASM_OUTPUT_SKIP (FILE, SIZE); \
709 if (!flag_inhibit_size_directive && (SIZE) > 0) \
711 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
712 assemble_name (FILE, NAME); \
713 fprintf (FILE, ",%d\n", SIZE); \
718 fprintf (FILE, "\t%s\t", LCOMM_ASM_OP); \
719 assemble_name ((FILE), (NAME)); \
720 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
724 /* Describe how to emit uninitialized external linkage items. */
725 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
727 ASM_GLOBALIZE_LABEL (FILE, NAME); \
728 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
731 /* Switch Recognition by gcc.c. Add -G xx support. */
733 /* Override svr4.h definition. */
734 #undef SWITCH_TAKES_ARG
735 #define SWITCH_TAKES_ARG(CHAR) \
736 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
737 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
738 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
739 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
740 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
743 /* Override elfos.h definition. */
744 #undef ASM_FILE_START
745 #define ASM_FILE_START(FILE) \
747 output_file_directive ((FILE), main_input_filename); \
748 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
752 extern int fixuplabelno;
754 /* This is how to output an assembler line defining an `int' constant.
755 For -mrelocatable, we mark all addresses that need to be fixed up
756 in the .fixup section. */
757 /* Override rs6000.h definition. */
758 #undef ASM_OUTPUT_INT
759 #define ASM_OUTPUT_INT(FILE,VALUE) \
761 static int recurse = 0; \
762 if (TARGET_RELOCATABLE \
763 && in_section != in_toc \
764 && in_section != in_text \
765 && in_section != in_ctors \
766 && in_section != in_dtors \
768 && GET_CODE (VALUE) != CONST_INT \
769 && GET_CODE (VALUE) != CONST_DOUBLE \
770 && CONSTANT_P (VALUE)) \
775 ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", fixuplabelno); \
777 ASM_OUTPUT_LABEL (FILE, buf); \
778 fprintf (FILE, "\t.long ("); \
779 output_addr_const (FILE, (VALUE)); \
780 fprintf (FILE, ")@fixup\n"); \
781 fprintf (FILE, "\t.section\t\".fixup\",\"aw\"\n"); \
782 ASM_OUTPUT_ALIGN (FILE, 2); \
783 fprintf (FILE, "\t.long\t"); \
784 assemble_name (FILE, buf); \
785 fprintf (FILE, "\n\t.previous\n"); \
788 /* Remove initial .'s to turn a -mcall-aixdesc function \
789 address into the address of the descriptor, not the function \
791 else if (GET_CODE (VALUE) == SYMBOL_REF \
792 && XSTR (VALUE, 0)[0] == '.' \
793 && DEFAULT_ABI == ABI_AIX) \
795 const char *name = XSTR (VALUE, 0); \
796 while (*name == '.') \
799 fprintf (FILE, "\t.long %s\n", name); \
803 fprintf (FILE, "\t.long "); \
804 output_addr_const (FILE, (VALUE)); \
805 fprintf (FILE, "\n"); \
809 /* This is how to output an assembler line defining an address
810 constant for the dwarf call unwinding information.
811 For -mrelocatable, we mark all addresses that need to be fixed up
812 in the .fixup section. */
814 #define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
816 if (TARGET_RELOCATABLE) \
821 ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", fixuplabelno); \
823 ASM_OUTPUT_LABEL (FILE, buf); \
824 fprintf (FILE, "\t.%dbyte\t", POINTER_SIZE / BITS_PER_UNIT); \
825 assemble_name (FILE, LABEL); \
826 fprintf (FILE, "\n"); \
827 fprintf (FILE, "\t.section \".fixup\",\"aw\"\n"); \
828 ASM_OUTPUT_ALIGN (FILE, 2); \
829 fprintf (FILE, "\t.long\t"); \
830 assemble_name (FILE, buf); \
831 fprintf (FILE, "\n\t.previous\n"); \
835 fprintf (FILE, "\t.%dbyte\t", POINTER_SIZE / BITS_PER_UNIT); \
836 assemble_name (FILE, LABEL); \
840 /* This is the end of what might become sysv4.h. */
842 /* Allow stabs and dwarf, for now, make stabs the default debugging type,
843 not dwarf since G++ doesn't support dwarf. */
844 #undef PREFERRED_DEBUGGING_TYPE
845 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
847 #define DBX_DEBUGGING_INFO
849 /* If we are referencing a function that is static or is known to be
850 in this file, make the SYMBOL_REF special. We can use this to indicate
851 that we can branch to this function without emitting a no-op after the
852 call. For real AIX calling sequences, we also replace the
853 function name with the real name (1 or 2 leading .'s), rather than
854 the function descriptor name. This saves a lot of overriding code
855 to read the prefixes. */
857 #undef ENCODE_SECTION_INFO
858 #define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL)
860 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
862 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
863 assemble_name (FILE, NAME)
865 /* This macro gets just the user-specified name
866 out of the string in a SYMBOL_REF. Discard
868 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
870 const char *_name = SYMBOL_NAME; \
871 while (*_name == '*' || *_name == '@') \
876 /* This is how to output a reference to a user-level label named NAME.
877 `assemble_name' uses this. */
879 /* Override elfos.h definition. */
880 #undef ASM_OUTPUT_LABELREF
881 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
883 const char *_name = NAME; \
888 fprintf (FILE, "%s", _name + 1); \
890 asm_fprintf (FILE, "%U%s", _name); \
893 /* Switch into a generic section.
895 We make the section read-only and executable for a function decl,
896 read-only for a const data decl, and writable for a non-const data decl.
898 If the section has already been defined, we must not
899 emit the attributes here. The SVR4 assembler does not
900 recognize section redefinitions.
901 If DECL is NULL, no attributes are emitted.
903 Note, Solaris as doesn't like @nobits, and gas can handle .sbss without
906 /* Override elfos.h definition. */
907 #undef ASM_OUTPUT_SECTION_NAME
908 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
910 static struct section_info \
912 struct section_info *next; \
914 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
916 struct section_info *s; \
918 enum sect_enum type; \
920 for (s = sections; s; s = s->next) \
921 if (!strcmp (NAME, s->name)) \
924 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
925 type = SECT_EXEC, mode = "ax"; \
926 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC) && !TARGET_RELOCATABLE && !flag_pic) \
927 type = SECT_RO, mode = "a"; \
929 type = SECT_RW, mode = "aw"; \
933 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
934 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
935 strcpy (s->name, NAME); \
937 s->next = sections; \
939 fprintf (FILE, "\t.section\t\"%s\",\"%s\"\n", NAME, mode); \
943 if (DECL && s->type != type) \
944 error_with_decl (DECL, "%s causes a section type conflict"); \
946 fprintf (FILE, "\t.section\t\"%s\"\n", NAME); \
950 /* Override elfos.h definition. */
951 #undef ASM_OUTPUT_CONSTRUCTOR
952 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
954 if (DEFAULT_ABI != ABI_SOLARIS) \
957 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
958 assemble_name (FILE, NAME); \
963 fputs ("\tbl ", FILE); \
964 assemble_name (FILE, NAME); \
966 fputs ("\n", FILE); \
969 /* A C statement (sans semicolon) to output an element in the table of
970 global destructors. */
971 /* Override elfos.h definition. */
972 #undef ASM_OUTPUT_DESTRUCTOR
973 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
975 if (DEFAULT_ABI != ABI_SOLARIS) \
978 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
979 assemble_name (FILE, NAME); \
984 fputs ("\tbl ", FILE); \
985 assemble_name (FILE, NAME); \
987 fputs ("\n", FILE); \
990 /* But, to make this work, we have to output the stabs for the function
993 #define DBX_FUNCTION_FIRST
995 /* This is the end of what might become sysv4dbx.h. */
997 /* Override rs6000.h definition. */
998 #undef TARGET_VERSION
999 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
1001 #define CPP_PREDEFINES \
1002 "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
1004 /* Pass various options to the assembler. */
1005 /* Override svr4.h definition. */
1007 #define ASM_SPEC "%(asm_cpu) \
1008 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
1009 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
1010 %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
1011 %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
1012 %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
1013 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
1014 %{mcall-solaris: -mlittle -msolaris} \
1015 %{mcall-linux: -mbig} }}}}"
1017 #define CC1_ENDIAN_BIG_SPEC ""
1019 #define CC1_ENDIAN_LITTLE_SPEC "\
1020 %{!mstrict-align: %{!mno-strict-align: \
1024 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big_spec)"
1026 /* Pass -G xxx to the compiler and set correct endian mode. */
1027 #define CC1_SPEC "%{G*} \
1028 %{mlittle: %(cc1_endian_little)} %{!mlittle: %{mlittle-endian: %(cc1_endian_little)}} \
1029 %{mbig: %(cc1_endian_big)} %{!mbig: %{mbig-endian: %(cc1_endian_big)}} \
1030 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
1031 %{mcall-aixdesc: -mbig %(cc1_endian_big) } \
1032 %{mcall-solaris: -mlittle %(cc1_endian_little) } \
1033 %{mcall-linux: -mbig %(cc1_endian_big) } \
1034 %{!mcall-aixdesc: %{!mcall-solaris: %{!mcall-linux: \
1035 %(cc1_endian_default) \
1038 %{mcall-solaris: -mregnames } \
1039 %{mno-sdata: -msdata=none } \
1040 %{meabi: %{!mcall-*: -mcall-sysv }} \
1041 %{!meabi: %{!mno-eabi: \
1042 %{mrelocatable: -meabi } \
1043 %{mcall-solaris: -mno-eabi } \
1044 %{mcall-linux: -mno-eabi }}} \
1045 %{msdata: -msdata=default} \
1046 %{mno-sdata: -msdata=none} \
1049 /* Don't put -Y P,<path> for cross compilers. */
1050 #ifndef CROSS_COMPILE
1051 #define LINK_PATH_SPEC "\
1052 %{!R*:%{L*:-R %*}} \
1053 %{!nostdlib: %{!YP,*: \
1055 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1056 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
1057 %{!R*: %{!L*: -R /usr/ucblib}} \
1059 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1060 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
1063 #define LINK_PATH_SPEC ""
1066 /* Default starting address if specified. */
1067 #define LINK_START_SPEC "\
1068 %{mads: %(link_start_ads) } \
1069 %{myellowknife: %(link_start_yellowknife) } \
1070 %{mmvme: %(link_start_mvme) } \
1071 %{msim: %(link_start_sim) } \
1072 %{mcall-linux: %(link_start_linux) } \
1073 %{mcall-solaris: %(link_start_solaris) } \
1074 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_start_default) }}}}}}"
1076 #define LINK_START_DEFAULT_SPEC ""
1078 /* Override svr4.h definition. */
1080 #define LINK_SPEC "\
1081 %{h*} %{v:-V} %{G*} \
1082 %{Wl,*:%*} %{YP,*} %{R*} \
1085 %{!Ttext*: %(link_start) } \
1089 /* For now, turn off shared libraries by default. */
1090 #ifndef SHARED_LIB_SUPPORT
1091 #define NO_SHARED_LIB_SUPPORT
1094 #ifndef NO_SHARED_LIB_SUPPORT
1095 /* Shared libraries are default. */
1096 #define LINK_SHLIB_SPEC "\
1097 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
1099 %{static:-dn -Bstatic} \
1100 %{shared:-G -dy -z text} \
1101 %{symbolic:-Bsymbolic -G -dy -z text}"
1104 /* Shared libraries are not default. */
1105 #define LINK_SHLIB_SPEC "\
1106 %{mshlib: %(link_path) } \
1107 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
1109 %{shared:-G -dy -z text %(link_path) } \
1110 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
1113 /* Override the default target of the linker. */
1114 #define LINK_TARGET_SPEC "\
1115 %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
1116 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
1117 %{mcall-solaris: -oformat elf32-powerpcle} \
1120 /* Any specific OS flags. */
1121 #define LINK_OS_SPEC "\
1122 %{mads: %(link_os_ads) } \
1123 %{myellowknife: %(link_os_yellowknife) } \
1124 %{mmvme: %(link_os_mvme) } \
1125 %{msim: %(link_os_sim) } \
1126 %{mcall-linux: %(link_os_linux) } \
1127 %{mcall-solaris: %(link_os_solaris) } \
1128 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_os_default) }}}}}}"
1130 #define LINK_OS_DEFAULT_SPEC ""
1132 #define CPP_SYSV_SPEC \
1133 "%{mrelocatable*: -D_RELOCATABLE} \
1134 %{fpic: -D__PIC__=1 -D__pic__=1} \
1135 %{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}} \
1136 %{mcall-sysv: -D_CALL_SYSV} \
1137 %{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
1138 %{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %(cpp_sysv_default) }}} \
1139 %{msoft-float: -D_SOFT_FLOAT} \
1140 %{!msoft-float: %{!mhard-float: \
1141 %{mcpu=401: -D_SOFT_FLOAT} \
1142 %{mcpu=403: -D_SOFT_FLOAT} \
1143 %{mcpu=ec603e: -D_SOFT_FLOAT} \
1144 %{mcpu=801: -D_SOFT_FLOAT} \
1145 %{mcpu=821: -D_SOFT_FLOAT} \
1146 %{mcpu=823: -D_SOFT_FLOAT} \
1147 %{mcpu=860: -D_SOFT_FLOAT} \
1148 %{!mcpu*: %(cpp_float_default) }}}"
1150 /* Whether floating point is disabled by default. */
1151 #define CPP_FLOAT_DEFAULT_SPEC ""
1153 #define CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
1155 #define CPP_ENDIAN_BIG_SPEC "-D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)"
1157 #define CPP_ENDIAN_LITTLE_SPEC "-D_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -Amachine(littleendian)"
1159 #define CPP_ENDIAN_SOLARIS_SPEC "-D__LITTLE_ENDIAN__ -Amachine(littleendian)"
1161 /* For solaris, don't define _LITTLE_ENDIAN, it conflicts with a header file. */
1162 #define CPP_ENDIAN_SPEC \
1163 "%{mlittle: %(cpp_endian_little) } \
1164 %{mlittle-endian: %(cpp_endian_little) } \
1165 %{mbig: %(cpp_endian_big) } \
1166 %{mbig-endian: %(cpp_endian_big) } \
1167 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
1168 %{mcall-solaris: %(cpp_endian_solaris) } \
1169 %{mcall-linux: %(cpp_endian_big) } \
1170 %{mcall-aixdesc: %(cpp_endian_big) } \
1171 %{!mcall-solaris: %{!mcall-linux: %{!mcall-aixdesc: %(cpp_endian_default) }}}}}}}"
1173 #define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
1175 /* Override rs6000.h definition. */
1177 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
1178 %{mads: %(cpp_os_ads) } \
1179 %{myellowknife: %(cpp_os_yellowknife) } \
1180 %{mmvme: %(cpp_os_mvme) } \
1181 %{msim: %(cpp_os_sim) } \
1182 %{mcall-linux: %(cpp_os_linux) } \
1183 %{mcall-solaris: %(cpp_os_solaris) } \
1184 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}}}"
1186 #define CPP_OS_DEFAULT_SPEC ""
1188 /* Override svr4.h definition. */
1189 #undef STARTFILE_SPEC
1190 #define STARTFILE_SPEC "\
1191 %{mads: %(startfile_ads) } \
1192 %{myellowknife: %(startfile_yellowknife) } \
1193 %{mmvme: %(startfile_mvme) } \
1194 %{msim: %(startfile_sim) } \
1195 %{mcall-linux: %(startfile_linux) } \
1196 %{mcall-solaris: %(startfile_solaris) } \
1197 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(startfile_default) }}}}}}"
1199 #define STARTFILE_DEFAULT_SPEC ""
1201 /* Override svr4.h definition. */
1204 %{mads: %(lib_ads) } \
1205 %{myellowknife: %(lib_yellowknife) } \
1206 %{mmvme: %(lib_mvme) } \
1207 %{msim: %(lib_sim) } \
1208 %{mcall-linux: %(lib_linux) } \
1209 %{mcall-solaris: %(lib_solaris) } \
1210 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(lib_default) }}}}}}"
1212 /* Override rs6000.h definition. */
1214 #define LIBGCC_SPEC "libgcc.a%s"
1216 #define LIB_DEFAULT_SPEC ""
1218 /* Override svr4.h definition. */
1220 #define ENDFILE_SPEC "\
1221 %{mads: ecrtn.o%s} \
1222 %{myellowknife: ecrtn.o%s} \
1223 %{mmvme: ecrtn.o%s} \
1224 %{msim: ecrtn.o%s} \
1225 %{mcall-linux: %(endfile_linux) } \
1226 %{mcall-solaris: scrtn.o%s} \
1227 %{mvxworks: %(endfile_vxworks) } \
1228 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %{!mvxworks: %(endfile_default) }}}}}}}"
1230 #define ENDFILE_DEFAULT_SPEC ""
1232 /* Motorola ADS support. */
1233 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1235 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s"
1237 #define ENDFILE_ADS_SPEC "ecrtn.o%s"
1239 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1241 #define LINK_OS_ADS_SPEC ""
1243 #define CPP_OS_ADS_SPEC ""
1245 /* Motorola Yellowknife support. */
1246 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1248 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s"
1250 #define ENDFILE_YELLOWKNIFE_SPEC "ecrtn.o%s"
1252 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1254 #define LINK_OS_YELLOWKNIFE_SPEC ""
1256 #define CPP_OS_YELLOWKNIFE_SPEC ""
1258 /* Motorola MVME support. */
1259 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1261 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s"
1263 #define ENDFILE_MVME_SPEC "ecrtn.o%s"
1265 #define LINK_START_MVME_SPEC "%{!Wl,-T*: %{!T*: -Ttext 0x40000}}"
1267 #define LINK_OS_MVME_SPEC ""
1269 #define CPP_OS_MVME_SPEC ""
1271 /* PowerPC simulator based on netbsd system calls support. */
1272 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1274 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s"
1276 #define ENDFILE_SIM_SPEC "ecrtn.o%s"
1278 #define LINK_START_SIM_SPEC "-Ttext 0x10000074"
1280 #define LINK_OS_SIM_SPEC ""
1282 #define CPP_OS_SIM_SPEC ""
1284 /* GNU/Linux support. */
1285 #ifdef USE_GNULIBC_1
1286 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1289 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1290 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1291 %{profile:-lc_p} %{!profile:-lc}}}"
1294 #define STARTFILE_LINUX_SPEC "\
1295 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1296 %{mnewlib: ecrti.o%s} \
1297 %{!mnewlib: crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
1299 #define ENDFILE_LINUX_SPEC "\
1300 %{mnewlib: ecrtn.o%s} \
1301 %{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"
1303 #define LINK_START_LINUX_SPEC "-Ttext 0x400074"
1305 #define LINK_OS_LINUX_SPEC ""
1307 #ifdef USE_GNULIBC_1
1308 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1309 %{!undef:%{!ansi:%{!std=*:-Dunix -Dlinux}%{std=gnu*:-Dunix -Dlinux}}} \
1310 -Asystem(unix) -Asystem(posix)"
1312 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1313 %{!undef:%{!ansi:%{!std=*:-Dunix -Dlinux}%{std=gnu*:-Dunix -Dlinux}}} \
1314 -Asystem(unix) -Asystem(posix) %{pthread:-D_REENTRANT}"
1317 /* Solaris support. */
1318 /* For Solaris, Gcc automatically adds in one of the files
1319 /usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
1320 /usr/ccs/lib/values-Xt.o for each final link step (depending upon the other
1321 gcc options selected, such as -traditional and -ansi). These files each
1322 contain one (initialized) copy of a special variable called `_lib_version'.
1323 Each one of these files has `_lib_version' initialized to a different (enum)
1324 value. The SVR4 library routines query the value of `_lib_version' at run
1325 to decide how they should behave. Specifically, they decide (based upon the
1326 value of `_lib_version') if they will act in a strictly ANSI conforming
1329 #define LIB_SOLARIS_SPEC "\
1330 %{mnewlib: --start-group -lsolaris -lc --end-group } \
1332 %{ansi:values-Xc.o%s} \
1334 %{traditional:values-Xt.o%s} \
1335 %{!traditional:values-Xa.o%s}} \
1336 %{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
1337 %{solaris-cclib: /opt/SUNWspro/SC4.0/lib/libabi.a} \
1338 %{!shared: %{!symbolic: -lc }}}"
1340 #define STARTFILE_SOLARIS_SPEC "\
1341 %{!msolaris-cclib: scrti.o%s scrt0.o%s} \
1342 %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crti.o%s /opt/SUNWspro/SC4.0/lib/crt1.o%s}"
1344 #define ENDFILE_SOLARIS_SPEC "\
1345 %{!msolaris-cclib: scrtn.o%s} \
1346 %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crtn.o%s}"
1348 #ifdef CROSS_COMPILE
1349 #define LINK_START_SOLARIS_SPEC "-Ttext 0x2000074"
1351 #define LINK_START_SOLARIS_SPEC ""
1354 #define LINK_OS_SOLARIS_SPEC ""
1356 #define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__ -D__SVR4__ \
1357 %{!undef:%{!ansi:%{!std=*:-Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__} \
1358 %{std=gnu*:-Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__}}} \
1361 /* VxWorks support. */
1362 /* VxWorks does all the library stuff itself. */
1363 #define LIB_VXWORKS_SPEC ""
1365 /* VxWorks provides the functionality of crt0.o and friends itself. */
1367 #define STARTFILE_VXWORKS_SPEC ""
1369 #define ENDFILE_VXWORKS_SPEC ""
1371 /* Because it uses ld -r, vxworks has no start/end files, nor starting
1374 #define LINK_START_VXWORKS_SPEC ""
1376 #define LINK_OS_VXWORKS_SPEC "-r"
1378 #define CPP_OS_VXWORKS_SPEC "\
1381 %{mpowerpc*: -DCPU=PPC603} \
1382 %{!mno-powerpc: -DCPU=PPC603}} \
1383 %{mcpu=powerpc: -DCPU=PPC603} \
1384 %{mcpu=401: -DCPU=PPC403} \
1385 %{mcpu=403: -DCPU=PPC403} \
1386 %{mcpu=601: -DCPU=PPC601} \
1387 %{mcpu=602: -DCPU=PPC603} \
1388 %{mcpu=603: -DCPU=PPC603} \
1389 %{mcpu=603e: -DCPU=PPC603} \
1390 %{mcpu=ec603e: -DCPU=PPC603} \
1391 %{mcpu=604: -DCPU=PPC604} \
1392 %{mcpu=604e: -DCPU=PPC604} \
1393 %{mcpu=620: -DCPU=PPC604} \
1394 %{mcpu=740: -DCPU=PPC603} \
1395 %{mcpu=750: -DCPU=PPC603} \
1396 %{mcpu=801: -DCPU=PPC603} \
1397 %{mcpu=821: -DCPU=PPC603} \
1398 %{mcpu=823: -DCPU=PPC603} \
1399 %{mcpu=860: -DCPU=PPC603}"
1401 /* Define any extra SPECS that the compiler needs to generate. */
1402 /* Override rs6000.h definition. */
1403 #undef SUBTARGET_EXTRA_SPECS
1404 #define SUBTARGET_EXTRA_SPECS \
1405 { "cpp_sysv", CPP_SYSV_SPEC }, \
1406 { "cpp_sysv_default", CPP_SYSV_DEFAULT_SPEC }, \
1407 { "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
1408 { "cpp_endian", CPP_ENDIAN_SPEC }, \
1409 { "lib_ads", LIB_ADS_SPEC }, \
1410 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1411 { "lib_mvme", LIB_MVME_SPEC }, \
1412 { "lib_sim", LIB_SIM_SPEC }, \
1413 { "lib_linux", LIB_LINUX_SPEC }, \
1414 { "lib_solaris", LIB_SOLARIS_SPEC }, \
1415 { "lib_vxworks", LIB_VXWORKS_SPEC }, \
1416 { "lib_default", LIB_DEFAULT_SPEC }, \
1417 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1418 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1419 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1420 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1421 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1422 { "startfile_solaris", STARTFILE_SOLARIS_SPEC }, \
1423 { "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \
1424 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1425 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1426 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1427 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1428 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1429 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1430 { "endfile_solaris", ENDFILE_SOLARIS_SPEC }, \
1431 { "endfile_vxworks", ENDFILE_VXWORKS_SPEC }, \
1432 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1433 { "link_path", LINK_PATH_SPEC }, \
1434 { "link_shlib", LINK_SHLIB_SPEC }, \
1435 { "link_target", LINK_TARGET_SPEC }, \
1436 { "link_start", LINK_START_SPEC }, \
1437 { "link_start_ads", LINK_START_ADS_SPEC }, \
1438 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1439 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1440 { "link_start_sim", LINK_START_SIM_SPEC }, \
1441 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1442 { "link_start_solaris", LINK_START_SOLARIS_SPEC }, \
1443 { "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \
1444 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1445 { "link_os", LINK_OS_SPEC }, \
1446 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1447 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1448 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1449 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1450 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1451 { "link_os_solaris", LINK_OS_SOLARIS_SPEC }, \
1452 { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \
1453 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1454 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1455 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1456 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1457 { "cpp_endian_big", CPP_ENDIAN_BIG_SPEC }, \
1458 { "cpp_endian_little", CPP_ENDIAN_LITTLE_SPEC }, \
1459 { "cpp_endian_solaris", CPP_ENDIAN_SOLARIS_SPEC }, \
1460 { "cpp_float_default", CPP_FLOAT_DEFAULT_SPEC }, \
1461 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1462 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1463 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1464 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1465 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1466 { "cpp_os_solaris", CPP_OS_SOLARIS_SPEC }, \
1467 { "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \
1468 { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
1470 /* Define this macro as a C expression for the initializer of an
1471 array of string to tell the driver program which options are
1472 defaults for this target and thus do not need to be handled
1473 specially when using `MULTILIB_OPTIONS'.
1475 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1476 the target makefile fragment or if none of the options listed in
1477 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1479 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1481 /* Define this macro if the code for function profiling should come
1482 before the function prologue. Normally, the profiling code comes
1484 #define PROFILE_BEFORE_PROLOGUE 1
1486 /* Function name to call to do profiling. */
1487 #define RS6000_MCOUNT "_mcount"