* arm.md (compare_scc): Use shorter sequence for EQ case.
[official-gcc.git] / gcc / config / rs6000 / sysv4.h
blobd6b0f31088d23b612cfcff08a2b88cc4e09a73c6
1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published
10 by the Free Software Foundation; either version 2, or (at your
11 option) any later version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the
20 Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA. */
23 /* Header files should be C++ aware in general. */
24 #define NO_IMPLICIT_EXTERN_C
26 /* Yes! We are ELF. */
27 #define TARGET_OBJECT_FORMAT OBJECT_ELF
29 /* Default ABI to compile code for. */
30 #define DEFAULT_ABI rs6000_current_abi
32 /* Default ABI to use. */
33 #define RS6000_ABI_NAME "sysv"
35 /* Override rs6000.h definition. */
36 #undef ASM_DEFAULT_SPEC
37 #define ASM_DEFAULT_SPEC "-mppc"
39 /* Small data support types. */
40 enum rs6000_sdata_type {
41 SDATA_NONE, /* No small data support. */
42 SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */
43 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */
44 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */
47 extern enum rs6000_sdata_type rs6000_sdata;
49 /* V.4/eabi switches. */
50 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */
51 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
52 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */
53 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */
54 #define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */
55 #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
56 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
57 #define MASK_NO_BITFIELD_WORD 0x00800000 /* Bitfields cannot cross word boundaries */
59 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
60 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
61 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
62 #define TARGET_EABI (target_flags & MASK_EABI)
63 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
64 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
65 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
66 #define TARGET_NO_BITFIELD_WORD (target_flags & MASK_NO_BITFIELD_WORD)
67 #define TARGET_TOC ((target_flags & MASK_64BIT) \
68 || ((target_flags & (MASK_RELOCATABLE \
69 | MASK_MINIMAL_TOC)) \
70 && flag_pic > 1) \
71 || DEFAULT_ABI == ABI_AIX)
73 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
74 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
75 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
76 #define TARGET_NO_TOC (! TARGET_TOC)
77 #define TARGET_NO_EABI (! TARGET_EABI)
79 /* Strings provided by SUBTARGET_OPTIONS */
80 extern const char *rs6000_abi_name;
81 extern const char *rs6000_sdata_name;
82 extern const char *rs6000_tls_size_string; /* For -mtls-size= */
84 /* Override rs6000.h definition. */
85 #undef SUBTARGET_OPTIONS
86 #define SUBTARGET_OPTIONS \
87 { "call-", &rs6000_abi_name, N_("Select ABI calling convention"), 0}, \
88 { "sdata=", &rs6000_sdata_name, N_("Select method for sdata handling"), 0}, \
89 { "tls-size=", &rs6000_tls_size_string, \
90 N_("Specify bit size of immediate TLS offsets"), 0 }
92 /* Max # of bytes for variables to automatically be put into the .sdata
93 or .sdata2 sections. */
94 extern int g_switch_value; /* Value of the -G xx switch. */
95 extern int g_switch_set; /* Whether -G xx was passed. */
97 #define SDATA_DEFAULT_SIZE 8
99 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
100 the same as -mminimal-toc. */
101 /* Override rs6000.h definition. */
102 #undef SUBTARGET_SWITCHES
103 #define SUBTARGET_SWITCHES \
104 { "bit-align", -MASK_NO_BITFIELD_TYPE, \
105 N_("Align to the base type of the bit-field") }, \
106 { "no-bit-align", MASK_NO_BITFIELD_TYPE, \
107 N_("Don't align to the base type of the bit-field") }, \
108 { "strict-align", MASK_STRICT_ALIGN, \
109 N_("Don't assume that unaligned accesses are handled by the system") }, \
110 { "no-strict-align", -MASK_STRICT_ALIGN, \
111 N_("Assume that unaligned accesses are handled by the system") }, \
112 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
113 N_("Produce code relocatable at runtime") }, \
114 { "no-relocatable", -MASK_RELOCATABLE, \
115 N_("Don't produce code relocatable at runtime") }, \
116 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
117 N_("Produce code relocatable at runtime") }, \
118 { "no-relocatable-lib", -MASK_RELOCATABLE, \
119 N_("Don't produce code relocatable at runtime") }, \
120 { "little-endian", MASK_LITTLE_ENDIAN, \
121 N_("Produce little endian code") }, \
122 { "little", MASK_LITTLE_ENDIAN, \
123 N_("Produce little endian code") }, \
124 { "big-endian", -MASK_LITTLE_ENDIAN, \
125 N_("Produce big endian code") }, \
126 { "big", -MASK_LITTLE_ENDIAN, \
127 N_("Produce big endian code") }, \
128 { "no-toc", 0, N_("no description yet") }, \
129 { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
130 { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
131 { "prototype", MASK_PROTOTYPE, N_("no description yet") }, \
132 { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \
133 { "no-traceback", 0, N_("no description yet") }, \
134 { "eabi", MASK_EABI, N_("Use EABI") }, \
135 { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \
136 { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \
137 { "no-bit-word", MASK_NO_BITFIELD_WORD, \
138 N_("Do not allow bit-fields to cross word boundaries") }, \
139 { "regnames", MASK_REGNAMES, \
140 N_("Use alternate register names") }, \
141 { "no-regnames", -MASK_REGNAMES, \
142 N_("Don't use alternate register names") }, \
143 { "sdata", 0, N_("no description yet") }, \
144 { "no-sdata", 0, N_("no description yet") }, \
145 { "sim", 0, \
146 N_("Link with libsim.a, libc.a and sim-crt0.o") }, \
147 { "ads", 0, \
148 N_("Link with libads.a, libc.a and crt0.o") }, \
149 { "yellowknife", 0, \
150 N_("Link with libyk.a, libc.a and crt0.o") }, \
151 { "mvme", 0, \
152 N_("Link with libmvme.a, libc.a and crt0.o") }, \
153 { "emb", 0, \
154 N_("Set the PPC_EMB bit in the ELF flags header") }, \
155 { "windiss", 0, N_("Use the WindISS simulator") }, \
156 { "shlib", 0, N_("no description yet") }, \
157 EXTRA_SUBTARGET_SWITCHES \
158 { "newlib", 0, N_("no description yet") },
160 /* This is meant to be redefined in the host dependent files. */
161 #define EXTRA_SUBTARGET_SWITCHES
163 /* Sometimes certain combinations of command options do not make sense
164 on a particular target machine. You can define a macro
165 `OVERRIDE_OPTIONS' to take account of this. This macro, if
166 defined, is executed once just after all the command options have
167 been parsed.
169 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
170 get control. */
172 #define SUBTARGET_OVERRIDE_OPTIONS \
173 do { \
174 if (!g_switch_set) \
175 g_switch_value = SDATA_DEFAULT_SIZE; \
177 if (!strcmp (rs6000_abi_name, "sysv")) \
178 rs6000_current_abi = ABI_V4; \
179 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
181 rs6000_current_abi = ABI_V4; \
182 target_flags &= ~ MASK_EABI; \
184 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
185 || !strcmp (rs6000_abi_name, "eabi")) \
187 rs6000_current_abi = ABI_V4; \
188 target_flags |= MASK_EABI; \
190 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
191 rs6000_current_abi = ABI_AIX; \
192 else if (!strcmp (rs6000_abi_name, "freebsd")) \
193 rs6000_current_abi = ABI_V4; \
194 else if (!strcmp (rs6000_abi_name, "linux")) \
195 rs6000_current_abi = ABI_V4; \
196 else if (!strcmp (rs6000_abi_name, "gnu")) \
197 rs6000_current_abi = ABI_V4; \
198 else if (!strcmp (rs6000_abi_name, "netbsd")) \
199 rs6000_current_abi = ABI_V4; \
200 else if (!strcmp (rs6000_abi_name, "i960-old")) \
202 rs6000_current_abi = ABI_V4; \
203 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \
204 | MASK_NO_BITFIELD_WORD); \
205 target_flags &= ~MASK_STRICT_ALIGN; \
207 else \
209 rs6000_current_abi = ABI_V4; \
210 error ("bad value for -mcall-%s", rs6000_abi_name); \
213 if (rs6000_sdata_name) \
215 if (!strcmp (rs6000_sdata_name, "none")) \
216 rs6000_sdata = SDATA_NONE; \
217 else if (!strcmp (rs6000_sdata_name, "data")) \
218 rs6000_sdata = SDATA_DATA; \
219 else if (!strcmp (rs6000_sdata_name, "default")) \
220 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
221 else if (!strcmp (rs6000_sdata_name, "sysv")) \
222 rs6000_sdata = SDATA_SYSV; \
223 else if (!strcmp (rs6000_sdata_name, "eabi")) \
224 rs6000_sdata = SDATA_EABI; \
225 else \
226 error ("bad value for -msdata=%s", rs6000_sdata_name); \
228 else if (DEFAULT_ABI == ABI_V4) \
230 rs6000_sdata = SDATA_DATA; \
231 rs6000_sdata_name = "data"; \
233 else \
235 rs6000_sdata = SDATA_NONE; \
236 rs6000_sdata_name = "none"; \
239 if (TARGET_RELOCATABLE && \
240 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
242 rs6000_sdata = SDATA_DATA; \
243 error ("-mrelocatable and -msdata=%s are incompatible", \
244 rs6000_sdata_name); \
247 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
248 && (rs6000_sdata == SDATA_EABI \
249 || rs6000_sdata == SDATA_SYSV)) \
251 rs6000_sdata = SDATA_DATA; \
252 error ("-f%s and -msdata=%s are incompatible", \
253 (flag_pic > 1) ? "PIC" : "pic", \
254 rs6000_sdata_name); \
257 if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
259 rs6000_sdata = SDATA_NONE; \
260 error ("-msdata=%s and -mcall-%s are incompatible", \
261 rs6000_sdata_name, rs6000_abi_name); \
264 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
266 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
268 target_flags |= MASK_MINIMAL_TOC; \
269 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
272 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
274 target_flags &= ~MASK_RELOCATABLE; \
275 error ("-mrelocatable and -mcall-%s are incompatible", \
276 rs6000_abi_name); \
279 if (flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
281 flag_pic = 0; \
282 error ("-fPIC and -mcall-%s are incompatible", \
283 rs6000_abi_name); \
286 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
288 target_flags &= ~MASK_LITTLE_ENDIAN; \
289 error ("-mcall-aixdesc must be big endian"); \
292 /* Treat -fPIC the same as -mrelocatable. */ \
293 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
294 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
296 else if (TARGET_RELOCATABLE) \
297 flag_pic = 2; \
299 } while (0)
302 /* Override rs6000.h definition. */
303 #undef TARGET_DEFAULT
304 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
306 /* Override rs6000.h definition. */
307 #undef PROCESSOR_DEFAULT
308 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
310 #define FIXED_R2 1
311 /* System V.4 uses register 13 as a pointer to the small data area,
312 so it is not available to the normal user. */
313 #define FIXED_R13 1
315 /* Size of the V.4 varargs area if needed. */
316 /* Override rs6000.h definition. */
317 #undef RS6000_VARARGS_AREA
318 #define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
320 /* Override default big endianism definitions in rs6000.h. */
321 #undef BYTES_BIG_ENDIAN
322 #undef WORDS_BIG_ENDIAN
323 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
324 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
326 /* Define this to set the endianness to use in libgcc2.c, which can
327 not depend on target_flags. */
328 #if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
329 #define LIBGCC2_WORDS_BIG_ENDIAN 1
330 #else
331 #define LIBGCC2_WORDS_BIG_ENDIAN 0
332 #endif
334 /* Define cutoff for using external functions to save floating point.
335 Currently on V.4, always use inline stores. */
336 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
338 /* Put jump tables in read-only memory, rather than in .text. */
339 #define JUMP_TABLES_IN_TEXT_SECTION 0
341 /* Prefix and suffix to use to saving floating point. */
342 #define SAVE_FP_PREFIX "_savefpr_"
343 #define SAVE_FP_SUFFIX "_l"
345 /* Prefix and suffix to use to restoring floating point. */
346 #define RESTORE_FP_PREFIX "_restfpr_"
347 #define RESTORE_FP_SUFFIX "_l"
349 /* Type used for ptrdiff_t, as a string used in a declaration. */
350 #define PTRDIFF_TYPE "int"
352 /* Type used for wchar_t, as a string used in a declaration. */
353 /* Override svr4.h definition. */
354 #undef WCHAR_TYPE
355 #define WCHAR_TYPE "long int"
357 /* Width of wchar_t in bits. */
358 /* Override svr4.h definition. */
359 #undef WCHAR_TYPE_SIZE
360 #define WCHAR_TYPE_SIZE 32
362 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
363 /* Override elfos.h definition. */
364 #undef PCC_BITFIELD_TYPE_MATTERS
365 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
367 #undef BITFIELD_NBYTES_LIMITED
368 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
370 /* Define this macro to be the value 1 if instructions will fail to
371 work if given data not on the nominal alignment. If instructions
372 will merely go slower in that case, define this macro as 0. */
373 #undef STRICT_ALIGNMENT
374 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
376 /* Alignment in bits of the stack boundary. Note, in order to allow building
377 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
378 versions, just use 64 as the stack boundary. */
379 #undef STACK_BOUNDARY
380 #define STACK_BOUNDARY (TARGET_ALTIVEC_ABI ? 128 : 64)
382 /* Real stack boundary as mandated by the appropriate ABI. */
383 #define ABI_STACK_BOUNDARY ((TARGET_EABI && !TARGET_ALTIVEC_ABI) ? 64 : 128)
385 /* An expression for the alignment of a structure field FIELD if the
386 alignment computed in the usual way is COMPUTED. */
387 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
388 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
389 ? 128 : COMPUTED)
391 /* Define this macro as an expression for the alignment of a type
392 (given by TYPE as a tree node) if the alignment computed in the
393 usual way is COMPUTED and the alignment explicitly specified was
394 SPECIFIED. */
395 #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
396 ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) \
397 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \
398 : MAX (COMPUTED, SPECIFIED))
400 #undef BIGGEST_FIELD_ALIGNMENT
402 /* Use ELF style section commands. */
404 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
406 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
408 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
410 /* Override elfos.h definition. */
411 #undef INIT_SECTION_ASM_OP
412 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
414 /* Override elfos.h definition. */
415 #undef FINI_SECTION_ASM_OP
416 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
418 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
420 /* Put PC relative got entries in .got2. */
421 #define MINIMAL_TOC_SECTION_ASM_OP \
422 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
423 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
425 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
426 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
427 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
429 /* Besides the usual ELF sections, we need a toc section. */
430 /* Override elfos.h definition. */
431 #undef EXTRA_SECTIONS
432 #define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
434 /* Override elfos.h definition. */
435 #undef EXTRA_SECTION_FUNCTIONS
436 #define EXTRA_SECTION_FUNCTIONS \
437 TOC_SECTION_FUNCTION \
438 SDATA_SECTION_FUNCTION \
439 SDATA2_SECTION_FUNCTION \
440 SBSS_SECTION_FUNCTION \
441 INIT_SECTION_FUNCTION \
442 FINI_SECTION_FUNCTION
444 #define TOC_SECTION_FUNCTION \
445 void \
446 toc_section () \
448 if (in_section != in_toc) \
450 in_section = in_toc; \
451 if (DEFAULT_ABI == ABI_AIX \
452 && TARGET_MINIMAL_TOC \
453 && !TARGET_RELOCATABLE) \
455 if (! toc_initialized) \
457 toc_initialized = 1; \
458 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
459 (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \
460 fprintf (asm_out_file, "\t.tc "); \
461 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
462 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
463 fprintf (asm_out_file, "\n"); \
465 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
466 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
467 fprintf (asm_out_file, " = .+32768\n"); \
469 else \
470 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
472 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
473 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
474 else \
476 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
477 if (! toc_initialized) \
479 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
480 fprintf (asm_out_file, " = .+32768\n"); \
481 toc_initialized = 1; \
487 extern int in_toc_section PARAMS ((void)); \
488 int in_toc_section () \
490 return in_section == in_toc; \
493 #define SDATA_SECTION_FUNCTION \
494 void \
495 sdata_section () \
497 if (in_section != in_sdata) \
499 in_section = in_sdata; \
500 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
504 #define SDATA2_SECTION_FUNCTION \
505 void \
506 sdata2_section () \
508 if (in_section != in_sdata2) \
510 in_section = in_sdata2; \
511 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
515 #define SBSS_SECTION_FUNCTION \
516 void \
517 sbss_section () \
519 if (in_section != in_sbss) \
521 in_section = in_sbss; \
522 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
526 #define INIT_SECTION_FUNCTION \
527 void \
528 init_section () \
530 if (in_section != in_init) \
532 in_section = in_init; \
533 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
537 #define FINI_SECTION_FUNCTION \
538 void \
539 fini_section () \
541 if (in_section != in_fini) \
543 in_section = in_fini; \
544 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
548 /* Override default elf definitions. */
549 #undef TARGET_ASM_SELECT_RTX_SECTION
550 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
551 #undef TARGET_ASM_SELECT_SECTION
552 #define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section
553 #define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section
555 /* Return nonzero if this entry is to be written into the constant pool
556 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
557 containing one of them. If -mfp-in-toc (the default), we also do
558 this for floating-point constants. We actually can only do this
559 if the FP formats of the target and host machines are the same, but
560 we can't check that since not every file that uses
561 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
563 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
564 allow floating point constants in the TOC if -mrelocatable. */
566 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
567 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
568 (TARGET_TOC \
569 && (GET_CODE (X) == SYMBOL_REF \
570 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
571 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
572 || GET_CODE (X) == LABEL_REF \
573 || (GET_CODE (X) == CONST_INT \
574 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
575 || (!TARGET_NO_FP_IN_TOC \
576 && !TARGET_RELOCATABLE \
577 && GET_CODE (X) == CONST_DOUBLE \
578 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
579 && BITS_PER_WORD == HOST_BITS_PER_INT)))
581 /* These macros generate the special .type and .size directives which
582 are used to set the corresponding fields of the linker symbol table
583 entries in an ELF object file under SVR4. These macros also output
584 the starting labels for the relevant functions/objects. */
586 /* Write the extra assembler code needed to declare a function properly.
587 Some svr4 assemblers need to also have something extra said about the
588 function's return value. We allow for that here. */
590 extern int rs6000_pic_labelno;
592 /* Override elfos.h definition. */
593 #undef ASM_DECLARE_FUNCTION_NAME
594 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
595 do { \
596 const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
598 if (TARGET_RELOCATABLE \
599 && (get_pool_size () != 0 || current_function_profile) \
600 && uses_TOC()) \
602 char buf[256]; \
604 (*targetm.asm_out.internal_label) (FILE, "LCL", rs6000_pic_labelno); \
606 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
607 fprintf (FILE, "\t%s ", init_ptr); \
608 assemble_name (FILE, buf); \
609 putc ('-', FILE); \
610 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
611 assemble_name (FILE, buf); \
612 putc ('\n', FILE); \
615 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
616 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
618 if (DEFAULT_ABI == ABI_AIX) \
620 const char *desc_name, *orig_name; \
622 orig_name = (*targetm.strip_name_encoding) (NAME); \
623 desc_name = orig_name; \
624 while (*desc_name == '.') \
625 desc_name++; \
627 if (TREE_PUBLIC (DECL)) \
628 fprintf (FILE, "\t.globl %s\n", desc_name); \
630 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
631 fprintf (FILE, "%s:\n", desc_name); \
632 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
633 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
634 if (DEFAULT_ABI == ABI_AIX) \
635 fprintf (FILE, "\t%s 0\n", init_ptr); \
636 fprintf (FILE, "\t.previous\n"); \
638 ASM_OUTPUT_LABEL (FILE, NAME); \
639 } while (0)
641 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
642 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
644 #define LOCAL_LABEL_PREFIX "."
645 #define USER_LABEL_PREFIX ""
647 /* svr4.h overrides (*targetm.asm_out.internal_label). */
649 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
650 asm_fprintf (FILE, "%L%s", PREFIX)
652 /* Globalizing directive for a label. */
653 #define GLOBAL_ASM_OP "\t.globl "
655 /* This says how to output assembler code to declare an
656 uninitialized internal linkage data object. Under SVR4,
657 the linker seems to want the alignment of data objects
658 to depend on their types. We do exactly that here. */
660 #define LOCAL_ASM_OP "\t.local\t"
662 #define LCOMM_ASM_OP "\t.lcomm\t"
664 /* Override elfos.h definition. */
665 #undef ASM_OUTPUT_ALIGNED_LOCAL
666 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
667 do { \
668 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
669 && (SIZE) <= g_switch_value) \
671 sbss_section (); \
672 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
673 ASM_OUTPUT_LABEL (FILE, NAME); \
674 ASM_OUTPUT_SKIP (FILE, SIZE); \
675 if (!flag_inhibit_size_directive && (SIZE) > 0) \
676 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
678 else \
680 fprintf (FILE, "%s", LCOMM_ASM_OP); \
681 assemble_name ((FILE), (NAME)); \
682 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
684 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
685 } while (0)
687 /* Describe how to emit uninitialized external linkage items. */
688 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
689 do { \
690 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
691 } while (0)
693 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
694 /* To support -falign-* switches we need to use .p2align so
695 that alignment directives in code sections will be padded
696 with no-op instructions, rather than zeroes. */
697 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
698 if ((LOG) != 0) \
700 if ((MAX_SKIP) == 0) \
701 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
702 else \
703 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
705 #endif
707 /* This is how to output code to push a register on the stack.
708 It need not be very fast code.
710 On the rs6000, we must keep the backchain up to date. In order
711 to simplify things, always allocate 16 bytes for a push (System V
712 wants to keep stack aligned to a 16 byte boundary). */
714 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
715 do { \
716 if (DEFAULT_ABI == ABI_V4) \
717 asm_fprintf (FILE, \
718 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
719 reg_names[1], reg_names[1], reg_names[REGNO], \
720 reg_names[1]); \
721 } while (0)
723 /* This is how to output an insn to pop a register from the stack.
724 It need not be very fast code. */
726 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
727 do { \
728 if (DEFAULT_ABI == ABI_V4) \
729 asm_fprintf (FILE, \
730 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
731 reg_names[REGNO], reg_names[1], reg_names[1], \
732 reg_names[1]); \
733 } while (0)
735 /* Switch Recognition by gcc.c. Add -G xx support. */
737 /* Override svr4.h definition. */
738 #undef SWITCH_TAKES_ARG
739 #define SWITCH_TAKES_ARG(CHAR) \
740 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
741 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
742 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
743 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
744 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
746 /* Output .file. */
747 /* Override elfos.h definition. */
748 #undef ASM_FILE_START
749 #define ASM_FILE_START(FILE) \
750 do { \
751 output_file_directive ((FILE), main_input_filename); \
752 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
753 } while (0)
756 extern int fixuplabelno;
758 /* Handle constructors specially for -mrelocatable. */
759 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
760 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
762 /* This is the end of what might become sysv4.h. */
764 /* Use DWARF 2 debugging information by default. */
765 #undef PREFERRED_DEBUGGING_TYPE
766 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
768 /* Historically we have also supported stabs debugging. */
769 #define DBX_DEBUGGING_INFO 1
771 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
772 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
773 #define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags
775 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
777 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
778 assemble_name (FILE, NAME)
780 /* We have to output the stabs for the function name *first*, before
781 outputting its label. */
783 #define DBX_FUNCTION_FIRST
785 /* This is the end of what might become sysv4dbx.h. */
787 #ifndef TARGET_VERSION
788 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
789 #endif
791 #ifndef TARGET_OS_CPP_BUILTINS
792 #define TARGET_OS_CPP_BUILTINS() \
793 do \
795 builtin_define_std ("PPC"); \
796 builtin_define_std ("unix"); \
797 builtin_define ("__svr4__"); \
798 builtin_assert ("system=unix"); \
799 builtin_assert ("system=svr4"); \
800 builtin_assert ("cpu=powerpc"); \
801 builtin_assert ("machine=powerpc"); \
803 while (0)
804 #endif
806 /* Pass various options to the assembler. */
807 /* Override svr4.h definition. */
808 #undef ASM_SPEC
809 #define ASM_SPEC "%(asm_cpu) \
810 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
811 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
812 %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
813 %{memb|msdata|msdata=eabi: -memb} \
814 %{mlittle|mlittle-endian:-mlittle; \
815 mbig|mbig-endian :-mbig; \
816 mcall-aixdesc | \
817 mcall-freebsd | \
818 mcall-netbsd | \
819 mcall-linux | \
820 mcall-gnu :-mbig; \
821 mcall-i960-old :-mlittle}"
823 #define CC1_ENDIAN_BIG_SPEC ""
825 #define CC1_ENDIAN_LITTLE_SPEC "\
826 %{!mstrict-align: %{!mno-strict-align: \
827 %{!mcall-i960-old: \
828 -mstrict-align \
832 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
834 /* Pass -G xxx to the compiler and set correct endian mode. */
835 #define CC1_SPEC "%{G*} \
836 %{mlittle|mlittle-endian: %(cc1_endian_little); \
837 mbig |mbig-endian : %(cc1_endian_big); \
838 mcall-aixdesc | \
839 mcall-freebsd | \
840 mcall-netbsd | \
841 mcall-linux | \
842 mcall-gnu : -mbig %(cc1_endian_big); \
843 mcall-i960-old : -mlittle %(cc1_endian_little); \
844 : %(cc1_endian_default)} \
845 %{mno-sdata: -msdata=none } \
846 %{meabi: %{!mcall-*: -mcall-sysv }} \
847 %{!meabi: %{!mno-eabi: \
848 %{mrelocatable: -meabi } \
849 %{mcall-freebsd: -mno-eabi } \
850 %{mcall-i960-old: -meabi } \
851 %{mcall-linux: -mno-eabi } \
852 %{mcall-gnu: -mno-eabi } \
853 %{mcall-netbsd: -mno-eabi }}} \
854 %{msdata: -msdata=default} \
855 %{mno-sdata: -msdata=none} \
856 %{profile: -p}"
858 /* Don't put -Y P,<path> for cross compilers. */
859 #ifndef CROSS_COMPILE
860 #define LINK_PATH_SPEC "\
861 %{!R*:%{L*:-R %*}} \
862 %{!nostdlib: %{!YP,*: \
863 %{compat-bsd: \
864 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
865 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
866 %{!R*: %{!L*: -R /usr/ucblib}} \
867 %{!compat-bsd: \
868 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
869 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
871 #else
872 #define LINK_PATH_SPEC ""
873 #endif
875 /* Default starting address if specified. */
876 #define LINK_START_SPEC "\
877 %{mads : %(link_start_ads) ; \
878 myellowknife : %(link_start_yellowknife) ; \
879 mmvme : %(link_start_mvme) ; \
880 msim : %(link_start_sim) ; \
881 mwindiss : %(link_start_windiss) ; \
882 mcall-freebsd: %(link_start_freebsd) ; \
883 mcall-linux : %(link_start_linux) ; \
884 mcall-gnu : %(link_start_gnu) ; \
885 mcall-netbsd : %(link_start_netbsd) ; \
886 : %(link_start_default) }"
888 #define LINK_START_DEFAULT_SPEC ""
890 /* Override svr4.h definition. */
891 #undef LINK_SPEC
892 #define LINK_SPEC "\
893 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
894 %{YP,*} %{R*} \
895 %{Qy:} %{!Qn:-Qy} \
896 %(link_shlib) \
897 %{!Wl,-T*: %{!T*: %(link_start) }} \
898 %(link_target) \
899 %(link_os)"
901 /* For now, turn off shared libraries by default. */
902 #ifndef SHARED_LIB_SUPPORT
903 #define NO_SHARED_LIB_SUPPORT
904 #endif
906 #ifndef NO_SHARED_LIB_SUPPORT
907 /* Shared libraries are default. */
908 #define LINK_SHLIB_SPEC "\
909 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
910 %{mshlib: } \
911 %{static:-dn -Bstatic} \
912 %{shared:-G -dy -z text} \
913 %{symbolic:-Bsymbolic -G -dy -z text}"
915 #else
916 /* Shared libraries are not default. */
917 #define LINK_SHLIB_SPEC "\
918 %{mshlib: %(link_path) } \
919 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
920 %{static: } \
921 %{shared:-G -dy -z text %(link_path) } \
922 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
923 #endif
925 /* Override the default target of the linker. */
926 #define LINK_TARGET_SPEC "\
927 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
928 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
929 %{mcall-i960-old: --oformat elf32-powerpcle} \
930 }}}}"
932 /* Any specific OS flags. */
933 #define LINK_OS_SPEC "\
934 %{mads : %(link_os_ads) ; \
935 myellowknife : %(link_os_yellowknife) ; \
936 mmvme : %(link_os_mvme) ; \
937 msim : %(link_os_sim) ; \
938 mwindiss : %(link_os_windiss) ; \
939 mcall-freebsd: %(link_os_freebsd) ; \
940 mcall-linux : %(link_os_linux) ; \
941 mcall-gnu : %(link_os_gnu) ; \
942 mcall-netbsd : %(link_os_netbsd) ; \
943 : %(link_os_default) }"
945 #define LINK_OS_DEFAULT_SPEC ""
947 #define CPP_SYSV_SPEC \
948 "%{mrelocatable*: -D_RELOCATABLE} \
949 %{fpic: -D__PIC__=1 -D__pic__=1} \
950 %{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}}"
952 /* Override rs6000.h definition. */
953 #undef CPP_SPEC
954 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) \
955 %{mads : %(cpp_os_ads) ; \
956 myellowknife : %(cpp_os_yellowknife) ; \
957 mmvme : %(cpp_os_mvme) ; \
958 msim : %(cpp_os_sim) ; \
959 mwindiss : %(cpp_os_windiss) ; \
960 mcall-freebsd: %(cpp_os_freebsd) ; \
961 mcall-linux : %(cpp_os_linux) ; \
962 mcall-gnu : %(cpp_os_gnu) ; \
963 mcall-netbsd : %(cpp_os_netbsd) ; \
964 : %(cpp_os_default) }"
966 #define CPP_OS_DEFAULT_SPEC ""
968 /* Override svr4.h definition. */
969 #undef STARTFILE_SPEC
970 #define STARTFILE_SPEC "\
971 %{mads : %(startfile_ads) ; \
972 myellowknife : %(startfile_yellowknife) ; \
973 mmvme : %(startfile_mvme) ; \
974 msim : %(startfile_sim) ; \
975 mwindiss : %(startfile_windiss) ; \
976 mcall-freebsd: %(startfile_freebsd) ; \
977 mcall-linux : %(startfile_linux) ; \
978 mcall-gnu : %(startfile_gnu) ; \
979 mcall-netbsd : %(startfile_netbsd) ; \
980 : %(startfile_default) }"
982 #define STARTFILE_DEFAULT_SPEC ""
984 /* Override svr4.h definition. */
985 #undef LIB_SPEC
986 #define LIB_SPEC "\
987 %{mads : %(lib_ads) ; \
988 myellowknife : %(lib_yellowknife) ; \
989 mmvme : %(lib_mvme) ; \
990 msim : %(lib_sim) ; \
991 mwindiss : %(lib_windiss) ; \
992 mcall-freebsd: %(lib_freebsd) ; \
993 mcall-linux : %(lib_linux) ; \
994 mcall-gnu : %(lib_gnu) ; \
995 mcall-netbsd : %(lib_netbsd) ; \
996 : %(lib_default) }"
998 #define LIB_DEFAULT_SPEC ""
1000 /* Override svr4.h definition. */
1001 #undef ENDFILE_SPEC
1002 #define ENDFILE_SPEC "\
1003 %{mads : crtsavres.o%s %(endfile_ads) ; \
1004 myellowknife : crtsavres.o%s %(endfile_yellowknife) ; \
1005 mmvme : crtsavres.o%s %(endfile_mvme) ; \
1006 msim : crtsavres.o%s %(endfile_sim) ; \
1007 mwindiss : %(endfile_windiss) ; \
1008 mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \
1009 mcall-linux : crtsavres.o%s %(endfile_linux) ; \
1010 mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \
1011 mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \
1012 : %(crtsavres_default) %(endfile_default) }"
1014 #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
1016 #define ENDFILE_DEFAULT_SPEC ""
1018 /* Motorola ADS support. */
1019 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1021 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1023 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
1025 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1027 #define LINK_OS_ADS_SPEC ""
1029 #define CPP_OS_ADS_SPEC ""
1031 /* Motorola Yellowknife support. */
1032 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1034 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1036 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
1038 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1040 #define LINK_OS_YELLOWKNIFE_SPEC ""
1042 #define CPP_OS_YELLOWKNIFE_SPEC ""
1044 /* Motorola MVME support. */
1045 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1047 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1049 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
1051 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
1053 #define LINK_OS_MVME_SPEC ""
1055 #define CPP_OS_MVME_SPEC ""
1057 /* PowerPC simulator based on netbsd system calls support. */
1058 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1060 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
1062 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
1064 #define LINK_START_SIM_SPEC ""
1066 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
1068 #define CPP_OS_SIM_SPEC ""
1070 /* FreeBSD support. */
1072 #define CPP_OS_FREEBSD_SPEC "\
1073 -D__ELF__ -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
1074 -Acpu=powerpc -Amachine=powerpc"
1076 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
1077 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
1078 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
1079 #define LINK_START_FREEBSD_SPEC ""
1081 #define LINK_OS_FREEBSD_SPEC "\
1082 %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
1083 %{Wl,*:%*} \
1084 %{v:-V} \
1085 %{assert*} %{R*} %{rpath*} %{defsym*} \
1086 %{shared:-Bshareable %{h*} %{soname*}} \
1087 %{!shared: \
1088 %{!static: \
1089 %{rdynamic: -export-dynamic} \
1090 %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
1091 %{static:-Bstatic}} \
1092 %{symbolic:-Bsymbolic}"
1094 /* GNU/Linux support. */
1095 #ifdef USE_GNULIBC_1
1096 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1097 %{!mnewlib: -lc }"
1098 #else
1099 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1100 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1101 %{profile:-lc_p} %{!profile:-lc}}}"
1102 #endif
1104 #ifdef USE_GNULIBC_1
1105 #define STARTFILE_LINUX_SPEC "\
1106 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1107 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1108 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1109 #else
1110 #define STARTFILE_LINUX_SPEC "\
1111 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1112 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1113 %{static:crtbeginT.o%s} \
1114 %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
1115 #endif
1117 #define ENDFILE_LINUX_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1118 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1120 #define LINK_START_LINUX_SPEC ""
1122 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1123 %{rdynamic:-export-dynamic} \
1124 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1126 #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR)
1127 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1128 #endif
1130 #ifdef USE_GNULIBC_1
1131 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1132 %{!undef: \
1133 %{!ansi: \
1134 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1135 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1136 -Asystem=unix -Asystem=posix"
1137 #else
1138 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1139 %{!undef: \
1140 %{!ansi: \
1141 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1142 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1143 -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1144 #endif
1146 /* GNU/Hurd support. */
1147 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
1148 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1149 %{profile:-lc_p} %{!profile:-lc}}}"
1151 #define STARTFILE_GNU_SPEC "\
1152 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
1153 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1154 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1155 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1157 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1158 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1160 #define LINK_START_GNU_SPEC ""
1162 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1163 %{rdynamic:-export-dynamic} \
1164 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1166 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
1167 %{!undef: \
1168 %{!ansi: -Dunix -D__unix}} \
1169 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1171 /* NetBSD support. */
1172 #define LIB_NETBSD_SPEC "\
1173 %{profile:-lgmon -lc_p} %{!profile:-lc}"
1175 #define STARTFILE_NETBSD_SPEC "\
1176 ncrti.o%s crt0.o%s \
1177 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1179 #define ENDFILE_NETBSD_SPEC "\
1180 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1181 ncrtn.o%s"
1183 #define LINK_START_NETBSD_SPEC "\
1186 #define LINK_OS_NETBSD_SPEC "\
1187 %{!shared: %{!static: \
1188 %{rdynamic:-export-dynamic} \
1189 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
1191 #define CPP_OS_NETBSD_SPEC "\
1192 -D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__"
1194 /* WindISS support. */
1196 #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
1198 #define CPP_OS_WINDISS_SPEC "\
1199 -D__rtasim \
1200 -D__EABI__ \
1201 -D__ppc \
1202 %{!msoft-float: -D__hardfp} \
1205 #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1207 #define ENDFILE_WINDISS_SPEC "crtend.o%s"
1209 #define LINK_START_WINDISS_SPEC ""
1211 #define LINK_OS_WINDISS_SPEC ""
1213 /* Define any extra SPECS that the compiler needs to generate. */
1214 /* Override rs6000.h definition. */
1215 #undef SUBTARGET_EXTRA_SPECS
1216 #define SUBTARGET_EXTRA_SPECS \
1217 { "cpp_sysv", CPP_SYSV_SPEC }, \
1218 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
1219 { "lib_ads", LIB_ADS_SPEC }, \
1220 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1221 { "lib_mvme", LIB_MVME_SPEC }, \
1222 { "lib_sim", LIB_SIM_SPEC }, \
1223 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
1224 { "lib_gnu", LIB_GNU_SPEC }, \
1225 { "lib_linux", LIB_LINUX_SPEC }, \
1226 { "lib_netbsd", LIB_NETBSD_SPEC }, \
1227 { "lib_windiss", LIB_WINDISS_SPEC }, \
1228 { "lib_default", LIB_DEFAULT_SPEC }, \
1229 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1230 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1231 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1232 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1233 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
1234 { "startfile_gnu", STARTFILE_GNU_SPEC }, \
1235 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1236 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
1237 { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \
1238 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1239 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1240 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1241 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1242 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1243 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
1244 { "endfile_gnu", ENDFILE_GNU_SPEC }, \
1245 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1246 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
1247 { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \
1248 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1249 { "link_path", LINK_PATH_SPEC }, \
1250 { "link_shlib", LINK_SHLIB_SPEC }, \
1251 { "link_target", LINK_TARGET_SPEC }, \
1252 { "link_start", LINK_START_SPEC }, \
1253 { "link_start_ads", LINK_START_ADS_SPEC }, \
1254 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1255 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1256 { "link_start_sim", LINK_START_SIM_SPEC }, \
1257 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
1258 { "link_start_gnu", LINK_START_GNU_SPEC }, \
1259 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1260 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
1261 { "link_start_windiss", LINK_START_WINDISS_SPEC }, \
1262 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1263 { "link_os", LINK_OS_SPEC }, \
1264 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1265 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1266 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1267 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1268 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
1269 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1270 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
1271 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
1272 { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
1273 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1274 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1275 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1276 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1277 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1278 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1279 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1280 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1281 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
1282 { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
1283 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1284 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
1285 { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \
1286 { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
1288 /* Define this macro as a C expression for the initializer of an
1289 array of string to tell the driver program which options are
1290 defaults for this target and thus do not need to be handled
1291 specially when using `MULTILIB_OPTIONS'.
1293 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1294 the target makefile fragment or if none of the options listed in
1295 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1297 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1299 /* Define this macro if the code for function profiling should come
1300 before the function prologue. Normally, the profiling code comes
1301 after. */
1302 #define PROFILE_BEFORE_PROLOGUE 1
1304 /* Function name to call to do profiling. */
1305 #define RS6000_MCOUNT "_mcount"
1307 /* Define this macro (to a value of 1) if you want to support the
1308 Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1309 pack(pop)'. The pack(push,<n>) pragma specifies the maximum
1310 alignment (in bytes) of fields within a structure, in much the
1311 same way as the __aligned__' and __packed__' __attribute__'s
1312 do. A pack value of zero resets the behavior to the default.
1313 Successive invocations of this pragma cause the previous values to
1314 be stacked, so that invocations of #pragma pack(pop)' will return
1315 to the previous value. */
1317 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
1319 /* Define library calls for quad FP operations. These are all part of the
1320 PowerPC 32bit ABI. */
1321 #define ADDTF3_LIBCALL "_q_add"
1322 #define DIVTF3_LIBCALL "_q_div"
1323 #define EXTENDDFTF2_LIBCALL "_q_dtoq"
1324 #define EQTF2_LIBCALL "_q_feq"
1325 #define GETF2_LIBCALL "_q_fge"
1326 #define GTTF2_LIBCALL "_q_fgt"
1327 #define LETF2_LIBCALL "_q_fle"
1328 #define LTTF2_LIBCALL "_q_flt"
1329 #define NETF2_LIBCALL "_q_fne"
1330 #define FLOATSITF2_LIBCALL "_q_itoq"
1331 #define MULTF3_LIBCALL "_q_mul"
1332 #define NEGTF2_LIBCALL "_q_neg"
1333 #define TRUNCTFDF2_LIBCALL "_q_qtod"
1334 #define FIX_TRUNCTFSI2_LIBCALL "_q_qtoi"
1335 #define TRUNCTFSF2_LIBCALL "_q_qtos"
1336 #define FIXUNS_TRUNCTFSI2_LIBCALL "_q_qtou"
1337 #define SQRTTF_LIBCALL "_q_sqrt"
1338 #define EXTENDSFTF2_LIBCALL "_q_stoq"
1339 #define SUBTF3_LIBCALL "_q_sub"
1340 #define FLOATUNSSITF2_LIBCALL "_q_utoq"
1342 #define INIT_TARGET_OPTABS \
1343 do { \
1344 if (TARGET_HARD_FLOAT) \
1346 add_optab->handlers[(int) TFmode].libfunc \
1347 = init_one_libfunc (ADDTF3_LIBCALL); \
1348 sub_optab->handlers[(int) TFmode].libfunc \
1349 = init_one_libfunc (SUBTF3_LIBCALL); \
1350 neg_optab->handlers[(int) TFmode].libfunc \
1351 = init_one_libfunc (NEGTF2_LIBCALL); \
1352 smul_optab->handlers[(int) TFmode].libfunc \
1353 = init_one_libfunc (MULTF3_LIBCALL); \
1354 sdiv_optab->handlers[(int) TFmode].libfunc \
1355 = init_one_libfunc (DIVTF3_LIBCALL); \
1356 eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL); \
1357 netf2_libfunc = init_one_libfunc (NETF2_LIBCALL); \
1358 gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL); \
1359 getf2_libfunc = init_one_libfunc (GETF2_LIBCALL); \
1360 lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL); \
1361 letf2_libfunc = init_one_libfunc (LETF2_LIBCALL); \
1362 trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL); \
1363 trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL); \
1364 extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL); \
1365 extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL); \
1366 floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL); \
1367 fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL); \
1368 fixunstfsi_libfunc \
1369 = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL); \
1370 if (TARGET_PPC_GPOPT || TARGET_POWER2) \
1371 sqrt_optab->handlers[(int) TFmode].libfunc \
1372 = init_one_libfunc (SQRTTF_LIBCALL); \
1374 } while (0)
1376 /* Select a format to encode pointers in exception handling data. CODE
1377 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1378 true if the symbol may be affected by dynamic relocations. */
1379 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1380 ((flag_pic || TARGET_RELOCATABLE) \
1381 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1382 : DW_EH_PE_absptr)
1384 #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section
1386 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1388 /* Generate entries in .fixup for relocatable addresses. */
1389 #define RELOCATABLE_NEEDS_FIXUP