1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995, 1996 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 /* eABI local switches -- put here rather than eabi.h, so the switches
23 can be tested in macros. */
25 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
26 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
27 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative */
28 #define MASK_SDATA 0x08000000 /* use eabi .sdata/.sdata2/.sbss relocations */
29 #define MASK_LITTLE_ENDIAN 0x04000000 /* target is little endian */
30 #define MASK_CALLS_1 0x02000000 /* First ABI bit (AIX, AIXDESC) */
31 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args */
32 #define MASK_CALLS_2 0x00800000 /* Second ABI bit (NT) */
34 #define MASK_CALLS (MASK_CALLS_1 | MASK_CALLS_2)
35 #define MASK_CALLS_V4 0
36 #define MASK_CALLS_AIX MASK_CALLS_1
37 #define MASK_CALLS_NT MASK_CALLS_2
38 #define MASK_CALLS_AIXDESC MASK_CALLS
40 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
41 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
42 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
43 #define TARGET_SDATA (target_flags & MASK_SDATA)
44 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
45 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
46 #define TARGET_TOC ((target_flags & (MASK_64BIT \
48 | MASK_MINIMAL_TOC)) \
49 || DEFAULT_ABI == ABI_AIX \
50 || DEFAULT_ABI == ABI_NT)
52 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
53 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
54 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
55 #define TARGET_NO_TOC (! TARGET_TOC)
57 #define TARGET_AIX_CALLS (target_flags & MASK_CALLS_1) /* either -mcall-aix or -mcall-aixdesc */
58 #define TARGET_V4_CALLS ((target_flags & MASK_CALLS) == MASK_CALLS_V4)
59 #define TARGET_NT_CALLS ((target_flags & MASK_CALLS) == MASK_CALLS_NT)
60 #define TARGET_AIXDESC_CALLS ((target_flags & MASK_CALLS) == MASK_CALLS_AIXDESC)
62 /* Pseudo target to indicate whether the object format is ELF
63 (to get around not having conditional compilation in the md file) */
66 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
67 the same as -mminimal-toc. */
68 #undef SUBTARGET_SWITCHES
69 #define SUBTARGET_SWITCHES \
70 { "bit-align", -MASK_NO_BITFIELD_TYPE }, \
71 { "no-bit-align", MASK_NO_BITFIELD_TYPE }, \
72 { "strict-align", MASK_STRICT_ALIGN }, \
73 { "no-strict-align", -MASK_STRICT_ALIGN }, \
74 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
75 { "relocatable", -MASK_SDATA }, \
76 { "no-relocatable", -MASK_RELOCATABLE }, \
77 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
78 { "no-relocatable-lib", -MASK_RELOCATABLE }, \
79 { "sdata", MASK_SDATA }, \
80 { "no-sdata", -MASK_SDATA }, \
81 { "little-endian", MASK_LITTLE_ENDIAN }, \
82 { "little", MASK_LITTLE_ENDIAN }, \
83 { "big-endian", -MASK_LITTLE_ENDIAN }, \
84 { "big", -MASK_LITTLE_ENDIAN }, \
86 { "toc", MASK_MINIMAL_TOC }, \
87 { "full-toc", MASK_MINIMAL_TOC }, \
88 { "call-aix", MASK_CALLS_AIX }, \
89 { "call-aix", -MASK_CALLS_NT }, \
90 { "call-aixdesc", MASK_CALLS_AIXDESC }, \
91 { "call-aixdesc", -MASK_LITTLE_ENDIAN }, \
92 { "call-sysv", -MASK_CALLS }, \
93 { "call-nt", MASK_CALLS_NT | MASK_LITTLE_ENDIAN }, \
94 { "call-nt", -MASK_CALLS_AIX }, \
95 { "prototype", MASK_PROTOTYPE }, \
96 { "no-prototype", -MASK_PROTOTYPE }, \
97 { "no-traceback", 0 }, \
102 /* Max # of bytes for variables to automatically be put into the .sdata
103 or .sdata2 sections. */
104 extern int g_switch_value; /* value of the -G xx switch */
105 extern int g_switch_set; /* whether -G xx was passed. */
107 #ifndef SDATA_DEFAULT_SIZE
108 #define SDATA_DEFAULT_SIZE 8
111 /* Sometimes certain combinations of command options do not make sense
112 on a particular target machine. You can define a macro
113 `OVERRIDE_OPTIONS' to take account of this. This macro, if
114 defined, is executed once just after all the command options have
117 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
120 #define SUBTARGET_OVERRIDE_OPTIONS \
123 g_switch_value = SDATA_DEFAULT_SIZE; \
125 rs6000_current_abi = ((TARGET_AIXDESC_CALLS) ? ABI_AIX : \
126 (TARGET_NT_CALLS) ? ABI_NT : \
127 (TARGET_AIX_CALLS) ? ABI_AIX_NODESC : \
130 /* CYGNUS LOCAL -fcombine-statics vs. -msdata */ \
132 flag_combine_statics = 0; \
133 /* END CYGNUS LOCAL -fcombine-statics vs. -msdata */ \
135 if (TARGET_RELOCATABLE && TARGET_SDATA) \
137 target_flags &= ~MASK_SDATA; \
138 error ("-mrelocatable and -msdata are incompatible."); \
141 if (TARGET_SDATA && DEFAULT_ABI != ABI_V4) \
143 target_flags &= ~MASK_SDATA; \
144 error ("-msdata and -mcall-aix are incompatible."); \
147 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
149 target_flags |= MASK_MINIMAL_TOC; \
150 error ("-mrelocatable and -mno-minimal-toc are incompatible."); \
153 if (TARGET_RELOCATABLE && TARGET_AIXDESC_CALLS) \
155 target_flags &= ~MASK_RELOCATABLE; \
156 error ("-mrelocatable and -mcall-aixdesc are incompatible."); \
159 if (TARGET_RELOCATABLE && TARGET_NT_CALLS) \
161 target_flags &= ~MASK_MINIMAL_TOC; \
162 error ("-mrelocatable and -mcall-nt are incompatible."); \
165 if (TARGET_AIXDESC_CALLS && TARGET_LITTLE_ENDIAN) \
167 target_flags &= ~MASK_LITTLE_ENDIAN; \
168 error ("-mcall-aixdesc must be big endian"); \
171 if (TARGET_NT_CALLS && TARGET_BIG_ENDIAN) \
173 target_flags |= MASK_LITTLE_ENDIAN; \
174 error ("-mcall-nt must be little endian"); \
178 /* Default ABI to compile code for */
179 #define DEFAULT_ABI rs6000_current_abi
181 #include "rs6000/powerpc.h"
183 /* System V.4 uses register 13 as a pointer to the small data area,
184 so it is not available to the normal user. */
189 /* System V.4 passes the first 8 floating arguments in registers,
190 instead of the first 13 like AIX does. */
191 #undef FP_ARG_MAX_REG
192 #define FP_ARG_MAX_REG ((TARGET_AIX_CALLS) ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
194 /* Size of the V.4 varargs area if needed */
195 #undef RS6000_VARARGS_AREA
196 #define RS6000_VARARGS_AREA ((rs6000_sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
198 /* Override default big endianism */
199 #undef BYTES_BIG_ENDIAN
200 #undef WORDS_BIG_ENDIAN
201 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
202 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
204 /* Define this to set the endianness to use in libgcc2.c, which can
205 not depend on target_flags. */
206 #ifndef _LITTLE_ENDIAN
207 #define LIBGCC2_WORDS_BIG_ENDIAN 1
209 #define LIBGCC2_WORDS_BIG_ENDIAN 0
212 /* Size of the outgoing register save area */
213 #undef RS6000_REG_SAVE
214 #define RS6000_REG_SAVE (TARGET_AIX_CALLS ? (TARGET_64BIT ? 64 : 32) : 0)
216 /* Size of the fixed area on the stack. For AIX, use the standard 6 word
217 area, otherwise use 2 words to store back chain & LR. */
218 #undef RS6000_SAVE_AREA
219 #define RS6000_SAVE_AREA \
220 ((TARGET_AIX_CALLS ? 24 : 8) << (TARGET_64BIT ? 1 : 0))
222 /* Define cutoff for using external functions to save floating point.
223 Currently on V.4, always use inline stores */
224 #undef FP_SAVE_INLINE
225 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
227 /* Don't generate XCOFF debugging information. */
229 #undef XCOFF_DEBUGGING_INFO
231 /* Don't use the COFF object file format. */
233 #undef OBJECT_FORMAT_COFF
235 /* Don't bother to output .extern pseudo-ops. They are not needed by
238 #undef ASM_OUTPUT_EXTERNAL
240 /* Undefine some things which are defined by the generic svr4.h. */
243 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
244 #undef READONLY_DATA_SECTION
245 #undef SELECT_SECTION
246 #undef ASM_DECLARE_FUNCTION_NAME
247 #undef ASM_OUTPUT_CONSTRUCTOR
248 #undef ASM_OUTPUT_DESTRUCTOR
250 /* Use the regular svr4 definitions. */
254 /* Prefix and suffix to use to saving floating point */
255 #undef SAVE_FP_PREFIX
256 #undef SAVE_FP_SUFFIX
257 #define SAVE_FP_PREFIX "_savefpr_"
258 #define SAVE_FP_SUFFIX "_l"
260 /* Prefix and suffix to use to restoring floating point */
261 #undef RESTORE_FP_PREFIX
262 #undef RESTORE_FP_SUFFIX
263 #define RESTORE_FP_PREFIX "_restfpr_"
264 #define RESTORE_FP_SUFFIX "_l"
266 /* Type used for ptrdiff_t, as a string used in a declaration. */
268 #define PTRDIFF_TYPE "int"
270 /* Type used for wchar_t, as a string used in a declaration. */
272 #define WCHAR_TYPE "short unsigned int"
274 /* Width of wchar_t in bits. */
275 #undef WCHAR_TYPE_SIZE
276 #define WCHAR_TYPE_SIZE 16
278 /* Align stack to 16 byte boundaries */
279 #undef STACK_BOUNDARY
280 #define STACK_BOUNDARY 128
282 /* No data type wants to be aligned rounder than this. */
283 #undef BIGGEST_ALIGNMENT
284 #undef BIGGEST_FIELD_ALIGNMENT
285 #define BIGGEST_ALIGNMENT 128
287 /* Use ELF style section commands. */
289 #undef TEXT_SECTION_ASM_OP
290 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
292 #undef DATA_SECTION_ASM_OP
293 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
295 /* Besides the usual ELF sections, we need a toc section. */
296 #undef EXTRA_SECTIONS
297 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss
299 #undef EXTRA_SECTION_FUNCTIONS
300 #define EXTRA_SECTION_FUNCTIONS \
301 CONST_SECTION_FUNCTION \
302 CTORS_SECTION_FUNCTION \
303 DTORS_SECTION_FUNCTION \
304 TOC_SECTION_FUNCTION \
305 SDATA_SECTION_FUNCTION \
306 SDATA2_SECTION_FUNCTION \
307 SBSS_SECTION_FUNCTION
309 extern void toc_section (), sdata_section (), sdata2_section ();
310 extern void sbss_section ();
312 #define TOC_SECTION_FUNCTION \
316 static int toc_initialized = 0; \
318 if (in_section != in_toc) \
320 in_section = in_toc; \
321 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
322 && TARGET_MINIMAL_TOC \
323 && !TARGET_RELOCATABLE) \
325 if (! toc_initialized) \
327 toc_initialized = 1; \
328 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
329 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
330 fprintf (asm_out_file, "\t.tc "); \
331 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
332 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
333 fprintf (asm_out_file, "\n"); \
335 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
336 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
337 fprintf (asm_out_file, " = .+32768\n"); \
340 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
342 else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
343 && !TARGET_RELOCATABLE) \
344 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
347 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
348 if (! toc_initialized) \
350 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
351 fprintf (asm_out_file, " = .+32768\n"); \
352 toc_initialized = 1; \
358 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
359 #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".got1\",\"aw\""
361 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
362 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
363 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
365 #define SDATA_SECTION_FUNCTION \
369 if (in_section != in_sdata) \
371 in_section = in_sdata; \
372 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
376 #define SDATA2_SECTION_FUNCTION \
380 if (in_section != in_sdata2) \
382 in_section = in_sdata2; \
383 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
387 #define SBSS_SECTION_FUNCTION \
391 if (in_section != in_sbss) \
393 in_section = in_sbss; \
394 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
398 /* A C statement or statements to switch to the appropriate section
399 for output of RTX in mode MODE. You can assume that RTX is some
400 kind of constant in RTL. The argument MODE is redundant except in
401 the case of a `const_int' rtx. Select the section by calling
402 `text_section' or one of the alternatives for other sections.
404 Do not define this macro if you put all constants in the read-only
407 extern void rs6000_select_rtx_section (), rs6000_select_section ();
409 #undef SELECT_RTX_SECTION
410 #define SELECT_RTX_SECTION(MODE, X) rs6000_select_rtx_section (MODE, X)
412 /* A C statement or statements to switch to the appropriate
413 section for output of DECL. DECL is either a `VAR_DECL' node
414 or a constant of some sort. RELOC indicates whether forming
415 the initial value of DECL requires link-time relocations. */
417 #undef SELECT_SECTION
418 #define SELECT_SECTION(DECL,RELOC) rs6000_select_section (DECL, RELOC)
420 /* Return non-zero if this entry is to be written into the constant pool
421 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
422 containing one of them. If -mfp-in-toc (the default), we also do
423 this for floating-point constants. We actually can only do this
424 if the FP formats of the target and host machines are the same, but
425 we can't check that since not every file that uses
426 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
428 Unlike AIX, we don't key off of -mmininal-toc, but instead do not
429 allow floating point constants in the TOC if -mrelocatable. */
431 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
432 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
434 && (GET_CODE (X) == SYMBOL_REF \
435 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
436 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
437 || GET_CODE (X) == LABEL_REF \
438 || (!TARGET_NO_FP_IN_TOC \
439 && !TARGET_RELOCATABLE \
440 && GET_CODE (X) == CONST_DOUBLE \
441 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
442 && BITS_PER_WORD == HOST_BITS_PER_INT)))
444 /* These macros generate the special .type and .size directives which
445 are used to set the corresponding fields of the linker symbol table
446 entries in an ELF object file under SVR4. These macros also output
447 the starting labels for the relevant functions/objects. */
449 /* Write the extra assembler code needed to declare a function properly.
450 Some svr4 assemblers need to also have something extra said about the
451 function's return value. We allow for that here. */
453 extern int rs6000_pic_labelno;
455 #undef ASM_DECLARE_FUNCTION_NAME
456 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
459 char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
460 STRIP_NAME_ENCODING (orig_name, NAME); \
462 if (TARGET_RELOCATABLE && get_pool_size () != 0) \
464 char buf[256], *buf_ptr; \
466 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
468 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
469 STRIP_NAME_ENCODING (buf_ptr, buf); \
470 fprintf (FILE, "\t%s %s-", init_ptr, buf_ptr); \
472 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
473 fprintf (FILE, "%s\n", buf_ptr); \
476 fprintf (FILE, "\t%s\t %s,", TYPE_ASM_OP, orig_name); \
477 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
479 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
481 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
483 char *desc_name = orig_name; \
485 while (*desc_name == '.') \
488 if (TREE_PUBLIC (DECL)) \
489 fprintf (FILE, "\t.globl %s\n", desc_name); \
491 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
492 fprintf (FILE, "%s:\n", desc_name); \
493 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
494 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
495 if (DEFAULT_ABI == ABI_AIX) \
496 fprintf (FILE, "\t%s 0\n", init_ptr); \
497 fprintf (FILE, "\t.previous\n"); \
499 fprintf (FILE, "%s:\n", orig_name); \
502 /* How to renumber registers for dbx and gdb. */
504 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
506 /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
508 #undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX
509 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
510 fprintf (FILE, ".%s", PREFIX)
512 /* This says how to output assembler code to declare an
513 uninitialized internal linkage data object. Under SVR4,
514 the linker seems to want the alignment of data objects
515 to depend on their types. We do exactly that here. */
518 #define LOCAL_ASM_OP ".local"
521 #undef ASM_OUTPUT_ALIGNED_LOCAL
522 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
524 if (TARGET_SDATA && (SIZE) > 0 && (SIZE) <= g_switch_value) \
527 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
528 ASM_OUTPUT_LABEL (FILE, NAME); \
529 ASM_OUTPUT_SKIP (FILE, SIZE); \
533 fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
534 assemble_name ((FILE), (NAME)); \
535 fprintf ((FILE), "\n"); \
536 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
540 /* Pass various options to the assembler */
542 #define ASM_SPEC "-u %(asm_cpu) \
543 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
544 %{mrelocatable} %{mrelocatable-lib} %{memb} %{msdata: -memb} \
545 %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
548 /* Pass -G xxx to the compiler */
549 #define CC1_SPEC "%{G*}"
551 /* Switch Recognition by gcc.c. Add -G xx support */
553 #undef SWITCH_TAKES_ARG
554 #define SWITCH_TAKES_ARG(CHAR) \
555 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
556 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
557 || (CHAR) == 'I' || (CHAR) == 'm' \
558 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'G')
560 /* Output .file and comments listing what options there are */
561 #undef ASM_FILE_START
562 #define ASM_FILE_START(FILE) \
564 ASM_OUTPUT_OPTIONS (FILE); \
565 output_file_directive ((FILE), main_input_filename); \
569 /* This is how to output an assembler line defining an `int' constant.
570 For -mrelocatable, we mark all addresses that need to be fixed up
571 in the .fixup section. */
572 #undef ASM_OUTPUT_INT
573 #define ASM_OUTPUT_INT(FILE,VALUE) \
575 static int recurse = 0; \
576 if (TARGET_RELOCATABLE \
577 && in_section != in_toc \
578 && in_section != in_text \
579 && in_section != in_ctors \
580 && in_section != in_dtors \
582 && GET_CODE (VALUE) != CONST_INT \
583 && GET_CODE (VALUE) != CONST_DOUBLE \
584 && CONSTANT_P (VALUE)) \
586 static int labelno = 0; \
590 ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", labelno++); \
591 STRIP_NAME_ENCODING (p, buf); \
592 fprintf (FILE, "%s:\n", p); \
593 fprintf (FILE, "\t.long ("); \
594 output_addr_const (FILE, (VALUE)); \
595 fprintf (FILE, ")@fixup\n"); \
596 fprintf (FILE, "\t.section\t\".fixup\",\"aw\"\n"); \
597 ASM_OUTPUT_ALIGN (FILE, 2); \
598 fprintf (FILE, "\t.long\t%s\n", p); \
599 fprintf (FILE, "\t.previous\n"); \
602 /* Remove initial .'s to turn a -mcall-aixdesc or -mcall-nt function \
603 address into the address of the descriptor, not the function \
605 else if (GET_CODE (VALUE) == SYMBOL_REF \
606 && XSTR (VALUE, 0)[0] == '.' \
607 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)) \
609 char *name = XSTR (VALUE, 0); \
610 while (*name == '.') \
613 fprintf (FILE, "\t.long %s\n", name); \
617 fprintf (FILE, "\t.long "); \
618 output_addr_const (FILE, (VALUE)); \
619 fprintf (FILE, "\n"); \
623 /* This is the end of what might become sysv4.h. */
625 /* Allow stabs and dwarf, prefer dwarf. */
626 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
627 #define DBX_DEBUGGING_INFO
628 #define DWARF_DEBUGGING_INFO
630 /* If we are referencing a function that is static or is known to be
631 in this file, make the SYMBOL_REF special. We can use this to indicate
632 that we can branch to this function without emitting a no-op after the
633 call. For real AIX and NT calling sequences, we also replace the
634 function name with the real name (1 or 2 leading .'s), rather than
635 the function descriptor name. This saves a lot of overriding code
636 to readd the prefixes. */
638 #undef ENCODE_SECTION_INFO
639 #define ENCODE_SECTION_INFO(DECL) \
641 if (TREE_CODE (DECL) == FUNCTION_DECL) \
643 rtx sym_ref = XEXP (DECL_RTL (DECL), 0); \
644 if (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL)) \
645 SYMBOL_REF_FLAG (sym_ref) = 1; \
647 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
649 char *prefix = (DEFAULT_ABI == ABI_AIX) ? "." : ".."; \
650 char *str = permalloc (strlen (prefix) + 1 \
651 + strlen (XSTR (sym_ref, 0))); \
652 strcpy (str, prefix); \
653 strcat (str, XSTR (sym_ref, 0)); \
654 XSTR (sym_ref, 0) = str; \
657 else if (TARGET_SDATA && DEFAULT_ABI == ABI_V4 \
658 && TREE_CODE (DECL) == VAR_DECL) \
660 int size = int_size_in_bytes (TREE_TYPE (DECL)); \
661 tree section_name = DECL_SECTION_NAME (DECL); \
662 char *name = ((section_name) \
663 ? IDENTIFIER_POINTER (section_name) \
666 if ((size > 0 && size <= 8) \
668 && (strcmp (name, ".sdata") == 0 \
669 || strcmp (name, ".sdata2") == 0 \
670 || strcmp (name, ".sbss") == 0 \
671 || strcmp (name, ".sbss2") == 0 \
672 || strcmp (name, ".PPC.EMB.sdata0") == 0 \
673 || strcmp (name, ".PPC.EMB.sbss0") == 0))) \
675 rtx sym_ref = XEXP (DECL_RTL (DECL), 0); \
676 char *str = permalloc (2 + strlen (XSTR (sym_ref, 0))); \
678 strcat (str, XSTR (sym_ref, 0)); \
679 XSTR (sym_ref, 0) = str; \
684 /* This macro gets just the user-specified name
685 out of the string in a SYMBOL_REF. Discard
687 #undef STRIP_NAME_ENCODING
688 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
690 char *_name = SYMBOL_NAME; \
691 while (*_name == '*' || *_name == '@') \
696 /* This is how to output a reference to a user-level label named NAME.
697 `assemble_name' uses this. */
699 #undef ASM_OUTPUT_LABELREF
700 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
702 char *_name = NAME; \
703 while (*_name == '*' || *_name == '@') \
705 fputs (_name, FILE); \
708 /* But, to make this work, we have to output the stabs for the function
711 #define DBX_FUNCTION_FIRST
713 /* This is the end of what might become sysv4dbx.h. */
715 #undef TARGET_VERSION
716 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
718 #undef CPP_PREDEFINES
719 #define CPP_PREDEFINES \
720 "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
722 /* Don't put -Y P,<path> for cross compilers */
723 #undef LINK_PATH_SPEC
724 #ifndef CROSS_COMPILE
725 #define LINK_PATH_SPEC "\
726 %{!nostdlib: %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
727 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}"
730 #define LINK_PATH_SPEC ""
735 %{h*} %{V} %{v:%{!V:-V}} %{G*} \
737 %{static:-dn -Bstatic} \
738 %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
739 %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
742 %(link_path) %(link_start) \
744 %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
745 %{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc }"
748 #define CPP_SYSV_SPEC \
749 "%{mrelocatable: -D_RELOCATABLE} \
750 %{mcall-sysv: -D_CALL_SYSV} %{mcall-nt: -D_CALL_NT} \
751 %{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
752 %{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %{!mcall-nt: %(cpp_sysv_default) }}}} \
753 %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
755 #undef CPP_SYSV_DEFAULT_SPEC
756 #define CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
758 #undef CPP_ENDIAN_SPEC
759 #define CPP_ENDIAN_SPEC \
760 "%{mlittle: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
761 %{mlittle-endian: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
762 %{!mlittle: %{!mlittle-endian: -D_BIG_ENDIAN -Amachine(bigendian)}}"
765 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu)"
767 /* Define this macro as a C expression for the initializer of an
768 array of string to tell the driver program which options are
769 defaults for this target and thus do not need to be handled
770 specially when using `MULTILIB_OPTIONS'.
772 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
773 the target makefile fragment or if none of the options listed in
774 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
776 #undef MULTILIB_DEFAULTS
777 #define MULTILIB_DEFAULTS { "mbig", "mbig-endian", "mcall-sysv", "mno-sdata" }