vxworks patches from the Cygnus tree originally by
[official-gcc.git] / gcc / config / rs6000 / sysv4.h
blobcc19a95076a516dd35c108af45d4c081ad63147d
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)
10 any later version.
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 /* 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 #undef ASM_DEFAULT_SPEC
34 #define ASM_DEFAULT_SPEC "-mppc"
36 #undef CPP_DEFAULT_SPEC
37 #define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
39 /* Small data support types */
40 enum rs6000_sdata_type {
41 SDATA_NONE, /* no small data support */
42 SDATA_DATA, /* just put data in .sbss/.sdata, don't use relocs */
43 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss */
44 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2 */
47 extern enum rs6000_sdata_type rs6000_sdata;
49 /* V.4/eabi switches */
50 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
51 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
52 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative */
53 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec */
54 #define MASK_LITTLE_ENDIAN 0x04000000 /* target is little endian */
55 #define MASK_REGNAMES 0x02000000 /* use alternate register names. */
56 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args */
58 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
59 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
60 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
61 #define TARGET_EABI (target_flags & MASK_EABI)
62 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
63 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
64 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
65 #define TARGET_TOC ((target_flags & MASK_64BIT) \
66 || ((target_flags & (MASK_RELOCATABLE \
67 | MASK_MINIMAL_TOC)) \
68 && flag_pic > 1) \
69 || DEFAULT_ABI == ABI_AIX \
70 || DEFAULT_ABI == ABI_NT)
72 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
73 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
74 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
75 #define TARGET_NO_TOC (! TARGET_TOC)
76 #define TARGET_NO_EABI (! TARGET_EABI)
78 /* Strings provided by SUBTARGET_OPTIONS */
79 extern const char *rs6000_abi_name;
80 extern const char *rs6000_sdata_name;
82 #undef SUBTARGET_OPTIONS
83 #define SUBTARGET_OPTIONS \
84 { "call-", &rs6000_abi_name}, \
85 { "sdata=", &rs6000_sdata_name}
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 #ifndef SDATA_DEFAULT_SIZE
93 #define SDATA_DEFAULT_SIZE 8
94 #endif
96 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
97 the same as -mminimal-toc. */
98 #undef SUBTARGET_SWITCHES
99 #define SUBTARGET_SWITCHES \
100 { "bit-align", -MASK_NO_BITFIELD_TYPE }, \
101 { "no-bit-align", MASK_NO_BITFIELD_TYPE }, \
102 { "strict-align", MASK_STRICT_ALIGN }, \
103 { "no-strict-align", -MASK_STRICT_ALIGN }, \
104 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
105 { "no-relocatable", -MASK_RELOCATABLE }, \
106 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
107 { "no-relocatable-lib", -MASK_RELOCATABLE }, \
108 { "little-endian", MASK_LITTLE_ENDIAN }, \
109 { "little", MASK_LITTLE_ENDIAN }, \
110 { "big-endian", -MASK_LITTLE_ENDIAN }, \
111 { "big", -MASK_LITTLE_ENDIAN }, \
112 { "no-toc", 0 }, \
113 { "toc", MASK_MINIMAL_TOC }, \
114 { "full-toc", MASK_MINIMAL_TOC }, \
115 { "prototype", MASK_PROTOTYPE }, \
116 { "no-prototype", -MASK_PROTOTYPE }, \
117 { "no-traceback", 0 }, \
118 { "eabi", MASK_EABI }, \
119 { "no-eabi", -MASK_EABI }, \
120 { "regnames", MASK_REGNAMES }, \
121 { "no-regnames", -MASK_REGNAMES }, \
122 { "sdata", 0 }, \
123 { "no-sdata", 0 }, \
124 { "sim", 0 }, \
125 { "ads", 0 }, \
126 { "yellowknife", 0 }, \
127 { "mvme", 0 }, \
128 { "emb", 0 }, \
129 { "vxworks", 0 }, \
130 { "solaris-cclib", 0 }, \
131 { "shlib", 0 }, \
132 EXTRA_SUBTARGET_SWITCHES \
133 { "newlib", 0 },
135 /* This is meant to be redefined in the host dependent files */
136 #define EXTRA_SUBTARGET_SWITCHES
138 /* Sometimes certain combinations of command options do not make sense
139 on a particular target machine. You can define a macro
140 `OVERRIDE_OPTIONS' to take account of this. This macro, if
141 defined, is executed once just after all the command options have
142 been parsed.
144 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
145 get control. */
147 #define SUBTARGET_OVERRIDE_OPTIONS \
148 do { \
149 if (!g_switch_set) \
150 g_switch_value = SDATA_DEFAULT_SIZE; \
152 if (!strcmp (rs6000_abi_name, "sysv")) \
153 rs6000_current_abi = ABI_V4; \
154 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
156 rs6000_current_abi = ABI_V4; \
157 target_flags &= ~ MASK_EABI; \
159 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
160 || !strcmp (rs6000_abi_name, "eabi")) \
162 rs6000_current_abi = ABI_V4; \
163 target_flags |= MASK_EABI; \
165 else if (!strcmp (rs6000_abi_name, "aix")) \
167 rs6000_current_abi = ABI_AIX_NODESC; \
168 target_flags |= MASK_EABI; \
170 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
171 rs6000_current_abi = ABI_AIX; \
172 else if (!strcmp (rs6000_abi_name, "nt")) \
173 rs6000_current_abi = ABI_NT; \
174 else if (!strcmp (rs6000_abi_name, "linux")) \
175 rs6000_current_abi = ABI_V4; \
176 else if (!strcmp (rs6000_abi_name, "solaris")) \
177 rs6000_current_abi = ABI_SOLARIS; \
178 else \
180 rs6000_current_abi = ABI_V4; \
181 error ("Bad value for -mcall-%s", rs6000_abi_name); \
184 if (rs6000_sdata_name) \
186 if (!strcmp (rs6000_sdata_name, "none")) \
187 rs6000_sdata = SDATA_NONE; \
188 else if (!strcmp (rs6000_sdata_name, "data")) \
189 rs6000_sdata = SDATA_DATA; \
190 else if (!strcmp (rs6000_sdata_name, "default")) \
191 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
192 else if (!strcmp (rs6000_sdata_name, "sysv")) \
193 rs6000_sdata = SDATA_SYSV; \
194 else if (!strcmp (rs6000_sdata_name, "eabi")) \
195 rs6000_sdata = SDATA_EABI; \
196 else \
197 error ("Bad value for -msdata=%s", rs6000_sdata_name); \
199 else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
201 rs6000_sdata = SDATA_DATA; \
202 rs6000_sdata_name = "data"; \
204 else \
206 rs6000_sdata = SDATA_NONE; \
207 rs6000_sdata_name = "none"; \
210 if (TARGET_RELOCATABLE && \
211 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
213 rs6000_sdata = SDATA_DATA; \
214 error ("-mrelocatable and -msdata=%s are incompatible.", \
215 rs6000_sdata_name); \
218 else if (flag_pic && \
219 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
221 rs6000_sdata = SDATA_DATA; \
222 error ("-f%s and -msdata=%s are incompatible.", \
223 (flag_pic > 1) ? "PIC" : "pic", \
224 rs6000_sdata_name); \
227 if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4 \
228 && DEFAULT_ABI != ABI_SOLARIS) \
230 rs6000_sdata = SDATA_NONE; \
231 error ("-msdata=%s and -mcall-%s are incompatible.", \
232 rs6000_sdata_name, rs6000_abi_name); \
235 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
237 target_flags |= MASK_MINIMAL_TOC; \
238 error ("-mrelocatable and -mno-minimal-toc are incompatible."); \
241 if (TARGET_RELOCATABLE && \
242 (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
244 target_flags &= ~MASK_RELOCATABLE; \
245 error ("-mrelocatable and -mcall-%s are incompatible.", \
246 rs6000_abi_name); \
249 if (flag_pic > 1 && \
250 (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
252 flag_pic = 0; \
253 error ("-fPIC and -mcall-%s are incompatible.", \
254 rs6000_abi_name); \
257 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
259 target_flags &= ~MASK_LITTLE_ENDIAN; \
260 error ("-mcall-aixdesc must be big endian"); \
263 if (rs6000_current_abi == ABI_NT && TARGET_BIG_ENDIAN) \
265 target_flags |= MASK_LITTLE_ENDIAN; \
266 error ("-mcall-nt must be little endian"); \
269 /* Treat -fPIC the same as -mrelocatable */ \
270 if (flag_pic > 1) \
271 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
273 else if (TARGET_RELOCATABLE) \
274 flag_pic = 2; \
276 } while (0)
278 #undef TARGET_DEFAULT
279 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
281 #undef PROCESSOR_DEFAULT
282 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
284 /* System V.4 uses register 13 as a pointer to the small data area,
285 so it is not available to the normal user. */
287 #undef FIXED_R13
288 #define FIXED_R13 1
290 /* System V.4 passes the first 8 floating arguments in registers,
291 instead of the first 13 like AIX does. */
292 #undef FP_ARG_MAX_REG
293 #define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) \
294 ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
296 /* Size of the V.4 varargs area if needed */
297 #undef RS6000_VARARGS_AREA
298 #define RS6000_VARARGS_AREA ((rs6000_sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
300 /* Override default big endianism */
301 #undef BYTES_BIG_ENDIAN
302 #undef WORDS_BIG_ENDIAN
303 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
304 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
306 /* Define this to set the endianness to use in libgcc2.c, which can
307 not depend on target_flags. */
308 #if !defined(_LITTLE_ENDIAN) && !defined(__sun__)
309 #define LIBGCC2_WORDS_BIG_ENDIAN 1
310 #else
311 #define LIBGCC2_WORDS_BIG_ENDIAN 0
312 #endif
314 /* Size of the outgoing register save area */
315 #undef RS6000_REG_SAVE
316 #define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \
317 || DEFAULT_ABI == ABI_AIX_NODESC) \
318 ? (TARGET_64BIT ? 64 : 32) \
319 : 0)
321 /* Size of the fixed area on the stack. For AIX, use the standard 6 word
322 area, otherwise use 2 words to store back chain & LR. */
323 #undef RS6000_SAVE_AREA
324 #define RS6000_SAVE_AREA \
325 (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) ? 24 : 8) << (TARGET_64BIT ? 1 : 0))
327 /* Define cutoff for using external functions to save floating point.
328 Currently on V.4, always use inline stores */
329 #undef FP_SAVE_INLINE
330 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
332 /* Don't generate XCOFF debugging information. */
334 #undef XCOFF_DEBUGGING_INFO
336 /* Don't use the COFF object file format. */
338 #undef OBJECT_FORMAT_COFF
340 /* Put jump tables in read-only memory, rather than in .text. */
341 #undef JUMP_TABLES_IN_TEXT_SECTION
342 #define JUMP_TABLES_IN_TEXT_SECTION 0
344 /* Disable AIX-ism that disables turning -B into -L if the argument specifies a
345 relative file name. This breaks setting GCC_EXEC_PREFIX to D:\path under
346 Windows. */
347 #undef RELATIVE_PREFIX_NOT_LINKDIR
349 /* Undefine some things which are defined by the generic svr4.h. */
351 #undef ASM_FILE_END
352 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
353 #undef READONLY_DATA_SECTION
354 #undef SELECT_SECTION
355 #undef ASM_DECLARE_FUNCTION_NAME
356 #undef ASM_OUTPUT_CONSTRUCTOR
357 #undef ASM_OUTPUT_DESTRUCTOR
359 /* Use the regular svr4 definitions. */
361 #include "svr4.h"
363 /* Prefix and suffix to use to saving floating point */
364 #define SAVE_FP_PREFIX "_savefpr_"
365 #define SAVE_FP_SUFFIX "_l"
367 /* Prefix and suffix to use to restoring floating point */
368 #define RESTORE_FP_PREFIX "_restfpr_"
369 #define RESTORE_FP_SUFFIX "_l"
371 /* Type used for ptrdiff_t, as a string used in a declaration. */
372 #undef PTRDIFF_TYPE
373 #define PTRDIFF_TYPE "int"
375 /* Type used for wchar_t, as a string used in a declaration. */
376 #undef WCHAR_TYPE
377 #define WCHAR_TYPE "long int"
379 /* Width of wchar_t in bits. */
380 #undef WCHAR_TYPE_SIZE
381 #define WCHAR_TYPE_SIZE 32
383 /* Make int foo : 8 not cause structures to be aligned to an int boundary */
385 #undef PCC_BITFIELD_TYPE_MATTERS
386 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
388 /* Define this macro to be the value 1 if instructions will fail to
389 work if given data not on the nominal alignment. If instructions
390 will merely go slower in that case, define this macro as 0. */
391 #undef STRICT_ALIGNMENT
392 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
394 /* Alignment in bits of the stack boundary. Note, in order to allow building
395 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
396 versions, just use 64 as the stack boundary. */
397 #undef STACK_BOUNDARY
398 #define STACK_BOUNDARY 64
400 /* Real stack boundary as mandated by the appropriate ABI */
401 #define ABI_STACK_BOUNDARY ((TARGET_EABI) ? 64 : 128)
403 /* No data type wants to be aligned rounder than this. */
404 #undef BIGGEST_ALIGNMENT
405 #define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
407 #undef BIGGEST_FIELD_ALIGNMENT
408 #undef ADJUST_FIELD_ALIGN
409 #undef ROUND_TYPE_ALIGN
411 /* Use ELF style section commands. */
413 #undef TEXT_SECTION_ASM_OP
414 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
416 #undef DATA_SECTION_ASM_OP
417 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
419 #undef BSS_SECTION_ASM_OP
420 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
422 #undef INIT_SECTION_ASM_OP
423 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
425 #undef FINI_SECTION_ASM_OP
426 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
428 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
430 /* Put PC relative got entries in .got2 */
431 #define MINIMAL_TOC_SECTION_ASM_OP \
432 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
434 /* Put relocatable data in .data, not .rodata so initialized pointers can be updated */
435 #undef CONST_SECTION_ASM_OP
436 #define CONST_SECTION_ASM_OP \
437 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".data\"\t# .rodata" : "\t.section\t\".rodata\"")
440 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
441 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
442 #define SBSS_SECTION_ASM_OP \
443 ((DEFAULT_ABI == ABI_SOLARIS) ? "\t.section\t\".sbss\",\"aw\"" : "\t.section\t\".sbss\",\"aw\",@nobits")
446 /* Besides the usual ELF sections, we need a toc section. */
447 #undef EXTRA_SECTIONS
448 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
450 #undef EXTRA_SECTION_FUNCTIONS
451 #define EXTRA_SECTION_FUNCTIONS \
452 CONST_SECTION_FUNCTION \
453 CTORS_SECTION_FUNCTION \
454 DTORS_SECTION_FUNCTION \
455 TOC_SECTION_FUNCTION \
456 SDATA_SECTION_FUNCTION \
457 SDATA2_SECTION_FUNCTION \
458 SBSS_SECTION_FUNCTION \
459 INIT_SECTION_FUNCTION \
460 FINI_SECTION_FUNCTION
462 extern void toc_section (), sdata_section (), sdata2_section ();
463 extern void sbss_section ();
465 #define TOC_SECTION_FUNCTION \
466 void \
467 toc_section () \
469 if (in_section != in_toc) \
471 in_section = in_toc; \
472 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
473 && TARGET_MINIMAL_TOC \
474 && !TARGET_RELOCATABLE) \
476 if (! toc_initialized) \
478 toc_initialized = 1; \
479 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
480 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
481 fprintf (asm_out_file, "\t.tc "); \
482 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
483 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
484 fprintf (asm_out_file, "\n"); \
486 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
487 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
488 fprintf (asm_out_file, " = .+32768\n"); \
490 else \
491 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
493 else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
494 && !TARGET_RELOCATABLE) \
495 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
496 else \
498 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
499 if (! toc_initialized) \
501 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
502 fprintf (asm_out_file, " = .+32768\n"); \
503 toc_initialized = 1; \
509 #define SDATA_SECTION_FUNCTION \
510 void \
511 sdata_section () \
513 if (in_section != in_sdata) \
515 in_section = in_sdata; \
516 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
520 #define SDATA2_SECTION_FUNCTION \
521 void \
522 sdata2_section () \
524 if (in_section != in_sdata2) \
526 in_section = in_sdata2; \
527 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
531 #define SBSS_SECTION_FUNCTION \
532 void \
533 sbss_section () \
535 if (in_section != in_sbss) \
537 in_section = in_sbss; \
538 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
542 #define INIT_SECTION_FUNCTION \
543 void \
544 init_section () \
546 if (in_section != in_init) \
548 in_section = in_init; \
549 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
553 #define FINI_SECTION_FUNCTION \
554 void \
555 fini_section () \
557 if (in_section != in_fini) \
559 in_section = in_fini; \
560 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
564 /* A C statement or statements to switch to the appropriate section
565 for output of RTX in mode MODE. You can assume that RTX is some
566 kind of constant in RTL. The argument MODE is redundant except in
567 the case of a `const_int' rtx. Select the section by calling
568 `text_section' or one of the alternatives for other sections.
570 Do not define this macro if you put all constants in the read-only
571 data section. */
573 extern void rs6000_select_rtx_section (), rs6000_select_section ();
575 #undef SELECT_RTX_SECTION
576 #define SELECT_RTX_SECTION(MODE, X) rs6000_select_rtx_section (MODE, X)
578 /* A C statement or statements to switch to the appropriate
579 section for output of DECL. DECL is either a `VAR_DECL' node
580 or a constant of some sort. RELOC indicates whether forming
581 the initial value of DECL requires link-time relocations. */
583 #undef SELECT_SECTION
584 #define SELECT_SECTION(DECL,RELOC) rs6000_select_section (DECL, RELOC)
586 /* Return non-zero if this entry is to be written into the constant pool
587 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
588 containing one of them. If -mfp-in-toc (the default), we also do
589 this for floating-point constants. We actually can only do this
590 if the FP formats of the target and host machines are the same, but
591 we can't check that since not every file that uses
592 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
594 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
595 allow floating point constants in the TOC if -mrelocatable. */
597 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
598 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
599 (TARGET_TOC \
600 && (GET_CODE (X) == SYMBOL_REF \
601 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
602 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
603 || GET_CODE (X) == LABEL_REF \
604 || (!TARGET_NO_FP_IN_TOC \
605 && !TARGET_RELOCATABLE \
606 && GET_CODE (X) == CONST_DOUBLE \
607 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
608 && BITS_PER_WORD == HOST_BITS_PER_INT)))
610 /* These macros generate the special .type and .size directives which
611 are used to set the corresponding fields of the linker symbol table
612 entries in an ELF object file under SVR4. These macros also output
613 the starting labels for the relevant functions/objects. */
615 /* Write the extra assembler code needed to declare a function properly.
616 Some svr4 assemblers need to also have something extra said about the
617 function's return value. We allow for that here. */
619 extern int rs6000_pic_labelno;
621 #undef ASM_DECLARE_FUNCTION_NAME
622 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
623 do { \
624 const char *orig_name; \
625 const char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
626 STRIP_NAME_ENCODING (orig_name, NAME); \
628 if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag)) \
630 char buf[256]; \
631 const char *buf_ptr; \
633 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
635 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
636 STRIP_NAME_ENCODING (buf_ptr, buf); \
637 fprintf (FILE, "\t%s %s-", init_ptr, buf_ptr); \
639 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
640 fprintf (FILE, "%s\n", buf_ptr); \
643 fprintf (FILE, "\t%s\t %s,", TYPE_ASM_OP, orig_name); \
644 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
645 putc ('\n', FILE); \
646 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
648 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
650 const char *desc_name = orig_name; \
652 while (*desc_name == '.') \
653 desc_name++; \
655 if (TREE_PUBLIC (DECL)) \
656 fprintf (FILE, "\t.globl %s\n", desc_name); \
658 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
659 fprintf (FILE, "%s:\n", desc_name); \
660 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
661 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
662 if (DEFAULT_ABI == ABI_AIX) \
663 fprintf (FILE, "\t%s 0\n", init_ptr); \
664 fprintf (FILE, "\t.previous\n"); \
666 fprintf (FILE, "%s:\n", orig_name); \
667 } while (0)
669 /* How to renumber registers for dbx and gdb. */
671 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
673 /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
675 #undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX
676 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
677 fprintf (FILE, ".%s", PREFIX)
679 /* This is how to allocate empty space in some section. Use .space
680 instead of .zero because the Solaris PowerPC assembler doesn't
681 like it, and gas accepts either syntax. */
683 #undef SKIP_ASM_OP
684 #define SKIP_ASM_OP ".space"
686 /* This says how to output assembler code to declare an
687 uninitialized internal linkage data object. Under SVR4,
688 the linker seems to want the alignment of data objects
689 to depend on their types. We do exactly that here. */
691 #ifndef LOCAL_ASM_OP
692 #define LOCAL_ASM_OP ".local"
693 #endif
695 #ifndef LCOMM_ASM_OP
696 #define LCOMM_ASM_OP ".lcomm"
697 #endif
699 #undef ASM_OUTPUT_ALIGNED_LOCAL
700 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
701 do { \
702 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
703 && (SIZE) <= g_switch_value) \
705 sbss_section (); \
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); \
716 else \
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); \
722 } while (0)
724 /* Describe how to emit uninitialized external linkage items */
725 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
726 do { \
727 ASM_GLOBALIZE_LABEL (FILE, NAME); \
728 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
729 } while (0)
731 /* Switch Recognition by gcc.c. Add -G xx support */
733 #undef SWITCH_TAKES_ARG
734 #define SWITCH_TAKES_ARG(CHAR) \
735 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
736 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
737 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
738 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
739 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
741 /* Output .file. */
742 #undef ASM_FILE_START
743 #define ASM_FILE_START(FILE) \
744 do { \
745 output_file_directive ((FILE), main_input_filename); \
746 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
747 } while (0)
750 /* This is how to output an assembler line defining an `int' constant.
751 For -mrelocatable, we mark all addresses that need to be fixed up
752 in the .fixup section. */
753 #undef ASM_OUTPUT_INT
754 #define ASM_OUTPUT_INT(FILE,VALUE) \
755 do { \
756 static int recurse = 0; \
757 if ((TARGET_RELOCATABLE || flag_pic) \
758 && in_section != in_toc \
759 && in_section != in_text \
760 && in_section != in_ctors \
761 && in_section != in_dtors \
762 && !recurse \
763 && GET_CODE (VALUE) != CONST_INT \
764 && GET_CODE (VALUE) != CONST_DOUBLE \
765 && CONSTANT_P (VALUE)) \
767 static int labelno = 0; \
768 char buf[256]; \
769 const char *p; \
771 recurse = 1; \
772 ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", labelno++); \
773 STRIP_NAME_ENCODING (p, buf); \
774 fprintf (FILE, "%s:\n", p); \
775 fprintf (FILE, "\t.long ("); \
776 output_addr_const (FILE, (VALUE)); \
777 fprintf (FILE, ")@fixup\n"); \
778 fprintf (FILE, "\t.section\t\".fixup\",\"aw\"\n"); \
779 ASM_OUTPUT_ALIGN (FILE, 2); \
780 fprintf (FILE, "\t.long\t%s\n", p); \
781 fprintf (FILE, "\t.previous\n"); \
782 recurse = 0; \
784 /* Remove initial .'s to turn a -mcall-aixdesc or -mcall-nt function \
785 address into the address of the descriptor, not the function \
786 itself. */ \
787 else if (GET_CODE (VALUE) == SYMBOL_REF \
788 && XSTR (VALUE, 0)[0] == '.' \
789 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)) \
791 char *name = XSTR (VALUE, 0); \
792 while (*name == '.') \
793 name++; \
795 fprintf (FILE, "\t.long %s\n", name); \
797 else \
799 fprintf (FILE, "\t.long "); \
800 output_addr_const (FILE, (VALUE)); \
801 fprintf (FILE, "\n"); \
803 } while (0)
805 /* This is the end of what might become sysv4.h. */
807 /* Allow stabs and dwarf, for now, make stabs the default debugging type,
808 not dwarf since G++ doesn't support dwarf. */
809 #undef PREFERRED_DEBUGGING_TYPE
810 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
812 #define DBX_DEBUGGING_INFO
813 #define DWARF_DEBUGGING_INFO
815 /* If we are referencing a function that is static or is known to be
816 in this file, make the SYMBOL_REF special. We can use this to indicate
817 that we can branch to this function without emitting a no-op after the
818 call. For real AIX and NT calling sequences, we also replace the
819 function name with the real name (1 or 2 leading .'s), rather than
820 the function descriptor name. This saves a lot of overriding code
821 to readd the prefixes. */
823 #undef ENCODE_SECTION_INFO
824 #define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL)
826 extern void rs6000_encode_section_info ();
828 /* This macro gets just the user-specified name
829 out of the string in a SYMBOL_REF. Discard
830 a leading * or @. */
831 #undef STRIP_NAME_ENCODING
832 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
833 do { \
834 const char *_name = SYMBOL_NAME; \
835 while (*_name == '*' || *_name == '@') \
836 _name++; \
837 (VAR) = _name; \
838 } while (0)
840 /* This is how to output a reference to a user-level label named NAME.
841 `assemble_name' uses this. */
843 #undef ASM_OUTPUT_LABELREF
844 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
845 do { \
846 const char *_name = NAME; \
847 while (*_name == '*' || *_name == '@') \
848 _name++; \
849 fputs (_name, FILE); \
850 } while (0)
853 * Switch into a generic section.
855 * We make the section read-only and executable for a function decl,
856 * read-only for a const data decl, and writable for a non-const data decl.
858 * If the section has already been defined, we must not
859 * emit the attributes here. The SVR4 assembler does not
860 * recognize section redefinitions.
861 * If DECL is NULL, no attributes are emitted.
863 * Note, Solaris as doesn't like @nobits, and gas can handle .sbss without
864 * needing @nobits.
867 #undef ASM_OUTPUT_SECTION_NAME
868 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
869 do { \
870 static struct section_info \
872 struct section_info *next; \
873 char *name; \
874 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
875 } *sections; \
876 struct section_info *s; \
877 char *mode; \
878 enum sect_enum type; \
880 for (s = sections; s; s = s->next) \
881 if (!strcmp (NAME, s->name)) \
882 break; \
884 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
885 type = SECT_EXEC, mode = "ax"; \
886 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC) && !TARGET_RELOCATABLE && !flag_pic) \
887 type = SECT_RO, mode = "a"; \
888 else \
889 type = SECT_RW, mode = "aw"; \
891 if (s == 0) \
893 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
894 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
895 strcpy (s->name, NAME); \
896 s->type = type; \
897 s->next = sections; \
898 sections = s; \
899 fprintf (FILE, "\t.section\t\"%s\",\"%s\"\n", NAME, mode); \
901 else \
903 if (DECL && s->type != type) \
904 error_with_decl (DECL, "%s causes a section type conflict"); \
906 fprintf (FILE, "\t.section\t\"%s\"\n", NAME); \
908 } while (0)
910 #undef ASM_OUTPUT_CONSTRUCTOR
911 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
912 do { \
913 if (DEFAULT_ABI != ABI_SOLARIS) \
915 ctors_section (); \
916 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
917 assemble_name (FILE, NAME); \
919 else \
921 init_section (); \
922 fputs ("\tbl ", FILE); \
923 assemble_name (FILE, NAME); \
925 fputs ("\n", FILE); \
926 } while (0)
928 /* A C statement (sans semicolon) to output an element in the table of
929 global destructors. */
930 #undef ASM_OUTPUT_DESTRUCTOR
931 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
932 do { \
933 if (DEFAULT_ABI != ABI_SOLARIS) \
935 dtors_section (); \
936 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
937 assemble_name (FILE, NAME); \
939 else \
941 fini_section (); \
942 fputs ("\tbl ", FILE); \
943 assemble_name (FILE, NAME); \
945 fputs ("\n", FILE); \
946 } while (0)
948 /* But, to make this work, we have to output the stabs for the function
949 name *first*... */
951 #define DBX_FUNCTION_FIRST
953 /* This is the end of what might become sysv4dbx.h. */
955 #undef TARGET_VERSION
956 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
958 #undef CPP_PREDEFINES
959 #define CPP_PREDEFINES \
960 "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
962 /* Pass various options to the assembler */
963 #undef ASM_SPEC
964 #define ASM_SPEC "%(asm_cpu) \
965 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
966 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
967 %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
968 %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
969 %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
970 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
971 %{mcall-solaris: -mlittle -msolaris} \
972 %{mcall-linux: -mbig} }}}}"
974 #ifndef CC1_ENDIAN_BIG_SPEC
975 #define CC1_ENDIAN_BIG_SPEC ""
976 #endif
978 #ifndef CC1_ENDIAN_LITTLE_SPEC
979 #define CC1_ENDIAN_LITTLE_SPEC "\
980 %{!mstrict-align: %{!mno-strict-align: \
981 -mstrict-align \
983 #endif
985 #ifndef CC1_ENDIAN_DEFAULT_SPEC
986 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big_spec)"
987 #endif
989 #undef CC1_SPEC
990 /* Pass -G xxx to the compiler and set correct endian mode */
991 #define CC1_SPEC "%{G*} \
992 %{mlittle: %(cc1_endian_little)} %{!mlittle: %{mlittle-endian: %(cc1_endian_little)}} \
993 %{mbig: %(cc1_endian_big)} %{!mbig: %{mbig-endian: %(cc1_endian_big)}} \
994 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
995 %{mcall-nt: -mlittle %(cc1_endian_little) } \
996 %{mcall-aixdesc: -mbig %(cc1_endian_big) } \
997 %{mcall-solaris: -mlittle %(cc1_endian_little) } \
998 %{mcall-linux: -mbig %(cc1_endian_big) } \
999 %{!mcall-nt: %{!mcall-aixdesc: %{!mcall-solaris: %{!mcall-linux: \
1000 %(cc1_endian_default) \
1001 }}}} \
1002 }}}} \
1003 %{mcall-solaris: -mregnames } \
1004 %{mno-sdata: -msdata=none } \
1005 %{meabi: %{!mcall-*: -mcall-sysv }} \
1006 %{!meabi: %{!mno-eabi: \
1007 %{mrelocatable: -meabi } \
1008 %{mcall-solaris: -mno-eabi } \
1009 %{mcall-linux: -mno-eabi }}} \
1010 %{msdata: -msdata=default} \
1011 %{mno-sdata: -msdata=none} \
1012 %{profile: -p}"
1014 /* Don't put -Y P,<path> for cross compilers */
1015 #undef LINK_PATH_SPEC
1016 #ifndef CROSS_COMPILE
1017 #define LINK_PATH_SPEC "\
1018 %{!R*:%{L*:-R %*}} \
1019 %{!nostdlib: %{!YP,*: \
1020 %{compat-bsd: \
1021 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1022 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
1023 %{!R*: %{!L*: -R /usr/ucblib}} \
1024 %{!compat-bsd: \
1025 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1026 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
1028 #else
1029 #define LINK_PATH_SPEC ""
1030 #endif
1032 /* Default starting address if specified */
1033 #ifndef LINK_START_SPEC
1034 #define LINK_START_SPEC "\
1035 %{mads: %(link_start_ads) } \
1036 %{myellowknife: %(link_start_yellowknife) } \
1037 %{mmvme: %(link_start_mvme) } \
1038 %{msim: %(link_start_sim) } \
1039 %{mcall-linux: %(link_start_linux) } \
1040 %{mcall-solaris: %(link_start_solaris) } \
1041 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_start_default) }}}}}}"
1042 #endif
1044 #ifndef LINK_START_DEFAULT_SPEC
1045 #define LINK_START_DEFAULT_SPEC ""
1046 #endif
1048 #undef LINK_SPEC
1049 #define LINK_SPEC "\
1050 %{h*} %{v:-V} %{G*} \
1051 %{Wl,*:%*} %{YP,*} %{R*} \
1052 %{Qy:} %{!Qn:-Qy} \
1053 %(link_shlib) \
1054 %{!Ttext*: %(link_start) } \
1055 %(link_target) \
1056 %(link_os)"
1058 /* For now, turn off shared libraries by default. */
1059 #ifndef SHARED_LIB_SUPPORT
1060 #define NO_SHARED_LIB_SUPPORT
1061 #endif
1063 #undef LINK_SHLIB_SPEC
1064 #ifndef NO_SHARED_LIB_SUPPORT
1065 /* Shared libraries are default. */
1066 #define LINK_SHLIB_SPEC "\
1067 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
1068 %{mshlib: } \
1069 %{static:-dn -Bstatic} \
1070 %{shared:-G -dy -z text} \
1071 %{symbolic:-Bsymbolic -G -dy -z text}"
1073 #else
1074 /* Shared libraries are not default. */
1075 #define LINK_SHLIB_SPEC "\
1076 %{mshlib: %(link_path) } \
1077 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
1078 %{static: } \
1079 %{shared:-G -dy -z text %(link_path) } \
1080 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
1081 #endif
1083 /* Override the default target of the linker. */
1084 #undef LINK_TARGET_SPEC
1085 #define LINK_TARGET_SPEC "\
1086 %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
1087 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-solaris: -oformat elf32-powerpcle}}}}}"
1089 /* Any specific OS flags */
1090 #ifndef LINK_OS_SPEC
1091 #define LINK_OS_SPEC "\
1092 %{mads: %(link_os_ads) } \
1093 %{myellowknife: %(link_os_yellowknife) } \
1094 %{mmvme: %(link_os_mvme) } \
1095 %{msim: %(link_os_sim) } \
1096 %{mcall-linux: %(link_os_linux) } \
1097 %{mcall-solaris: %(link_os_solaris) } \
1098 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_os_default) }}}}}}"
1099 #endif
1101 #ifndef LINK_OS_DEFAULT_SPEC
1102 #define LINK_OS_DEFAULT_SPEC ""
1103 #endif
1105 #define CPP_SYSV_SPEC \
1106 "%{mrelocatable*: -D_RELOCATABLE} \
1107 %{fpic: -D__PIC__=1 -D__pic__=1} \
1108 %{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}} \
1109 %{mcall-sysv: -D_CALL_SYSV} %{mcall-nt: -D_CALL_NT} \
1110 %{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
1111 %{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %{!mcall-nt: %(cpp_sysv_default) }}}} \
1112 %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
1114 #define CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
1116 #define CPP_ENDIAN_BIG_SPEC "-D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)"
1118 #define CPP_ENDIAN_LITTLE_SPEC "-D_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -Amachine(littleendian)"
1120 #define CPP_ENDIAN_SOLARIS_SPEC "-D__LITTLE_ENDIAN__ -Amachine(littleendian)"
1122 /* For solaris, don't define _LITTLE_ENDIAN, it conflicts with a header file. */
1123 #define CPP_ENDIAN_SPEC \
1124 "%{mlittle: %(cpp_endian_little) } \
1125 %{mlittle-endian: %(cpp_endian_little) } \
1126 %{mbig: %(cpp_endian_big) } \
1127 %{mbig-endian: %(cpp_endian_big) } \
1128 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
1129 %{mcall-solaris: %(cpp_endian_solaris) } \
1130 %{mcall-nt: %(cpp_endian_little) } \
1131 %{mcall-linux: %(cpp_endian_big) } \
1132 %{mcall-aixdesc: %(cpp_endian_big) } \
1133 %{!mcall-solaris: %{!mcall-linux: %{!mcall-nt: %{!mcall-aixdesc: %(cpp_endian_default) }}}}}}}}"
1135 #define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
1137 #undef CPP_SPEC
1138 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
1139 %{mads: %(cpp_os_ads) } \
1140 %{myellowknife: %(cpp_os_yellowknife) } \
1141 %{mmvme: %(cpp_os_mvme) } \
1142 %{msim: %(cpp_os_sim) } \
1143 %{mcall-linux: %(cpp_os_linux) } \
1144 %{mcall-solaris: %(cpp_os_solaris) } \
1145 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}}}"
1147 #ifndef CPP_OS_DEFAULT_SPEC
1148 #define CPP_OS_DEFAULT_SPEC ""
1149 #endif
1151 #undef STARTFILE_SPEC
1152 #define STARTFILE_SPEC "\
1153 %{mads: %(startfile_ads) } \
1154 %{myellowknife: %(startfile_yellowknife) } \
1155 %{mmvme: %(startfile_mvme) } \
1156 %{msim: %(startfile_sim) } \
1157 %{mcall-linux: %(startfile_linux) } \
1158 %{mcall-solaris: %(startfile_solaris) } \
1159 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(startfile_default) }}}}}}"
1161 #undef STARTFILE_DEFAULT_SPEC
1162 #define STARTFILE_DEFAULT_SPEC ""
1164 #undef LIB_SPEC
1165 #define LIB_SPEC "\
1166 %{mads: %(lib_ads) } \
1167 %{myellowknife: %(lib_yellowknife) } \
1168 %{mmvme: %(lib_mvme) } \
1169 %{msim: %(lib_sim) } \
1170 %{mcall-linux: %(lib_linux) } \
1171 %{mcall-solaris: %(lib_solaris) } \
1172 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(lib_default) }}}}}}"
1174 #undef LIBGCC_SPEC
1175 #define LIBGCC_SPEC "libgcc.a%s"
1177 #ifndef LIB_DEFAULT_SPEC
1178 #define LIB_DEFAULT_SPEC ""
1179 #endif
1181 #undef ENDFILE_SPEC
1182 #define ENDFILE_SPEC "\
1183 %{mads: ecrtn.o%s} \
1184 %{myellowknife: ecrtn.o%s} \
1185 %{mmvme: ecrtn.o%s} \
1186 %{msim: ecrtn.o%s} \
1187 %{mcall-linux: %(endfile_linux) } \
1188 %{mcall-solaris: scrtn.o%s} \
1189 %{mvxworks: %(endfile_vxworks) } \
1190 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %{!mvxworks: %(endfile_default) }}}}}}}"
1192 #undef ENDFILE_DEFAULT_SPEC
1193 #define ENDFILE_DEFAULT_SPEC ""
1195 /* Motorola ADS support. */
1196 #ifndef LIB_ADS_SPEC
1197 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1198 #endif
1200 #ifndef STARTFILE_ADS_SPEC
1201 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s"
1202 #endif
1204 #ifndef ENDFILE_ADS_SPEC
1205 #define ENDFILE_ADS_SPEC "ecrtn.o%s"
1206 #endif
1208 #ifndef LINK_START_ADS_SPEC
1209 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1210 #endif
1212 #ifndef LINK_OS_ADS_SPEC
1213 #define LINK_OS_ADS_SPEC ""
1214 #endif
1216 #ifndef CPP_OS_ADS_SPEC
1217 #define CPP_OS_ADS_SPEC ""
1218 #endif
1220 /* Motorola Yellowknife support. */
1221 #ifndef LIB_YELLOWKNIFE_SPEC
1222 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1223 #endif
1225 #ifndef STARTFILE_YELLOWKNIFE_SPEC
1226 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s"
1227 #endif
1229 #ifndef ENDFILE_YELLOWKNIFE_SPEC
1230 #define ENDFILE_YELLOWKNIFE_SPEC "ecrtn.o%s"
1231 #endif
1233 #ifndef LINK_START_YELLOWKNIFE_SPEC
1234 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1235 #endif
1237 #ifndef LINK_OS_YELLOWKNIFE_SPEC
1238 #define LINK_OS_YELLOWKNIFE_SPEC ""
1239 #endif
1241 #ifndef CPP_OS_YELLOWKNIFE_SPEC
1242 #define CPP_OS_YELLOWKNIFE_SPEC ""
1243 #endif
1245 /* Motorola MVME support. */
1246 #ifndef LIB_MVME_SPEC
1247 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1248 #endif
1250 #ifndef STARTFILE_MVME_SPEC
1251 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s"
1252 #endif
1254 #ifndef ENDFILE_MVME_SPEC
1255 #define ENDFILE_MVME_SPEC "ecrtn.o%s"
1256 #endif
1258 #ifndef LINK_START_MVME_SPEC
1259 #define LINK_START_MVME_SPEC "%{!Wl,-T*: %{!T*: -Ttext 0x40000}}"
1260 #endif
1262 #ifndef LINK_OS_MVME_SPEC
1263 #define LINK_OS_MVME_SPEC ""
1264 #endif
1266 #ifndef CPP_OS_MVME_SPEC
1267 #define CPP_OS_MVME_SPEC ""
1268 #endif
1270 /* PowerPC simulator based on netbsd system calls support. */
1271 #ifndef LIB_SIM_SPEC
1272 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1273 #endif
1275 #ifndef STARTFILE_SIM_SPEC
1276 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s"
1277 #endif
1279 #ifndef ENDFILE_SIM_SPEC
1280 #define ENDFILE_SIM_SPEC "ecrtn.o%s"
1281 #endif
1283 #ifndef LINK_START_SIM_SPEC
1284 #define LINK_START_SIM_SPEC "-Ttext 0x10000074"
1285 #endif
1287 #ifndef LINK_OS_SIM_SPEC
1288 #define LINK_OS_SIM_SPEC ""
1289 #endif
1291 #ifndef CPP_OS_SIM_SPEC
1292 #define CPP_OS_SIM_SPEC ""
1293 #endif
1295 /* GNU/Linux support. */
1296 #ifndef LIB_LINUX_SPEC
1297 #ifdef USE_GNULIBC_1
1298 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1299 %{!mnewlib: -lc }"
1300 #else
1301 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1302 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1303 %{profile:-lc_p} %{!profile:-lc}}}"
1304 #endif
1305 #endif
1307 #ifndef STARTFILE_LINUX_SPEC
1308 #define STARTFILE_LINUX_SPEC "\
1309 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1310 %{mnewlib: ecrti.o%s} \
1311 %{!mnewlib: crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
1312 #endif
1314 #ifndef ENDFILE_LINUX_SPEC
1315 #define ENDFILE_LINUX_SPEC "\
1316 %{mnewlib: ecrtn.o%s} \
1317 %{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"
1318 #endif
1320 #ifndef LINK_START_LINUX_SPEC
1321 #define LINK_START_LINUX_SPEC "-Ttext 0x400074"
1322 #endif
1324 #ifndef LINK_OS_LINUX_SPEC
1325 #define LINK_OS_LINUX_SPEC ""
1326 #endif
1328 #ifndef CPP_OS_LINUX_SPEC
1329 #ifdef USE_GNULIBC_1
1330 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1331 %{!undef:%{!ansi:%{!std=*:-Dunix -Dlinux}%{std=gnu*:-Dunix -Dlinux}}} \
1332 -Asystem(unix) -Asystem(posix)"
1333 #else
1334 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1335 %{!undef:%{!ansi:%{!std=*:-Dunix -Dlinux}%{std=gnu*:-Dunix -Dlinux}}} \
1336 -Asystem(unix) -Asystem(posix) %{pthread:-D_REENTRANT}"
1337 #endif
1338 #endif
1340 /* Solaris support. */
1341 /* For Solaris, Gcc automatically adds in one of the files
1342 /usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
1343 /usr/ccs/lib/values-Xt.o for each final link step (depending upon the other
1344 gcc options selected, such as -traditional and -ansi). These files each
1345 contain one (initialized) copy of a special variable called `_lib_version'.
1346 Each one of these files has `_lib_version' initialized to a different (enum)
1347 value. The SVR4 library routines query the value of `_lib_version' at run
1348 to decide how they should behave. Specifically, they decide (based upon the
1349 value of `_lib_version') if they will act in a strictly ANSI conforming
1350 manner or not. */
1352 #ifndef LIB_SOLARIS_SPEC
1353 #define LIB_SOLARIS_SPEC "\
1354 %{mnewlib: --start-group -lsolaris -lc --end-group } \
1355 %{!mnewlib: \
1356 %{ansi:values-Xc.o%s} \
1357 %{!ansi: \
1358 %{traditional:values-Xt.o%s} \
1359 %{!traditional:values-Xa.o%s}} \
1360 %{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
1361 %{solaris-cclib: /opt/SUNWspro/SC4.0/lib/libabi.a} \
1362 %{!shared: %{!symbolic: -lc }}}"
1363 #endif
1365 #ifndef STARTFILE_SOLARIS_SPEC
1366 #define STARTFILE_SOLARIS_SPEC "\
1367 %{!msolaris-cclib: scrti.o%s scrt0.o%s} \
1368 %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crti.o%s /opt/SUNWspro/SC4.0/lib/crt1.o%s}"
1369 #endif
1371 #ifndef ENDFILE_SOLARIS_SPEC
1372 #define ENDFILE_SOLARIS_SPEC "\
1373 %{!msolaris-cclib: scrtn.o%s} \
1374 %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crtn.o%s}"
1375 #endif
1377 #ifndef LINK_START_SOLARIS_SPEC
1378 #ifdef CROSS_COMPILER
1379 #define LINK_START_SOLARIS_SPEC "-Ttext 0x2000074"
1380 #else
1381 #define LINK_START_SOLARIS_SPEC ""
1382 #endif
1383 #endif
1385 #ifndef LINK_OS_SOLARIS_SPEC
1386 #define LINK_OS_SOLARIS_SPEC ""
1387 #endif
1389 #ifndef CPP_OS_SOLARIS_SPEC
1390 #define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__ -D__SVR4__ \
1391 %{!undef:%{!ansi:%{!std=*:-Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__} \
1392 %{std=gnu*:-Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__}}} \
1393 -Amachine(prep)"
1394 #endif
1396 /* VxWorks support. */
1397 /* VxWorks does all the library stuff itself. */
1398 #ifndef LIB_VXWORKS_SPEC
1399 #define LIB_VXWORKS_SPEC ""
1400 #endif
1402 /* VxWorks provides the functionality of crt0.o and friends itself. */
1404 #ifndef STARTFILE_VXWORKS_SPEC
1405 #define STARTFILE_VXWORKS_SPEC ""
1406 #endif
1408 #ifndef ENDFILE_VXWORKS_SPEC
1409 #define ENDFILE_VXWORKS_SPEC ""
1410 #endif
1412 /* Because it uses ld -r, vxworks has no start/end files, nor starting
1413 address. */
1415 #ifndef LINK_START_VXWORKS_SPEC
1416 #define LINK_START_VXWORKS_SPEC ""
1417 #endif
1419 #ifndef LINK_OS_VXWORKS_SPEC
1420 #define LINK_OS_VXWORKS_SPEC "-r"
1421 #endif
1423 #ifndef CPP_OS_VXWORKS_SPEC
1424 #define CPP_OS_VXWORKS_SPEC "\
1425 -DCPU_FAMILY=PPC \
1426 %{!mcpu*: \
1427 %{mpowerpc*: -DCPU=PPC603} \
1428 %{!mno-powerpc: -DCPU=PPC603}} \
1429 %{mcpu=powerpc: -DCPU=PPC603} \
1430 %{mcpu=401: -DCPU=PPC403} \
1431 %{mcpu=403: -DCPU=PPC403} \
1432 %{mcpu=601: -DCPU=PPC601} \
1433 %{mcpu=602: -DCPU=PPC603} \
1434 %{mcpu=603: -DCPU=PPC603} \
1435 %{mcpu=603e: -DCPU=PPC603} \
1436 %{mcpu=ec603e: -DCPU=PPC603} \
1437 %{mcpu=604: -DCPU=PPC604} \
1438 %{mcpu=604e: -DCPU=PPC604} \
1439 %{mcpu=620: -DCPU=PPC604} \
1440 %{mcpu=740: -DCPU=PPC603} \
1441 %{mcpu=750: -DCPU=PPC603} \
1442 %{mcpu=801: -DCPU=PPC603} \
1443 %{mcpu=821: -DCPU=PPC603} \
1444 %{mcpu=823: -DCPU=PPC603} \
1445 %{mcpu=860: -DCPU=PPC603}"
1446 #endif
1448 /* Define any extra SPECS that the compiler needs to generate. */
1449 #undef SUBTARGET_EXTRA_SPECS
1450 #define SUBTARGET_EXTRA_SPECS \
1451 { "cpp_sysv", CPP_SYSV_SPEC }, \
1452 { "cpp_sysv_default", CPP_SYSV_DEFAULT_SPEC }, \
1453 { "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
1454 { "cpp_endian", CPP_ENDIAN_SPEC }, \
1455 { "lib_ads", LIB_ADS_SPEC }, \
1456 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1457 { "lib_mvme", LIB_MVME_SPEC }, \
1458 { "lib_sim", LIB_SIM_SPEC }, \
1459 { "lib_linux", LIB_LINUX_SPEC }, \
1460 { "lib_solaris", LIB_SOLARIS_SPEC }, \
1461 { "lib_vxworks", LIB_VXWORKS_SPEC }, \
1462 { "lib_default", LIB_DEFAULT_SPEC }, \
1463 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1464 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1465 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1466 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1467 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1468 { "startfile_solaris", STARTFILE_SOLARIS_SPEC }, \
1469 { "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \
1470 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1471 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1472 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1473 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1474 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1475 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1476 { "endfile_solaris", ENDFILE_SOLARIS_SPEC }, \
1477 { "endfile_vxworks", ENDFILE_VXWORKS_SPEC }, \
1478 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1479 { "link_path", LINK_PATH_SPEC }, \
1480 { "link_shlib", LINK_SHLIB_SPEC }, \
1481 { "link_target", LINK_TARGET_SPEC }, \
1482 { "link_start", LINK_START_SPEC }, \
1483 { "link_start_ads", LINK_START_ADS_SPEC }, \
1484 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1485 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1486 { "link_start_sim", LINK_START_SIM_SPEC }, \
1487 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1488 { "link_start_solaris", LINK_START_SOLARIS_SPEC }, \
1489 { "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \
1490 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1491 { "link_os", LINK_OS_SPEC }, \
1492 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1493 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1494 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1495 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1496 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1497 { "link_os_solaris", LINK_OS_SOLARIS_SPEC }, \
1498 { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \
1499 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1500 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1501 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1502 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1503 { "cpp_endian_big", CPP_ENDIAN_BIG_SPEC }, \
1504 { "cpp_endian_little", CPP_ENDIAN_LITTLE_SPEC }, \
1505 { "cpp_endian_solaris", CPP_ENDIAN_SOLARIS_SPEC }, \
1506 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1507 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1508 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1509 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1510 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1511 { "cpp_os_solaris", CPP_OS_SOLARIS_SPEC }, \
1512 { "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \
1513 { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
1515 /* Define this macro as a C expression for the initializer of an
1516 array of string to tell the driver program which options are
1517 defaults for this target and thus do not need to be handled
1518 specially when using `MULTILIB_OPTIONS'.
1520 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1521 the target makefile fragment or if none of the options listed in
1522 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1524 #undef MULTILIB_DEFAULTS
1525 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1527 /* Define this macro if the code for function profiling should come
1528 before the function prologue. Normally, the profiling code comes
1529 after. */
1530 #define PROFILE_BEFORE_PROLOGUE 1
1532 /* Function name to call to do profiling. */
1533 #define RS6000_MCOUNT "_mcount"
1535 /* r13 is used for the small data pointer under SVR4. */
1536 #define FIXED_R13 1