Merge from the pain train
[official-gcc.git] / gcc / config / rs6000 / sysv4.h
blobdb9abeae7358bf833422ac143ece5999cc20f734
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 2004, 2005 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 #define SDATA_DEFAULT_SIZE 8
94 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
95 the same as -mminimal-toc. */
96 /* Override rs6000.h definition. */
97 #undef SUBTARGET_SWITCHES
98 #define SUBTARGET_SWITCHES \
99 { "bit-align", -MASK_NO_BITFIELD_TYPE, \
100 N_("Align to the base type of the bit-field") }, \
101 { "no-bit-align", MASK_NO_BITFIELD_TYPE, \
102 N_("Don't align to the base type of the bit-field") }, \
103 { "strict-align", MASK_STRICT_ALIGN, \
104 N_("Don't assume that unaligned accesses are handled by the system") }, \
105 { "no-strict-align", -MASK_STRICT_ALIGN, \
106 N_("Assume that unaligned accesses are handled by the system") }, \
107 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
108 N_("Produce code relocatable at runtime") }, \
109 { "no-relocatable", -MASK_RELOCATABLE, \
110 N_("Don't produce code relocatable at runtime") }, \
111 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
112 N_("Produce code relocatable at runtime") }, \
113 { "no-relocatable-lib", -MASK_RELOCATABLE, \
114 N_("Don't produce code relocatable at runtime") }, \
115 { "little-endian", MASK_LITTLE_ENDIAN, \
116 N_("Produce little endian code") }, \
117 { "little", MASK_LITTLE_ENDIAN, \
118 N_("Produce little endian code") }, \
119 { "big-endian", -MASK_LITTLE_ENDIAN, \
120 N_("Produce big endian code") }, \
121 { "big", -MASK_LITTLE_ENDIAN, \
122 N_("Produce big endian code") }, \
123 { "no-toc", 0, N_("no description yet") }, \
124 { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
125 { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
126 { "prototype", MASK_PROTOTYPE, N_("no description yet") }, \
127 { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \
128 { "no-traceback", 0, N_("no description yet") }, \
129 { "eabi", MASK_EABI, N_("Use EABI") }, \
130 { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \
131 { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \
132 { "no-bit-word", MASK_NO_BITFIELD_WORD, \
133 N_("Do not allow bit-fields to cross word boundaries") }, \
134 { "regnames", MASK_REGNAMES, \
135 N_("Use alternate register names") }, \
136 { "no-regnames", -MASK_REGNAMES, \
137 N_("Don't use alternate register names") }, \
138 { "sdata", 0, N_("no description yet") }, \
139 { "no-sdata", 0, N_("no description yet") }, \
140 { "sim", 0, \
141 N_("Link with libsim.a, libc.a and sim-crt0.o") }, \
142 { "ads", 0, \
143 N_("Link with libads.a, libc.a and crt0.o") }, \
144 { "yellowknife", 0, \
145 N_("Link with libyk.a, libc.a and crt0.o") }, \
146 { "mvme", 0, \
147 N_("Link with libmvme.a, libc.a and crt0.o") }, \
148 { "emb", 0, \
149 N_("Set the PPC_EMB bit in the ELF flags header") }, \
150 { "windiss", 0, N_("Use the WindISS simulator") }, \
151 { "shlib", 0, N_("no description yet") }, \
152 { "64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC, \
153 N_("Generate 64-bit code") }, \
154 { "32", - (MASK_64BIT | MASK_POWERPC64), \
155 N_("Generate 32-bit code") }, \
156 EXTRA_SUBTARGET_SWITCHES \
157 { "newlib", 0, N_("no description yet") },
159 /* This is meant to be redefined in the host dependent files. */
160 #define EXTRA_SUBTARGET_SWITCHES
162 /* Sometimes certain combinations of command options do not make sense
163 on a particular target machine. You can define a macro
164 `OVERRIDE_OPTIONS' to take account of this. This macro, if
165 defined, is executed once just after all the command options have
166 been parsed.
168 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
169 get control. */
171 #define SUBTARGET_OVERRIDE_OPTIONS \
172 do { \
173 if (!g_switch_set) \
174 g_switch_value = SDATA_DEFAULT_SIZE; \
176 if (rs6000_abi_name == NULL) \
177 rs6000_abi_name = RS6000_ABI_NAME; \
179 if (!strcmp (rs6000_abi_name, "sysv")) \
180 rs6000_current_abi = ABI_V4; \
181 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
183 rs6000_current_abi = ABI_V4; \
184 target_flags &= ~ MASK_EABI; \
186 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
187 || !strcmp (rs6000_abi_name, "eabi")) \
189 rs6000_current_abi = ABI_V4; \
190 target_flags |= MASK_EABI; \
192 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
193 rs6000_current_abi = ABI_AIX; \
194 else if (!strcmp (rs6000_abi_name, "freebsd")) \
195 rs6000_current_abi = ABI_V4; \
196 else if (!strcmp (rs6000_abi_name, "linux")) \
198 if (TARGET_64BIT) \
199 rs6000_current_abi = ABI_AIX; \
200 else \
201 rs6000_current_abi = ABI_V4; \
203 else if (!strcmp (rs6000_abi_name, "gnu")) \
204 rs6000_current_abi = ABI_V4; \
205 else if (!strcmp (rs6000_abi_name, "netbsd")) \
206 rs6000_current_abi = ABI_V4; \
207 else if (!strcmp (rs6000_abi_name, "openbsd")) \
208 rs6000_current_abi = ABI_V4; \
209 else if (!strcmp (rs6000_abi_name, "i960-old")) \
211 rs6000_current_abi = ABI_V4; \
212 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \
213 | MASK_NO_BITFIELD_WORD); \
214 target_flags &= ~MASK_STRICT_ALIGN; \
216 else \
218 rs6000_current_abi = ABI_V4; \
219 error ("bad value for -mcall-%s", rs6000_abi_name); \
222 if (rs6000_sdata_name) \
224 if (!strcmp (rs6000_sdata_name, "none")) \
225 rs6000_sdata = SDATA_NONE; \
226 else if (!strcmp (rs6000_sdata_name, "data")) \
227 rs6000_sdata = SDATA_DATA; \
228 else if (!strcmp (rs6000_sdata_name, "default")) \
229 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
230 else if (!strcmp (rs6000_sdata_name, "sysv")) \
231 rs6000_sdata = SDATA_SYSV; \
232 else if (!strcmp (rs6000_sdata_name, "eabi")) \
233 rs6000_sdata = SDATA_EABI; \
234 else \
235 error ("bad value for -msdata=%s", rs6000_sdata_name); \
237 else if (DEFAULT_ABI == ABI_V4) \
239 rs6000_sdata = SDATA_DATA; \
240 rs6000_sdata_name = "data"; \
242 else \
244 rs6000_sdata = SDATA_NONE; \
245 rs6000_sdata_name = "none"; \
248 if (TARGET_RELOCATABLE && \
249 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
251 rs6000_sdata = SDATA_DATA; \
252 error ("-mrelocatable and -msdata=%s are incompatible", \
253 rs6000_sdata_name); \
256 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
257 && (rs6000_sdata == SDATA_EABI \
258 || rs6000_sdata == SDATA_SYSV)) \
260 rs6000_sdata = SDATA_DATA; \
261 error ("-f%s and -msdata=%s are incompatible", \
262 (flag_pic > 1) ? "PIC" : "pic", \
263 rs6000_sdata_name); \
266 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
267 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
269 rs6000_sdata = SDATA_NONE; \
270 error ("-msdata=%s and -mcall-%s are incompatible", \
271 rs6000_sdata_name, rs6000_abi_name); \
274 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
276 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
278 target_flags |= MASK_MINIMAL_TOC; \
279 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
282 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
284 target_flags &= ~MASK_RELOCATABLE; \
285 error ("-mrelocatable and -mcall-%s are incompatible", \
286 rs6000_abi_name); \
289 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
291 flag_pic = 0; \
292 error ("-fPIC and -mcall-%s are incompatible", \
293 rs6000_abi_name); \
296 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
298 target_flags &= ~MASK_LITTLE_ENDIAN; \
299 error ("-mcall-aixdesc must be big endian"); \
302 /* Treat -fPIC the same as -mrelocatable. */ \
303 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
304 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
306 else if (TARGET_RELOCATABLE) \
307 flag_pic = 2; \
308 } while (0)
310 #ifndef RS6000_BI_ARCH
311 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
312 do { \
313 if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
314 error ("-m%s not supported in this configuration", \
315 (target_flags & MASK_64BIT) ? "64" : "32"); \
316 } while (0)
317 #endif
319 /* Override rs6000.h definition. */
320 #undef TARGET_DEFAULT
321 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
323 /* Override rs6000.h definition. */
324 #undef PROCESSOR_DEFAULT
325 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
327 /* SVR4 only defined for PowerPC, so short-circuit POWER patterns. */
328 #undef TARGET_POWER
329 #define TARGET_POWER 0
331 #define FIXED_R2 1
332 /* System V.4 uses register 13 as a pointer to the small data area,
333 so it is not available to the normal user. */
334 #define FIXED_R13 1
336 /* Size of the V.4 varargs area if needed. */
337 /* Override rs6000.h definition. */
338 #undef RS6000_VARARGS_AREA
339 #define RS6000_VARARGS_AREA (current_function_stdarg ? RS6000_VARARGS_SIZE : 0)
341 /* Override default big endianism definitions in rs6000.h. */
342 #undef BYTES_BIG_ENDIAN
343 #undef WORDS_BIG_ENDIAN
344 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
345 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
347 /* Define this to set the endianness to use in libgcc2.c, which can
348 not depend on target_flags. */
349 #if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
350 #define LIBGCC2_WORDS_BIG_ENDIAN 1
351 #else
352 #define LIBGCC2_WORDS_BIG_ENDIAN 0
353 #endif
355 /* Define cutoff for using external functions to save floating point.
356 Currently on V.4, always use inline stores. */
357 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
359 /* Put jump tables in read-only memory, rather than in .text. */
360 #define JUMP_TABLES_IN_TEXT_SECTION 0
362 /* Prefix and suffix to use to saving floating point. */
363 #define SAVE_FP_PREFIX "_savefpr_"
364 #define SAVE_FP_SUFFIX "_l"
366 /* Prefix and suffix to use to restoring floating point. */
367 #define RESTORE_FP_PREFIX "_restfpr_"
368 #define RESTORE_FP_SUFFIX "_l"
370 /* Type used for ptrdiff_t, as a string used in a declaration. */
371 #define PTRDIFF_TYPE "int"
373 /* Type used for wchar_t, as a string used in a declaration. */
374 /* Override svr4.h definition. */
375 #undef WCHAR_TYPE
376 #define WCHAR_TYPE "long int"
378 /* Width of wchar_t in bits. */
379 /* Override svr4.h definition. */
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. */
384 /* Override elfos.h definition. */
385 #undef PCC_BITFIELD_TYPE_MATTERS
386 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
388 #undef BITFIELD_NBYTES_LIMITED
389 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
391 /* Define this macro to be the value 1 if instructions will fail to
392 work if given data not on the nominal alignment. If instructions
393 will merely go slower in that case, define this macro as 0. */
394 #undef STRICT_ALIGNMENT
395 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
397 /* Define this macro if you wish to preserve a certain alignment for
398 the stack pointer, greater than what the hardware enforces. The
399 definition is a C expression for the desired alignment (measured
400 in bits). This macro must evaluate to a value equal to or larger
401 than STACK_BOUNDARY.
402 For the SYSV ABI and variants the alignment of the stack pointer
403 is usually controlled manually in rs6000.c. However, to maintain
404 alignment across alloca () in all circumstances,
405 PREFERRED_STACK_BOUNDARY needs to be set as well.
406 This has the additional advantage of allowing a bigger maximum
407 alignment of user objects on the stack. */
409 #undef PREFERRED_STACK_BOUNDARY
410 #define PREFERRED_STACK_BOUNDARY 128
412 /* Real stack boundary as mandated by the appropriate ABI. */
413 #define ABI_STACK_BOUNDARY \
414 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
416 /* An expression for the alignment of a structure field FIELD if the
417 alignment computed in the usual way is COMPUTED. */
418 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
419 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
420 ? 128 : COMPUTED)
422 /* Define this macro as an expression for the alignment of a type
423 (given by TYPE as a tree node) if the alignment computed in the
424 usual way is COMPUTED and the alignment explicitly specified was
425 SPECIFIED. */
426 #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
427 ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) \
428 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \
429 : MAX (COMPUTED, SPECIFIED))
431 #undef BIGGEST_FIELD_ALIGNMENT
433 /* Use ELF style section commands. */
435 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
437 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
439 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
441 /* Override elfos.h definition. */
442 #undef INIT_SECTION_ASM_OP
443 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
445 /* Override elfos.h definition. */
446 #undef FINI_SECTION_ASM_OP
447 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
449 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
451 /* Put PC relative got entries in .got2. */
452 #define MINIMAL_TOC_SECTION_ASM_OP \
453 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
454 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
456 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
457 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
458 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
460 /* Besides the usual ELF sections, we need a toc section. */
461 /* Override elfos.h definition. */
462 #undef EXTRA_SECTIONS
463 #define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
465 /* Override elfos.h definition. */
466 #undef EXTRA_SECTION_FUNCTIONS
467 #define EXTRA_SECTION_FUNCTIONS \
468 TOC_SECTION_FUNCTION \
469 SDATA_SECTION_FUNCTION \
470 SDATA2_SECTION_FUNCTION \
471 SBSS_SECTION_FUNCTION \
472 INIT_SECTION_FUNCTION \
473 FINI_SECTION_FUNCTION
475 #define TOC_SECTION_FUNCTION \
476 void \
477 toc_section (void) \
479 if (in_section != in_toc) \
481 in_section = in_toc; \
482 if (DEFAULT_ABI == ABI_AIX \
483 && TARGET_MINIMAL_TOC \
484 && !TARGET_RELOCATABLE) \
486 if (! toc_initialized) \
488 toc_initialized = 1; \
489 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
490 (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \
491 fprintf (asm_out_file, "\t.tc "); \
492 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
493 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
494 fprintf (asm_out_file, "\n"); \
496 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
497 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
498 fprintf (asm_out_file, " = .+32768\n"); \
500 else \
501 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
503 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
504 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
505 else \
507 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
508 if (! toc_initialized) \
510 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
511 fprintf (asm_out_file, " = .+32768\n"); \
512 toc_initialized = 1; \
518 extern int in_toc_section (void); \
519 int in_toc_section (void) \
521 return in_section == in_toc; \
524 #define SDATA_SECTION_FUNCTION \
525 void \
526 sdata_section (void) \
528 if (in_section != in_sdata) \
530 in_section = in_sdata; \
531 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
535 #define SDATA2_SECTION_FUNCTION \
536 void \
537 sdata2_section (void) \
539 if (in_section != in_sdata2) \
541 in_section = in_sdata2; \
542 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
546 #define SBSS_SECTION_FUNCTION \
547 void \
548 sbss_section (void) \
550 if (in_section != in_sbss) \
552 in_section = in_sbss; \
553 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
557 #define INIT_SECTION_FUNCTION \
558 void \
559 init_section (void) \
561 if (in_section != in_init) \
563 in_section = in_init; \
564 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
568 #define FINI_SECTION_FUNCTION \
569 void \
570 fini_section (void) \
572 if (in_section != in_fini) \
574 in_section = in_fini; \
575 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
579 /* Override default elf definitions. */
580 #undef TARGET_ASM_SELECT_RTX_SECTION
581 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
582 #undef TARGET_ASM_SELECT_SECTION
583 #define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section
584 #define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section
586 /* Return nonzero 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, MODE) \
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 || (GET_CODE (X) == CONST_INT \
605 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
606 || (!TARGET_NO_FP_IN_TOC \
607 && !TARGET_RELOCATABLE \
608 && GET_CODE (X) == CONST_DOUBLE \
609 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
610 && BITS_PER_WORD == HOST_BITS_PER_INT)))
612 /* These macros generate the special .type and .size directives which
613 are used to set the corresponding fields of the linker symbol table
614 entries in an ELF object file under SVR4. These macros also output
615 the starting labels for the relevant functions/objects. */
617 /* Write the extra assembler code needed to declare a function properly.
618 Some svr4 assemblers need to also have something extra said about the
619 function's return value. We allow for that here. */
621 extern int rs6000_pic_labelno;
623 /* Override elfos.h definition. */
624 #undef ASM_DECLARE_FUNCTION_NAME
625 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
626 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
628 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
629 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
631 #define LOCAL_LABEL_PREFIX "."
632 #define USER_LABEL_PREFIX ""
634 /* svr4.h overrides (*targetm.asm_out.internal_label). */
636 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
637 asm_fprintf (FILE, "%L%s", PREFIX)
639 /* Globalizing directive for a label. */
640 #define GLOBAL_ASM_OP "\t.globl "
642 /* This says how to output assembler code to declare an
643 uninitialized internal linkage data object. Under SVR4,
644 the linker seems to want the alignment of data objects
645 to depend on their types. We do exactly that here. */
647 #define LOCAL_ASM_OP "\t.local\t"
649 #define LCOMM_ASM_OP "\t.lcomm\t"
651 /* Override elfos.h definition. */
652 #undef ASM_OUTPUT_ALIGNED_LOCAL
653 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
654 do { \
655 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
656 && (SIZE) <= g_switch_value) \
658 sbss_section (); \
659 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
660 ASM_OUTPUT_LABEL (FILE, NAME); \
661 ASM_OUTPUT_SKIP (FILE, SIZE); \
662 if (!flag_inhibit_size_directive && (SIZE) > 0) \
663 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
665 else \
667 fprintf (FILE, "%s", LCOMM_ASM_OP); \
668 assemble_name ((FILE), (NAME)); \
669 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
670 (SIZE), (ALIGN) / BITS_PER_UNIT); \
672 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
673 } while (0)
675 /* Describe how to emit uninitialized external linkage items. */
676 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
677 do { \
678 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
679 } while (0)
681 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
682 /* To support -falign-* switches we need to use .p2align so
683 that alignment directives in code sections will be padded
684 with no-op instructions, rather than zeroes. */
685 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
686 if ((LOG) != 0) \
688 if ((MAX_SKIP) == 0) \
689 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
690 else \
691 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
693 #endif
695 /* This is how to output code to push a register on the stack.
696 It need not be very fast code.
698 On the rs6000, we must keep the backchain up to date. In order
699 to simplify things, always allocate 16 bytes for a push (System V
700 wants to keep stack aligned to a 16 byte boundary). */
702 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
703 do { \
704 if (DEFAULT_ABI == ABI_V4) \
705 asm_fprintf (FILE, \
706 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
707 reg_names[1], reg_names[1], reg_names[REGNO], \
708 reg_names[1]); \
709 } while (0)
711 /* This is how to output an insn to pop a register from the stack.
712 It need not be very fast code. */
714 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
715 do { \
716 if (DEFAULT_ABI == ABI_V4) \
717 asm_fprintf (FILE, \
718 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
719 reg_names[REGNO], reg_names[1], reg_names[1], \
720 reg_names[1]); \
721 } while (0)
723 /* Switch Recognition by gcc.c. Add -G xx support. */
725 /* Override svr4.h definition. */
726 #undef SWITCH_TAKES_ARG
727 #define SWITCH_TAKES_ARG(CHAR) \
728 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
729 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
730 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
731 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
732 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
734 extern int fixuplabelno;
736 /* Handle constructors specially for -mrelocatable. */
737 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
738 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
740 /* This is the end of what might become sysv4.h. */
742 /* Use DWARF 2 debugging information by default. */
743 #undef PREFERRED_DEBUGGING_TYPE
744 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
746 /* Historically we have also supported stabs debugging. */
747 #define DBX_DEBUGGING_INFO 1
749 #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
751 /* Map register numbers held in the call frame info that gcc has
752 collected using DWARF_FRAME_REGNUM to those that should be output in
753 .debug_frame and .eh_frame. We continue to use gcc hard reg numbers
754 for .eh_frame, but use the numbers mandated by the various ABIs for
755 .debug_frame. rs6000_emit_prologue has translated any combination of
756 CR2, CR3, CR4 saves to a save of CR2. The actual code emitted saves
757 the whole of CR, so we map CR2_REGNO to the DWARF reg for CR. */
758 #define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) \
759 ((FOR_EH) ? (REGNO) \
760 : (REGNO) == CR2_REGNO ? 64 \
761 : DBX_REGISTER_NUMBER (REGNO))
763 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
764 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
765 #define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags
767 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
769 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
770 assemble_name (FILE, NAME)
772 /* We have to output the stabs for the function name *first*, before
773 outputting its label. */
775 #define DBX_FUNCTION_FIRST
777 /* This is the end of what might become sysv4dbx.h. */
779 #ifndef TARGET_VERSION
780 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
781 #endif
783 #define TARGET_OS_SYSV_CPP_BUILTINS() \
784 do \
786 if (flag_pic == 1) \
788 builtin_define ("__pic__=1"); \
789 builtin_define ("__PIC__=1"); \
791 else if (flag_pic == 2) \
793 builtin_define ("__pic__=2"); \
794 builtin_define ("__PIC__=2"); \
796 if (target_flags_explicit \
797 & MASK_RELOCATABLE) \
798 builtin_define ("_RELOCATABLE"); \
800 while (0)
802 #ifndef TARGET_OS_CPP_BUILTINS
803 #define TARGET_OS_CPP_BUILTINS() \
804 do \
806 builtin_define_std ("PPC"); \
807 builtin_define_std ("unix"); \
808 builtin_define ("__svr4__"); \
809 builtin_assert ("system=unix"); \
810 builtin_assert ("system=svr4"); \
811 builtin_assert ("cpu=powerpc"); \
812 builtin_assert ("machine=powerpc"); \
813 TARGET_OS_SYSV_CPP_BUILTINS (); \
815 while (0)
816 #endif
818 /* Pass various options to the assembler. */
819 /* Override svr4.h definition. */
820 #undef ASM_SPEC
821 #define ASM_SPEC "%(asm_cpu) \
822 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
823 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
824 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
825 %{memb|msdata|msdata=eabi: -memb} \
826 %{mlittle|mlittle-endian:-mlittle; \
827 mbig|mbig-endian :-mbig; \
828 mcall-aixdesc | \
829 mcall-freebsd | \
830 mcall-netbsd | \
831 mcall-openbsd | \
832 mcall-linux | \
833 mcall-gnu :-mbig; \
834 mcall-i960-old :-mlittle}"
836 #define CC1_ENDIAN_BIG_SPEC ""
838 #define CC1_ENDIAN_LITTLE_SPEC "\
839 %{!mstrict-align: %{!mno-strict-align: \
840 %{!mcall-i960-old: \
841 -mstrict-align \
845 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
847 /* Pass -G xxx to the compiler and set correct endian mode. */
848 #define CC1_SPEC "%{G*} \
849 %{mlittle|mlittle-endian: %(cc1_endian_little); \
850 mbig |mbig-endian : %(cc1_endian_big); \
851 mcall-aixdesc | \
852 mcall-freebsd | \
853 mcall-netbsd | \
854 mcall-openbsd | \
855 mcall-linux | \
856 mcall-gnu : -mbig %(cc1_endian_big); \
857 mcall-i960-old : -mlittle %(cc1_endian_little); \
858 : %(cc1_endian_default)} \
859 %{mno-sdata: -msdata=none } \
860 %{meabi: %{!mcall-*: -mcall-sysv }} \
861 %{!meabi: %{!mno-eabi: \
862 %{mrelocatable: -meabi } \
863 %{mcall-freebsd: -mno-eabi } \
864 %{mcall-i960-old: -meabi } \
865 %{mcall-linux: -mno-eabi } \
866 %{mcall-gnu: -mno-eabi } \
867 %{mcall-netbsd: -mno-eabi } \
868 %{mcall-openbsd: -mno-eabi }}} \
869 %{msdata: -msdata=default} \
870 %{mno-sdata: -msdata=none} \
871 %{profile: -p}"
873 /* Don't put -Y P,<path> for cross compilers. */
874 #ifndef CROSS_COMPILE
875 #define LINK_PATH_SPEC "\
876 %{!R*:%{L*:-R %*}} \
877 %{!nostdlib: %{!YP,*: \
878 %{compat-bsd: \
879 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
880 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
881 %{!R*: %{!L*: -R /usr/ucblib}} \
882 %{!compat-bsd: \
883 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
884 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
886 #else
887 #define LINK_PATH_SPEC ""
888 #endif
890 /* Default starting address if specified. */
891 #define LINK_START_SPEC "\
892 %{mads : %(link_start_ads) ; \
893 myellowknife : %(link_start_yellowknife) ; \
894 mmvme : %(link_start_mvme) ; \
895 msim : %(link_start_sim) ; \
896 mwindiss : %(link_start_windiss) ; \
897 mcall-freebsd: %(link_start_freebsd) ; \
898 mcall-linux : %(link_start_linux) ; \
899 mcall-gnu : %(link_start_gnu) ; \
900 mcall-netbsd : %(link_start_netbsd) ; \
901 mcall-openbsd: %(link_start_openbsd) ; \
902 : %(link_start_default) }"
904 #define LINK_START_DEFAULT_SPEC ""
906 /* Override svr4.h definition. */
907 #undef LINK_SPEC
908 #define LINK_SPEC "\
909 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
910 %{YP,*} %{R*} \
911 %{Qy:} %{!Qn:-Qy} \
912 %(link_shlib) \
913 %{!Wl,-T*: %{!T*: %(link_start) }} \
914 %(link_target) \
915 %(link_os)"
917 /* For now, turn off shared libraries by default. */
918 #ifndef SHARED_LIB_SUPPORT
919 #define NO_SHARED_LIB_SUPPORT
920 #endif
922 #ifndef NO_SHARED_LIB_SUPPORT
923 /* Shared libraries are default. */
924 #define LINK_SHLIB_SPEC "\
925 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
926 %{mshlib: } \
927 %{static:-dn -Bstatic} \
928 %{shared:-G -dy -z text} \
929 %{symbolic:-Bsymbolic -G -dy -z text}"
931 #else
932 /* Shared libraries are not default. */
933 #define LINK_SHLIB_SPEC "\
934 %{mshlib: %(link_path) } \
935 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
936 %{static: } \
937 %{shared:-G -dy -z text %(link_path) } \
938 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
939 #endif
941 /* Override the default target of the linker. */
942 #define LINK_TARGET_SPEC "\
943 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
944 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
945 %{mcall-i960-old: --oformat elf32-powerpcle} \
946 }}}}"
948 /* Any specific OS flags. */
949 #define LINK_OS_SPEC "\
950 %{mads : %(link_os_ads) ; \
951 myellowknife : %(link_os_yellowknife) ; \
952 mmvme : %(link_os_mvme) ; \
953 msim : %(link_os_sim) ; \
954 mwindiss : %(link_os_windiss) ; \
955 mcall-freebsd: %(link_os_freebsd) ; \
956 mcall-linux : %(link_os_linux) ; \
957 mcall-gnu : %(link_os_gnu) ; \
958 mcall-netbsd : %(link_os_netbsd) ; \
959 mcall-openbsd: %(link_os_openbsd) ; \
960 : %(link_os_default) }"
962 #define LINK_OS_DEFAULT_SPEC ""
964 /* Override rs6000.h definition. */
965 #undef CPP_SPEC
966 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
967 %{mads : %(cpp_os_ads) ; \
968 myellowknife : %(cpp_os_yellowknife) ; \
969 mmvme : %(cpp_os_mvme) ; \
970 msim : %(cpp_os_sim) ; \
971 mwindiss : %(cpp_os_windiss) ; \
972 mcall-freebsd: %(cpp_os_freebsd) ; \
973 mcall-linux : %(cpp_os_linux) ; \
974 mcall-gnu : %(cpp_os_gnu) ; \
975 mcall-netbsd : %(cpp_os_netbsd) ; \
976 mcall-openbsd: %(cpp_os_openbsd) ; \
977 : %(cpp_os_default) }"
979 #define CPP_OS_DEFAULT_SPEC ""
981 /* Override svr4.h definition. */
982 #undef STARTFILE_SPEC
983 #define STARTFILE_SPEC "\
984 %{mads : %(startfile_ads) ; \
985 myellowknife : %(startfile_yellowknife) ; \
986 mmvme : %(startfile_mvme) ; \
987 msim : %(startfile_sim) ; \
988 mwindiss : %(startfile_windiss) ; \
989 mcall-freebsd: %(startfile_freebsd) ; \
990 mcall-linux : %(startfile_linux) ; \
991 mcall-gnu : %(startfile_gnu) ; \
992 mcall-netbsd : %(startfile_netbsd) ; \
993 mcall-openbsd: %(startfile_openbsd) ; \
994 : %(startfile_default) }"
996 #define STARTFILE_DEFAULT_SPEC ""
998 /* Override svr4.h definition. */
999 #undef LIB_SPEC
1000 #define LIB_SPEC "\
1001 %{mads : %(lib_ads) ; \
1002 myellowknife : %(lib_yellowknife) ; \
1003 mmvme : %(lib_mvme) ; \
1004 msim : %(lib_sim) ; \
1005 mwindiss : %(lib_windiss) ; \
1006 mcall-freebsd: %(lib_freebsd) ; \
1007 mcall-linux : %(lib_linux) ; \
1008 mcall-gnu : %(lib_gnu) ; \
1009 mcall-netbsd : %(lib_netbsd) ; \
1010 mcall-openbsd: %(lib_openbsd) ; \
1011 : %(lib_default) }"
1013 #define LIB_DEFAULT_SPEC ""
1015 /* Override svr4.h definition. */
1016 #undef ENDFILE_SPEC
1017 #define ENDFILE_SPEC "\
1018 %{mads : crtsavres.o%s %(endfile_ads) ; \
1019 myellowknife : crtsavres.o%s %(endfile_yellowknife) ; \
1020 mmvme : crtsavres.o%s %(endfile_mvme) ; \
1021 msim : crtsavres.o%s %(endfile_sim) ; \
1022 mwindiss : %(endfile_windiss) ; \
1023 mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \
1024 mcall-linux : crtsavres.o%s %(endfile_linux) ; \
1025 mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \
1026 mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \
1027 mcall-openbsd: crtsavres.o%s %(endfile_openbsd) ; \
1028 : %(crtsavres_default) %(endfile_default) }"
1030 #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
1032 #define ENDFILE_DEFAULT_SPEC ""
1034 /* Motorola ADS support. */
1035 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1037 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1039 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
1041 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1043 #define LINK_OS_ADS_SPEC ""
1045 #define CPP_OS_ADS_SPEC ""
1047 /* Motorola Yellowknife support. */
1048 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1050 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1052 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
1054 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1056 #define LINK_OS_YELLOWKNIFE_SPEC ""
1058 #define CPP_OS_YELLOWKNIFE_SPEC ""
1060 /* Motorola MVME support. */
1061 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1063 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1065 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
1067 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
1069 #define LINK_OS_MVME_SPEC ""
1071 #define CPP_OS_MVME_SPEC ""
1073 /* PowerPC simulator based on netbsd system calls support. */
1074 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1076 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
1078 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
1080 #define LINK_START_SIM_SPEC ""
1082 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
1084 #define CPP_OS_SIM_SPEC ""
1086 /* FreeBSD support. */
1088 #define CPP_OS_FREEBSD_SPEC "\
1089 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
1090 -Acpu=powerpc -Amachine=powerpc"
1092 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
1093 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
1094 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
1095 #define LINK_START_FREEBSD_SPEC ""
1097 #define LINK_OS_FREEBSD_SPEC "\
1098 %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
1099 %{Wl,*:%*} \
1100 %{v:-V} \
1101 %{assert*} %{R*} %{rpath*} %{defsym*} \
1102 %{shared:-Bshareable %{h*} %{soname*}} \
1103 %{!shared: \
1104 %{!static: \
1105 %{rdynamic: -export-dynamic} \
1106 %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
1107 %{static:-Bstatic}} \
1108 %{symbolic:-Bsymbolic}"
1110 /* GNU/Linux support. */
1111 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1112 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
1113 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
1115 #ifdef HAVE_LD_PIE
1116 #define STARTFILE_LINUX_SPEC "\
1117 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
1118 %{mnewlib:ecrti.o%s;:crti.o%s} \
1119 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1120 #else
1121 #define STARTFILE_LINUX_SPEC "\
1122 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
1123 %{mnewlib:ecrti.o%s;:crti.o%s} \
1124 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1125 #endif
1127 #define ENDFILE_LINUX_SPEC "\
1128 %{shared|pie:crtendS.o%s;:crtend.o%s} \
1129 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
1131 #define LINK_START_LINUX_SPEC ""
1133 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1134 %{rdynamic:-export-dynamic} \
1135 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1137 #if defined(HAVE_LD_EH_FRAME_HDR)
1138 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1139 #endif
1141 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1142 %{!undef: \
1143 %{!ansi: \
1144 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1145 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1146 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1148 /* GNU/Hurd support. */
1149 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
1150 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1151 %{profile:-lc_p} %{!profile:-lc}}}"
1153 #define STARTFILE_GNU_SPEC "\
1154 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
1155 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1156 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1157 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1159 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1160 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1162 #define LINK_START_GNU_SPEC ""
1164 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1165 %{rdynamic:-export-dynamic} \
1166 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1168 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
1169 %{!undef: \
1170 %{!ansi: -Dunix -D__unix}} \
1171 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1173 /* NetBSD support. */
1174 #define LIB_NETBSD_SPEC "\
1175 %{profile:-lgmon -lc_p} %{!profile:-lc}"
1177 #define STARTFILE_NETBSD_SPEC "\
1178 ncrti.o%s crt0.o%s \
1179 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1181 #define ENDFILE_NETBSD_SPEC "\
1182 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1183 ncrtn.o%s"
1185 #define LINK_START_NETBSD_SPEC "\
1188 #define LINK_OS_NETBSD_SPEC "\
1189 %{!shared: %{!static: \
1190 %{rdynamic:-export-dynamic} \
1191 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
1193 #define CPP_OS_NETBSD_SPEC "\
1194 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
1196 /* OpenBSD support. */
1197 #ifndef LIB_OPENBSD_SPEC
1198 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
1199 #endif
1201 #ifndef STARTFILE_OPENBSD_SPEC
1202 #define STARTFILE_OPENBSD_SPEC "\
1203 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1204 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1205 #endif
1207 #ifndef ENDFILE_OPENBSD_SPEC
1208 #define ENDFILE_OPENBSD_SPEC "\
1209 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
1210 #endif
1212 #ifndef LINK_START_OPENBSD_SPEC
1213 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
1214 #endif
1216 #ifndef LINK_OS_OPENBSD_SPEC
1217 #define LINK_OS_OPENBSD_SPEC ""
1218 #endif
1220 #ifndef CPP_OS_OPENBSD_SPEC
1221 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
1222 #endif
1224 /* WindISS support. */
1226 #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
1228 #define CPP_OS_WINDISS_SPEC "\
1229 -D__rtasim \
1230 -D__EABI__ \
1231 -D__ppc \
1232 %{!msoft-float: -D__hardfp} \
1235 #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1237 #define ENDFILE_WINDISS_SPEC "crtend.o%s"
1239 #define LINK_START_WINDISS_SPEC ""
1241 #define LINK_OS_WINDISS_SPEC ""
1243 /* Define any extra SPECS that the compiler needs to generate. */
1244 /* Override rs6000.h definition. */
1245 #undef SUBTARGET_EXTRA_SPECS
1246 #define SUBTARGET_EXTRA_SPECS \
1247 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
1248 { "lib_ads", LIB_ADS_SPEC }, \
1249 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1250 { "lib_mvme", LIB_MVME_SPEC }, \
1251 { "lib_sim", LIB_SIM_SPEC }, \
1252 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
1253 { "lib_gnu", LIB_GNU_SPEC }, \
1254 { "lib_linux", LIB_LINUX_SPEC }, \
1255 { "lib_netbsd", LIB_NETBSD_SPEC }, \
1256 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
1257 { "lib_windiss", LIB_WINDISS_SPEC }, \
1258 { "lib_default", LIB_DEFAULT_SPEC }, \
1259 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1260 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1261 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1262 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1263 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
1264 { "startfile_gnu", STARTFILE_GNU_SPEC }, \
1265 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1266 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
1267 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
1268 { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \
1269 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1270 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1271 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1272 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1273 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1274 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
1275 { "endfile_gnu", ENDFILE_GNU_SPEC }, \
1276 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1277 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
1278 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
1279 { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \
1280 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1281 { "link_path", LINK_PATH_SPEC }, \
1282 { "link_shlib", LINK_SHLIB_SPEC }, \
1283 { "link_target", LINK_TARGET_SPEC }, \
1284 { "link_start", LINK_START_SPEC }, \
1285 { "link_start_ads", LINK_START_ADS_SPEC }, \
1286 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1287 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1288 { "link_start_sim", LINK_START_SIM_SPEC }, \
1289 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
1290 { "link_start_gnu", LINK_START_GNU_SPEC }, \
1291 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1292 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
1293 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
1294 { "link_start_windiss", LINK_START_WINDISS_SPEC }, \
1295 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1296 { "link_os", LINK_OS_SPEC }, \
1297 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1298 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1299 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1300 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1301 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
1302 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1303 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
1304 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
1305 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
1306 { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
1307 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1308 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1309 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1310 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1311 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1312 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1313 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1314 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1315 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
1316 { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
1317 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1318 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
1319 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
1320 { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \
1321 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
1322 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
1323 SUBSUBTARGET_EXTRA_SPECS
1325 #define SUBSUBTARGET_EXTRA_SPECS
1327 /* Define this macro as a C expression for the initializer of an
1328 array of string to tell the driver program which options are
1329 defaults for this target and thus do not need to be handled
1330 specially when using `MULTILIB_OPTIONS'.
1332 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1333 the target makefile fragment or if none of the options listed in
1334 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1336 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1338 /* Define this macro if the code for function profiling should come
1339 before the function prologue. Normally, the profiling code comes
1340 after. */
1341 #define PROFILE_BEFORE_PROLOGUE 1
1343 /* Function name to call to do profiling. */
1344 #define RS6000_MCOUNT "_mcount"
1346 /* Define this macro (to a value of 1) if you want to support the
1347 Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1348 pack(pop)'. The pack(push,<n>) pragma specifies the maximum
1349 alignment (in bytes) of fields within a structure, in much the
1350 same way as the __aligned__' and __packed__' __attribute__'s
1351 do. A pack value of zero resets the behavior to the default.
1352 Successive invocations of this pragma cause the previous values to
1353 be stacked, so that invocations of #pragma pack(pop)' will return
1354 to the previous value. */
1356 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
1358 /* Select a format to encode pointers in exception handling data. CODE
1359 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1360 true if the symbol may be affected by dynamic relocations. */
1361 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1362 ((flag_pic || TARGET_RELOCATABLE) \
1363 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1364 : DW_EH_PE_absptr)
1366 #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section
1368 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1370 /* Generate entries in .fixup for relocatable addresses. */
1371 #define RELOCATABLE_NEEDS_FIXUP 1