OSDN Git Service

* config/alpha/alpha.c (alpha_start_function): Use switch_to_section.
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / sysv4.h
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.
5
6    This file is part of GCC.
7
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.
12
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.
17
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, 51 Franklin Street, Fifth Floor, Boston,
21    MA 02110-1301, USA.  */
22
23 /* Header files should be C++ aware in general.  */
24 #undef  NO_IMPLICIT_EXTERN_C
25 #define NO_IMPLICIT_EXTERN_C
26
27 /* Yes!  We are ELF.  */
28 #define TARGET_OBJECT_FORMAT OBJECT_ELF
29
30 /* Default ABI to compile code for.  */
31 #define DEFAULT_ABI rs6000_current_abi
32
33 /* Default ABI to use.  */
34 #define RS6000_ABI_NAME "sysv"
35
36 /* Override rs6000.h definition.  */
37 #undef  ASM_DEFAULT_SPEC
38 #define ASM_DEFAULT_SPEC "-mppc"
39
40 /* Small data support types.  */
41 enum rs6000_sdata_type {
42   SDATA_NONE,                   /* No small data support.  */
43   SDATA_DATA,                   /* Just put data in .sbss/.sdata, don't use relocs.  */
44   SDATA_SYSV,                   /* Use r13 to point to .sdata/.sbss.  */
45   SDATA_EABI                    /* Use r13 like above, r2 points to .sdata2/.sbss2.  */
46 };
47
48 extern enum rs6000_sdata_type rs6000_sdata;
49
50 #define TARGET_TOC              ((target_flags & MASK_64BIT)            \
51                                  || ((target_flags & (MASK_RELOCATABLE  \
52                                                       | MASK_MINIMAL_TOC)) \
53                                      && flag_pic > 1)                   \
54                                  || DEFAULT_ABI == ABI_AIX)
55
56 #define TARGET_BITFIELD_TYPE    (! TARGET_NO_BITFIELD_TYPE)
57 #define TARGET_BIG_ENDIAN       (! TARGET_LITTLE_ENDIAN)
58 #define TARGET_NO_PROTOTYPE     (! TARGET_PROTOTYPE)
59 #define TARGET_NO_TOC           (! TARGET_TOC)
60 #define TARGET_NO_EABI          (! TARGET_EABI)
61
62 #ifdef HAVE_AS_REL16
63 #undef TARGET_SECURE_PLT
64 #define TARGET_SECURE_PLT       secure_plt
65 #endif
66
67 extern const char *rs6000_abi_name;
68 extern const char *rs6000_sdata_name;
69 extern const char *rs6000_tls_size_string; /* For -mtls-size= */
70
71 #define SDATA_DEFAULT_SIZE 8
72
73 /* Sometimes certain combinations of command options do not make sense
74    on a particular target machine.  You can define a macro
75    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
76    defined, is executed once just after all the command options have
77    been parsed.
78
79    The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
80    get control.  */
81
82 #define SUBTARGET_OVERRIDE_OPTIONS                                      \
83 do {                                                                    \
84   if (!g_switch_set)                                                    \
85     g_switch_value = SDATA_DEFAULT_SIZE;                                \
86                                                                         \
87   if (rs6000_abi_name == NULL)                                          \
88     rs6000_abi_name = RS6000_ABI_NAME;                                  \
89                                                                         \
90   if (!strcmp (rs6000_abi_name, "sysv"))                                \
91     rs6000_current_abi = ABI_V4;                                        \
92   else if (!strcmp (rs6000_abi_name, "sysv-noeabi"))                    \
93     {                                                                   \
94       rs6000_current_abi = ABI_V4;                                      \
95       target_flags &= ~ MASK_EABI;                                      \
96     }                                                                   \
97   else if (!strcmp (rs6000_abi_name, "sysv-eabi")                       \
98            || !strcmp (rs6000_abi_name, "eabi"))                        \
99     {                                                                   \
100       rs6000_current_abi = ABI_V4;                                      \
101       target_flags |= MASK_EABI;                                        \
102     }                                                                   \
103   else if (!strcmp (rs6000_abi_name, "aixdesc"))                        \
104     rs6000_current_abi = ABI_AIX;                                       \
105   else if (!strcmp (rs6000_abi_name, "freebsd"))                        \
106     rs6000_current_abi = ABI_V4;                                        \
107   else if (!strcmp (rs6000_abi_name, "linux"))                          \
108     {                                                                   \
109       if (TARGET_64BIT)                                                 \
110         rs6000_current_abi = ABI_AIX;                                   \
111       else                                                              \
112         rs6000_current_abi = ABI_V4;                                    \
113     }                                                                   \
114   else if (!strcmp (rs6000_abi_name, "gnu"))                            \
115     rs6000_current_abi = ABI_V4;                                        \
116   else if (!strcmp (rs6000_abi_name, "netbsd"))                         \
117     rs6000_current_abi = ABI_V4;                                        \
118   else if (!strcmp (rs6000_abi_name, "openbsd"))                        \
119     rs6000_current_abi = ABI_V4;                                        \
120   else if (!strcmp (rs6000_abi_name, "i960-old"))                       \
121     {                                                                   \
122       rs6000_current_abi = ABI_V4;                                      \
123       target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI                   \
124                        | MASK_NO_BITFIELD_WORD);                        \
125       target_flags &= ~MASK_STRICT_ALIGN;                               \
126     }                                                                   \
127   else                                                                  \
128     {                                                                   \
129       rs6000_current_abi = ABI_V4;                                      \
130       error ("bad value for -mcall-%s", rs6000_abi_name);               \
131     }                                                                   \
132                                                                         \
133   if (rs6000_sdata_name)                                                \
134     {                                                                   \
135       if (!strcmp (rs6000_sdata_name, "none"))                          \
136         rs6000_sdata = SDATA_NONE;                                      \
137       else if (!strcmp (rs6000_sdata_name, "data"))                     \
138         rs6000_sdata = SDATA_DATA;                                      \
139       else if (!strcmp (rs6000_sdata_name, "default"))                  \
140         rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV;         \
141       else if (!strcmp (rs6000_sdata_name, "sysv"))                     \
142         rs6000_sdata = SDATA_SYSV;                                      \
143       else if (!strcmp (rs6000_sdata_name, "eabi"))                     \
144         rs6000_sdata = SDATA_EABI;                                      \
145       else                                                              \
146         error ("bad value for -msdata=%s", rs6000_sdata_name);          \
147     }                                                                   \
148   else if (DEFAULT_ABI == ABI_V4)                                       \
149     {                                                                   \
150       rs6000_sdata = SDATA_DATA;                                        \
151       rs6000_sdata_name = "data";                                       \
152     }                                                                   \
153   else                                                                  \
154     {                                                                   \
155       rs6000_sdata = SDATA_NONE;                                        \
156       rs6000_sdata_name = "none";                                       \
157     }                                                                   \
158                                                                         \
159   if (TARGET_RELOCATABLE &&                                             \
160       (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV))       \
161     {                                                                   \
162       rs6000_sdata = SDATA_DATA;                                        \
163       error ("-mrelocatable and -msdata=%s are incompatible",           \
164              rs6000_sdata_name);                                        \
165     }                                                                   \
166                                                                         \
167   else if (flag_pic && DEFAULT_ABI != ABI_AIX                           \
168            && (rs6000_sdata == SDATA_EABI                               \
169                || rs6000_sdata == SDATA_SYSV))                          \
170     {                                                                   \
171       rs6000_sdata = SDATA_DATA;                                        \
172       error ("-f%s and -msdata=%s are incompatible",                    \
173              (flag_pic > 1) ? "PIC" : "pic",                            \
174              rs6000_sdata_name);                                        \
175     }                                                                   \
176                                                                         \
177   if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4)             \
178       || (rs6000_sdata == SDATA_EABI && !TARGET_EABI))                  \
179     {                                                                   \
180       rs6000_sdata = SDATA_NONE;                                        \
181       error ("-msdata=%s and -mcall-%s are incompatible",               \
182              rs6000_sdata_name, rs6000_abi_name);                       \
183     }                                                                   \
184                                                                         \
185   targetm.have_srodata_section = rs6000_sdata == SDATA_EABI;            \
186                                                                         \
187   if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC)                        \
188     {                                                                   \
189       target_flags |= MASK_MINIMAL_TOC;                                 \
190       error ("-mrelocatable and -mno-minimal-toc are incompatible");    \
191     }                                                                   \
192                                                                         \
193   if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX)              \
194     {                                                                   \
195       target_flags &= ~MASK_RELOCATABLE;                                \
196       error ("-mrelocatable and -mcall-%s are incompatible",            \
197              rs6000_abi_name);                                          \
198     }                                                                   \
199                                                                         \
200   if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX)   \
201     {                                                                   \
202       flag_pic = 0;                                                     \
203       error ("-fPIC and -mcall-%s are incompatible",                    \
204              rs6000_abi_name);                                          \
205     }                                                                   \
206                                                                         \
207   if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN)            \
208     {                                                                   \
209       target_flags &= ~MASK_LITTLE_ENDIAN;                              \
210       error ("-mcall-aixdesc must be big endian");                      \
211     }                                                                   \
212                                                                         \
213   if (TARGET_SECURE_PLT != secure_plt)                                  \
214     {                                                                   \
215       error ("-msecure-plt not supported by your assembler");           \
216     }                                                                   \
217                                                                         \
218   /* Treat -fPIC the same as -mrelocatable.  */                         \
219   if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX)                           \
220     target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
221                                                                         \
222   else if (TARGET_RELOCATABLE)                                          \
223     flag_pic = 2;                                                       \
224 } while (0)
225
226 #ifndef RS6000_BI_ARCH
227 # define SUBSUBTARGET_OVERRIDE_OPTIONS                                  \
228 do {                                                                    \
229   if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT)                     \
230     error ("-m%s not supported in this configuration",                  \
231            (target_flags & MASK_64BIT) ? "64" : "32");                  \
232 } while (0)
233 #endif
234
235 /* Override rs6000.h definition.  */
236 #undef  TARGET_DEFAULT
237 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
238
239 /* Override rs6000.h definition.  */
240 #undef  PROCESSOR_DEFAULT
241 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
242
243 /* SVR4 only defined for PowerPC, so short-circuit POWER patterns.  */
244 #undef  TARGET_POWER
245 #define TARGET_POWER 0
246
247 #define FIXED_R2 1
248 /* System V.4 uses register 13 as a pointer to the small data area,
249    so it is not available to the normal user.  */
250 #define FIXED_R13 1
251
252 /* Override default big endianism definitions in rs6000.h.  */
253 #undef  BYTES_BIG_ENDIAN
254 #undef  WORDS_BIG_ENDIAN
255 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
256 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
257
258 /* Define this to set the endianness to use in libgcc2.c, which can
259    not depend on target_flags.  */
260 #if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
261 #define LIBGCC2_WORDS_BIG_ENDIAN 1
262 #else
263 #define LIBGCC2_WORDS_BIG_ENDIAN 0
264 #endif
265
266 /* Define cutoff for using external functions to save floating point.
267    Currently on V.4, always use inline stores.  */
268 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
269
270 /* Put jump tables in read-only memory, rather than in .text.  */
271 #define JUMP_TABLES_IN_TEXT_SECTION 0
272
273 /* Prefix and suffix to use to saving floating point.  */
274 #define SAVE_FP_PREFIX "_savefpr_"
275 #define SAVE_FP_SUFFIX "_l"
276
277 /* Prefix and suffix to use to restoring floating point.  */
278 #define RESTORE_FP_PREFIX "_restfpr_"
279 #define RESTORE_FP_SUFFIX "_l"
280
281 /* Type used for ptrdiff_t, as a string used in a declaration.  */
282 #define PTRDIFF_TYPE "int"
283
284 /* Type used for wchar_t, as a string used in a declaration.  */
285 /* Override svr4.h definition.  */
286 #undef  WCHAR_TYPE
287 #define WCHAR_TYPE "long int"
288
289 /* Width of wchar_t in bits.  */
290 /* Override svr4.h definition.  */
291 #undef  WCHAR_TYPE_SIZE
292 #define WCHAR_TYPE_SIZE 32
293
294 /* Make int foo : 8 not cause structures to be aligned to an int boundary.  */
295 /* Override elfos.h definition.  */
296 #undef  PCC_BITFIELD_TYPE_MATTERS
297 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
298
299 #undef  BITFIELD_NBYTES_LIMITED
300 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
301
302 /* Define this macro to be the value 1 if instructions will fail to
303    work if given data not on the nominal alignment.  If instructions
304    will merely go slower in that case, define this macro as 0.  */
305 #undef  STRICT_ALIGNMENT
306 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
307
308 /* Define this macro if you wish to preserve a certain alignment for
309    the stack pointer, greater than what the hardware enforces.  The
310    definition is a C expression for the desired alignment (measured
311    in bits).  This macro must evaluate to a value equal to or larger
312    than STACK_BOUNDARY.
313    For the SYSV ABI and variants the alignment of the stack pointer
314    is usually controlled manually in rs6000.c. However, to maintain
315    alignment across alloca () in all circumstances,
316    PREFERRED_STACK_BOUNDARY needs to be set as well.
317    This has the additional advantage of allowing a bigger maximum
318    alignment of user objects on the stack.  */
319
320 #undef PREFERRED_STACK_BOUNDARY
321 #define PREFERRED_STACK_BOUNDARY 128
322
323 /* Real stack boundary as mandated by the appropriate ABI.  */
324 #define ABI_STACK_BOUNDARY \
325   ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
326
327 /* An expression for the alignment of a structure field FIELD if the
328    alignment computed in the usual way is COMPUTED.  */
329 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)                                   \
330         ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
331          ? 128 : COMPUTED)
332
333 #undef  BIGGEST_FIELD_ALIGNMENT
334
335 /* Use ELF style section commands.  */
336
337 #define TEXT_SECTION_ASM_OP     "\t.section\t\".text\""
338
339 #define DATA_SECTION_ASM_OP     "\t.section\t\".data\""
340
341 #define BSS_SECTION_ASM_OP      "\t.section\t\".bss\""
342
343 /* Override elfos.h definition.  */
344 #undef  INIT_SECTION_ASM_OP
345 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
346
347 /* Override elfos.h definition.  */
348 #undef  FINI_SECTION_ASM_OP
349 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
350
351 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
352
353 /* Put PC relative got entries in .got2.  */
354 #define MINIMAL_TOC_SECTION_ASM_OP \
355   (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX)           \
356    ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
357
358 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
359 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
360 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
361
362 /* Override default elf definitions.  */
363 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
364 #undef  TARGET_ASM_SELECT_RTX_SECTION
365 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
366 #undef  TARGET_ASM_SELECT_SECTION
367 #define TARGET_ASM_SELECT_SECTION  rs6000_elf_select_section
368 #define TARGET_ASM_UNIQUE_SECTION  rs6000_elf_unique_section
369
370 /* Return nonzero if this entry is to be written into the constant pool
371    in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
372    containing one of them.  If -mfp-in-toc (the default), we also do
373    this for floating-point constants.  We actually can only do this
374    if the FP formats of the target and host machines are the same, but
375    we can't check that since not every file that uses
376    GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
377
378    Unlike AIX, we don't key off of -mminimal-toc, but instead do not
379    allow floating point constants in the TOC if -mrelocatable.  */
380
381 #undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
382 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)                        \
383   (TARGET_TOC                                                           \
384    && (GET_CODE (X) == SYMBOL_REF                                       \
385        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS      \
386            && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)           \
387        || GET_CODE (X) == LABEL_REF                                     \
388        || (GET_CODE (X) == CONST_INT                                    \
389            && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))      \
390        || (!TARGET_NO_FP_IN_TOC                                         \
391            && !TARGET_RELOCATABLE                                       \
392            && GET_CODE (X) == CONST_DOUBLE                              \
393            && SCALAR_FLOAT_MODE_P (GET_MODE (X))                        \
394            && BITS_PER_WORD == HOST_BITS_PER_INT)))
395
396 /* These macros generate the special .type and .size directives which
397    are used to set the corresponding fields of the linker symbol table
398    entries in an ELF object file under SVR4.  These macros also output
399    the starting labels for the relevant functions/objects.  */
400
401 /* Write the extra assembler code needed to declare a function properly.
402    Some svr4 assemblers need to also have something extra said about the
403    function's return value.  We allow for that here.  */
404
405 extern int rs6000_pic_labelno;
406
407 /* Override elfos.h definition.  */
408 #undef  ASM_DECLARE_FUNCTION_NAME
409 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
410   rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
411
412 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
413    flag.  The LOCAL_LABEL_PREFIX variable is used by dbxelf.h.  */
414
415 #define LOCAL_LABEL_PREFIX "."
416 #define USER_LABEL_PREFIX ""
417
418 /* svr4.h overrides (*targetm.asm_out.internal_label).  */
419
420 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)   \
421   asm_fprintf (FILE, "%L%s", PREFIX)
422
423 /* Globalizing directive for a label.  */
424 #define GLOBAL_ASM_OP "\t.globl "
425
426 /* This says how to output assembler code to declare an
427    uninitialized internal linkage data object.  Under SVR4,
428    the linker seems to want the alignment of data objects
429    to depend on their types.  We do exactly that here.  */
430
431 #define LOCAL_ASM_OP    "\t.local\t"
432
433 #define LCOMM_ASM_OP    "\t.lcomm\t"
434
435 /* Describe how to emit uninitialized local items.  */
436 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)    \
437 do {                                                                    \
438   if ((DECL) && rs6000_elf_in_small_data_p (DECL))                      \
439     {                                                                   \
440       switch_to_section (sbss_section);                                 \
441       ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));      \
442       ASM_OUTPUT_LABEL (FILE, NAME);                                    \
443       ASM_OUTPUT_SKIP (FILE, SIZE);                                     \
444       if (!flag_inhibit_size_directive && (SIZE) > 0)                   \
445         ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE);                   \
446     }                                                                   \
447   else                                                                  \
448     {                                                                   \
449       fprintf (FILE, "%s", LCOMM_ASM_OP);                               \
450       assemble_name ((FILE), (NAME));                                   \
451       fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",          \
452                (SIZE), (ALIGN) / BITS_PER_UNIT);                        \
453     }                                                                   \
454   ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                     \
455 } while (0)
456
457 /* Describe how to emit uninitialized external linkage items.  */
458 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)           \
459 do {                                                                    \
460   ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN);        \
461 } while (0)
462
463 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
464 /* To support -falign-* switches we need to use .p2align so
465    that alignment directives in code sections will be padded
466    with no-op instructions, rather than zeroes.  */
467 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)                    \
468   if ((LOG) != 0)                                                       \
469     {                                                                   \
470       if ((MAX_SKIP) == 0)                                              \
471         fprintf ((FILE), "\t.p2align %d\n", (LOG));                     \
472       else                                                              \
473         fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));     \
474     }
475 #endif
476
477 /* This is how to output code to push a register on the stack.
478    It need not be very fast code.
479
480    On the rs6000, we must keep the backchain up to date.  In order
481    to simplify things, always allocate 16 bytes for a push (System V
482    wants to keep stack aligned to a 16 byte boundary).  */
483
484 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO)                                \
485 do {                                                                    \
486   if (DEFAULT_ABI == ABI_V4)                                            \
487     asm_fprintf (FILE,                                                  \
488                  "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n",     \
489                  reg_names[1], reg_names[1], reg_names[REGNO],          \
490                  reg_names[1]);                                         \
491 } while (0)
492
493 /* This is how to output an insn to pop a register from the stack.
494    It need not be very fast code.  */
495
496 #define ASM_OUTPUT_REG_POP(FILE, REGNO)                                 \
497 do {                                                                    \
498   if (DEFAULT_ABI == ABI_V4)                                            \
499     asm_fprintf (FILE,                                                  \
500                  "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n",        \
501                  reg_names[REGNO], reg_names[1], reg_names[1],          \
502                  reg_names[1]);                                         \
503 } while (0)
504
505 /* Switch  Recognition by gcc.c.  Add -G xx support.  */
506
507 /* Override svr4.h definition.  */
508 #undef  SWITCH_TAKES_ARG
509 #define SWITCH_TAKES_ARG(CHAR)                                          \
510   ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o'                      \
511    || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u'                   \
512    || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x'                   \
513    || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V'                   \
514    || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
515
516 extern int fixuplabelno;
517
518 /* Handle constructors specially for -mrelocatable.  */
519 #define TARGET_ASM_CONSTRUCTOR  rs6000_elf_asm_out_constructor
520 #define TARGET_ASM_DESTRUCTOR   rs6000_elf_asm_out_destructor
521
522 /* This is the end of what might become sysv4.h.  */
523
524 /* Use DWARF 2 debugging information by default.  */
525 #undef  PREFERRED_DEBUGGING_TYPE
526 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
527
528 /* Historically we have also supported stabs debugging.  */
529 #define DBX_DEBUGGING_INFO 1
530
531 #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
532
533 /* Map register numbers held in the call frame info that gcc has
534    collected using DWARF_FRAME_REGNUM to those that should be output in
535    .debug_frame and .eh_frame.  We continue to use gcc hard reg numbers
536    for .eh_frame, but use the numbers mandated by the various ABIs for
537    .debug_frame.  rs6000_emit_prologue has translated any combination of
538    CR2, CR3, CR4 saves to a save of CR2.  The actual code emitted saves
539    the whole of CR, so we map CR2_REGNO to the DWARF reg for CR.  */
540 #define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH)     \
541   ((FOR_EH) ? (REGNO)                           \
542    : (REGNO) == CR2_REGNO ? 64                  \
543    : DBX_REGISTER_NUMBER (REGNO))
544
545 #define TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
546 #define TARGET_IN_SMALL_DATA_P  rs6000_elf_in_small_data_p
547 #define TARGET_SECTION_TYPE_FLAGS  rs6000_elf_section_type_flags
548
549 /* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
550
551 #define RS6000_OUTPUT_BASENAME(FILE, NAME)      \
552     assemble_name (FILE, NAME)
553
554 /* We have to output the stabs for the function name *first*, before
555    outputting its label.  */
556
557 #define DBX_FUNCTION_FIRST
558
559 /* This is the end of what might become sysv4dbx.h.  */
560
561 #ifndef TARGET_VERSION
562 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
563 #endif
564 \f
565 #define TARGET_OS_SYSV_CPP_BUILTINS()           \
566   do                                            \
567     {                                           \
568       if (target_flags_explicit                 \
569           & MASK_RELOCATABLE)                   \
570         builtin_define ("_RELOCATABLE");        \
571     }                                           \
572   while (0)
573
574 #ifndef TARGET_OS_CPP_BUILTINS
575 #define TARGET_OS_CPP_BUILTINS()                \
576   do                                            \
577     {                                           \
578       builtin_define_std ("PPC");               \
579       builtin_define_std ("unix");              \
580       builtin_define ("__svr4__");              \
581       builtin_assert ("system=unix");           \
582       builtin_assert ("system=svr4");           \
583       builtin_assert ("cpu=powerpc");           \
584       builtin_assert ("machine=powerpc");       \
585       TARGET_OS_SYSV_CPP_BUILTINS ();           \
586     }                                           \
587   while (0)
588 #endif
589
590 /* Pass various options to the assembler.  */
591 /* Override svr4.h definition.  */
592 #undef  ASM_SPEC
593 #define ASM_SPEC "%(asm_cpu) \
594 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
595 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
596 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
597 %{memb|msdata|msdata=eabi: -memb} \
598 %{mlittle|mlittle-endian:-mlittle; \
599   mbig|mbig-endian      :-mbig;    \
600   mcall-aixdesc |                  \
601   mcall-freebsd |                  \
602   mcall-netbsd  |                  \
603   mcall-openbsd |                  \
604   mcall-linux   |                  \
605   mcall-gnu             :-mbig;    \
606   mcall-i960-old        :-mlittle}"
607
608 #define CC1_ENDIAN_BIG_SPEC ""
609
610 #define CC1_ENDIAN_LITTLE_SPEC "\
611 %{!mstrict-align: %{!mno-strict-align: \
612     %{!mcall-i960-old: \
613         -mstrict-align \
614     } \
615 }}"
616
617 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
618
619 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
620 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
621 #endif
622
623 /* Pass -G xxx to the compiler and set correct endian mode.  */
624 #define CC1_SPEC "%{G*} \
625 %{mlittle|mlittle-endian: %(cc1_endian_little);           \
626   mbig   |mbig-endian   : %(cc1_endian_big);              \
627   mcall-aixdesc |                                         \
628   mcall-freebsd |                                         \
629   mcall-netbsd  |                                         \
630   mcall-openbsd |                                         \
631   mcall-linux   |                                         \
632   mcall-gnu             : -mbig %(cc1_endian_big);        \
633   mcall-i960-old        : -mlittle %(cc1_endian_little);  \
634                         : %(cc1_endian_default)}          \
635 %{meabi: %{!mcall-*: -mcall-sysv }} \
636 %{!meabi: %{!mno-eabi: \
637     %{mrelocatable: -meabi } \
638     %{mcall-freebsd: -mno-eabi } \
639     %{mcall-i960-old: -meabi } \
640     %{mcall-linux: -mno-eabi } \
641     %{mcall-gnu: -mno-eabi } \
642     %{mcall-netbsd: -mno-eabi } \
643     %{mcall-openbsd: -mno-eabi }}} \
644 %{msdata: -msdata=default} \
645 %{mno-sdata: -msdata=none} \
646 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
647 %{profile: -p}"
648
649 /* Don't put -Y P,<path> for cross compilers.  */
650 #ifndef CROSS_COMPILE
651 #define LINK_PATH_SPEC "\
652 %{!R*:%{L*:-R %*}} \
653 %{!nostdlib: %{!YP,*: \
654     %{compat-bsd: \
655         %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
656         %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
657         %{!R*: %{!L*: -R /usr/ucblib}} \
658     %{!compat-bsd: \
659         %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
660         %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
661
662 #else
663 #define LINK_PATH_SPEC ""
664 #endif
665
666 /* Default starting address if specified.  */
667 #define LINK_START_SPEC "\
668 %{mads         : %(link_start_ads)         ; \
669   myellowknife : %(link_start_yellowknife) ; \
670   mmvme        : %(link_start_mvme)        ; \
671   msim         : %(link_start_sim)         ; \
672   mwindiss     : %(link_start_windiss)     ; \
673   mcall-freebsd: %(link_start_freebsd)     ; \
674   mcall-linux  : %(link_start_linux)       ; \
675   mcall-gnu    : %(link_start_gnu)         ; \
676   mcall-netbsd : %(link_start_netbsd)      ; \
677   mcall-openbsd: %(link_start_openbsd)     ; \
678                : %(link_start_default)     }"
679
680 #define LINK_START_DEFAULT_SPEC ""
681
682 /* Override svr4.h definition.  */
683 #undef  LINK_SPEC
684 #define LINK_SPEC "\
685 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
686 %{YP,*} %{R*} \
687 %{Qy:} %{!Qn:-Qy} \
688 %(link_shlib) \
689 %{!Wl,-T*: %{!T*: %(link_start) }} \
690 %(link_target) \
691 %(link_os)"
692
693 /* For now, turn off shared libraries by default.  */
694 #ifndef SHARED_LIB_SUPPORT
695 #define NO_SHARED_LIB_SUPPORT
696 #endif
697
698 #ifndef NO_SHARED_LIB_SUPPORT
699 /* Shared libraries are default.  */
700 #define LINK_SHLIB_SPEC "\
701 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
702 %{mshlib: } \
703 %{static:-dn -Bstatic} \
704 %{shared:-G -dy -z text} \
705 %{symbolic:-Bsymbolic -G -dy -z text}"
706
707 #else
708 /* Shared libraries are not default.  */
709 #define LINK_SHLIB_SPEC "\
710 %{mshlib: %(link_path) } \
711 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
712 %{static: } \
713 %{shared:-G -dy -z text %(link_path) } \
714 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
715 #endif
716
717 /* Override the default target of the linker.  */
718 #define LINK_TARGET_SPEC "\
719 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
720 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
721     %{mcall-i960-old: --oformat elf32-powerpcle} \
722   }}}}"
723
724 /* Any specific OS flags.  */
725 #define LINK_OS_SPEC "\
726 %{mads         : %(link_os_ads)         ; \
727   myellowknife : %(link_os_yellowknife) ; \
728   mmvme        : %(link_os_mvme)        ; \
729   msim         : %(link_os_sim)         ; \
730   mwindiss     : %(link_os_windiss)     ; \
731   mcall-freebsd: %(link_os_freebsd)     ; \
732   mcall-linux  : %(link_os_linux)       ; \
733   mcall-gnu    : %(link_os_gnu)         ; \
734   mcall-netbsd : %(link_os_netbsd)      ; \
735   mcall-openbsd: %(link_os_openbsd)     ; \
736                : %(link_os_default)     }"
737
738 #define LINK_OS_DEFAULT_SPEC ""
739
740 /* Override rs6000.h definition.  */
741 #undef  CPP_SPEC
742 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
743 %{mads         : %(cpp_os_ads)         ; \
744   myellowknife : %(cpp_os_yellowknife) ; \
745   mmvme        : %(cpp_os_mvme)        ; \
746   msim         : %(cpp_os_sim)         ; \
747   mwindiss     : %(cpp_os_windiss)     ; \
748   mcall-freebsd: %(cpp_os_freebsd)     ; \
749   mcall-linux  : %(cpp_os_linux)       ; \
750   mcall-gnu    : %(cpp_os_gnu)         ; \
751   mcall-netbsd : %(cpp_os_netbsd)      ; \
752   mcall-openbsd: %(cpp_os_openbsd)     ; \
753                : %(cpp_os_default)     }"
754
755 #define CPP_OS_DEFAULT_SPEC ""
756
757 /* Override svr4.h definition.  */
758 #undef  STARTFILE_SPEC
759 #define STARTFILE_SPEC "\
760 %{mads         : %(startfile_ads)         ; \
761   myellowknife : %(startfile_yellowknife) ; \
762   mmvme        : %(startfile_mvme)        ; \
763   msim         : %(startfile_sim)         ; \
764   mwindiss     : %(startfile_windiss)     ; \
765   mcall-freebsd: %(startfile_freebsd)     ; \
766   mcall-linux  : %(startfile_linux)       ; \
767   mcall-gnu    : %(startfile_gnu)         ; \
768   mcall-netbsd : %(startfile_netbsd)      ; \
769   mcall-openbsd: %(startfile_openbsd)     ; \
770                : %(startfile_default)     }"
771
772 #define STARTFILE_DEFAULT_SPEC ""
773
774 /* Override svr4.h definition.  */
775 #undef  LIB_SPEC
776 #define LIB_SPEC "\
777 %{mads         : %(lib_ads)         ; \
778   myellowknife : %(lib_yellowknife) ; \
779   mmvme        : %(lib_mvme)        ; \
780   msim         : %(lib_sim)         ; \
781   mwindiss     : %(lib_windiss)     ; \
782   mcall-freebsd: %(lib_freebsd)     ; \
783   mcall-linux  : %(lib_linux)       ; \
784   mcall-gnu    : %(lib_gnu)         ; \
785   mcall-netbsd : %(lib_netbsd)      ; \
786   mcall-openbsd: %(lib_openbsd)     ; \
787                : %(lib_default)     }"
788
789 #define LIB_DEFAULT_SPEC ""
790
791 /* Override svr4.h definition.  */
792 #undef  ENDFILE_SPEC
793 #define ENDFILE_SPEC "\
794 %{mads         : crtsavres.o%s        %(endfile_ads)         ; \
795   myellowknife : crtsavres.o%s        %(endfile_yellowknife) ; \
796   mmvme        : crtsavres.o%s        %(endfile_mvme)        ; \
797   msim         : crtsavres.o%s        %(endfile_sim)         ; \
798   mwindiss     :                      %(endfile_windiss)     ; \
799   mcall-freebsd: crtsavres.o%s        %(endfile_freebsd)     ; \
800   mcall-linux  : crtsavres.o%s        %(endfile_linux)       ; \
801   mcall-gnu    : crtsavres.o%s        %(endfile_gnu)         ; \
802   mcall-netbsd : crtsavres.o%s        %(endfile_netbsd)      ; \
803   mcall-openbsd: crtsavres.o%s        %(endfile_openbsd)     ; \
804                : %(crtsavres_default) %(endfile_default)     }"
805
806 #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
807
808 #define ENDFILE_DEFAULT_SPEC ""
809
810 /* Motorola ADS support.  */
811 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
812
813 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
814
815 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
816
817 #define LINK_START_ADS_SPEC "-T ads.ld%s"
818
819 #define LINK_OS_ADS_SPEC ""
820
821 #define CPP_OS_ADS_SPEC ""
822
823 /* Motorola Yellowknife support.  */
824 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
825
826 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
827
828 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
829
830 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
831
832 #define LINK_OS_YELLOWKNIFE_SPEC ""
833
834 #define CPP_OS_YELLOWKNIFE_SPEC ""
835
836 /* Motorola MVME support.  */
837 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
838
839 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
840
841 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
842
843 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
844
845 #define LINK_OS_MVME_SPEC ""
846
847 #define CPP_OS_MVME_SPEC ""
848
849 /* PowerPC simulator based on netbsd system calls support.  */
850 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
851
852 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
853
854 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
855
856 #define LINK_START_SIM_SPEC ""
857
858 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
859
860 #define CPP_OS_SIM_SPEC ""
861
862 /* FreeBSD support.  */
863
864 #define CPP_OS_FREEBSD_SPEC     "\
865   -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
866   -Acpu=powerpc -Amachine=powerpc"
867
868 #define STARTFILE_FREEBSD_SPEC  FBSD_STARTFILE_SPEC
869 #define ENDFILE_FREEBSD_SPEC    FBSD_ENDFILE_SPEC
870 #define LIB_FREEBSD_SPEC        FBSD_LIB_SPEC
871 #define LINK_START_FREEBSD_SPEC ""
872
873 #define LINK_OS_FREEBSD_SPEC "\
874   %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
875   %{v:-V} \
876   %{assert*} %{R*} %{rpath*} %{defsym*} \
877   %{shared:-Bshareable %{h*} %{soname*}} \
878   %{!shared: \
879     %{!static: \
880       %{rdynamic: -export-dynamic} \
881       %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
882     %{static:-Bstatic}} \
883   %{symbolic:-Bsymbolic}"
884
885 /* GNU/Linux support.  */
886 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
887 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
888 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
889
890 #ifdef HAVE_LD_PIE
891 #define STARTFILE_LINUX_SPEC "\
892 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
893 %{mnewlib:ecrti.o%s;:crti.o%s} \
894 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
895 #else
896 #define STARTFILE_LINUX_SPEC "\
897 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
898 %{mnewlib:ecrti.o%s;:crti.o%s} \
899 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
900 #endif
901
902 #define ENDFILE_LINUX_SPEC "\
903 %{shared|pie:crtendS.o%s;:crtend.o%s} \
904 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
905
906 #define LINK_START_LINUX_SPEC ""
907
908 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
909   %{rdynamic:-export-dynamic} \
910   %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
911
912 #if defined(HAVE_LD_EH_FRAME_HDR)
913 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
914 #endif
915
916 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
917 %{!undef:                                                         \
918   %{!ansi:                                                        \
919     %{!std=*:-Dunix -D__unix -Dlinux -D__linux}                   \
920     %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}}               \
921 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
922
923 /* GNU/Hurd support.  */
924 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
925 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
926 %{profile:-lc_p} %{!profile:-lc}}}"
927
928 #define STARTFILE_GNU_SPEC "\
929 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
930 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
931 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
932 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
933
934 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
935 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
936
937 #define LINK_START_GNU_SPEC ""
938
939 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
940   %{rdynamic:-export-dynamic} \
941   %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
942
943 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__    \
944 %{!undef:                                                       \
945   %{!ansi: -Dunix -D__unix}}                                    \
946 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
947
948 /* NetBSD support.  */
949 #define LIB_NETBSD_SPEC "\
950 %{profile:-lgmon -lc_p} %{!profile:-lc}"
951
952 #define STARTFILE_NETBSD_SPEC "\
953 ncrti.o%s crt0.o%s \
954 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
955
956 #define ENDFILE_NETBSD_SPEC "\
957 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
958 ncrtn.o%s"
959
960 #define LINK_START_NETBSD_SPEC "\
961 "
962
963 #define LINK_OS_NETBSD_SPEC "\
964 %{!shared: %{!static: \
965   %{rdynamic:-export-dynamic} \
966   %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
967
968 #define CPP_OS_NETBSD_SPEC "\
969 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
970
971 /* OpenBSD support.  */
972 #ifndef LIB_OPENBSD_SPEC
973 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
974 #endif
975
976 #ifndef STARTFILE_OPENBSD_SPEC
977 #define STARTFILE_OPENBSD_SPEC "\
978 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
979 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
980 #endif
981
982 #ifndef ENDFILE_OPENBSD_SPEC
983 #define ENDFILE_OPENBSD_SPEC "\
984 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
985 #endif
986
987 #ifndef LINK_START_OPENBSD_SPEC
988 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
989 #endif
990
991 #ifndef LINK_OS_OPENBSD_SPEC
992 #define LINK_OS_OPENBSD_SPEC ""
993 #endif
994
995 #ifndef CPP_OS_OPENBSD_SPEC
996 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
997 #endif
998
999 /* WindISS support.  */
1000
1001 #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
1002
1003 #define CPP_OS_WINDISS_SPEC "\
1004 -D__rtasim \
1005 -D__EABI__ \
1006 -D__ppc \
1007 %{!msoft-float: -D__hardfp} \
1008 "
1009
1010 #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1011
1012 #define ENDFILE_WINDISS_SPEC "crtend.o%s"
1013
1014 #define LINK_START_WINDISS_SPEC ""
1015
1016 #define LINK_OS_WINDISS_SPEC ""
1017
1018 /* Define any extra SPECS that the compiler needs to generate.  */
1019 /* Override rs6000.h definition.  */
1020 #undef  SUBTARGET_EXTRA_SPECS
1021 #define SUBTARGET_EXTRA_SPECS                                           \
1022   { "crtsavres_default",        CRTSAVRES_DEFAULT_SPEC },               \
1023   { "lib_ads",                  LIB_ADS_SPEC },                         \
1024   { "lib_yellowknife",          LIB_YELLOWKNIFE_SPEC },                 \
1025   { "lib_mvme",                 LIB_MVME_SPEC },                        \
1026   { "lib_sim",                  LIB_SIM_SPEC },                         \
1027   { "lib_freebsd",              LIB_FREEBSD_SPEC },                     \
1028   { "lib_gnu",                  LIB_GNU_SPEC },                         \
1029   { "lib_linux",                LIB_LINUX_SPEC },                       \
1030   { "lib_netbsd",               LIB_NETBSD_SPEC },                      \
1031   { "lib_openbsd",              LIB_OPENBSD_SPEC },                     \
1032   { "lib_windiss",              LIB_WINDISS_SPEC },                     \
1033   { "lib_default",              LIB_DEFAULT_SPEC },                     \
1034   { "startfile_ads",            STARTFILE_ADS_SPEC },                   \
1035   { "startfile_yellowknife",    STARTFILE_YELLOWKNIFE_SPEC },           \
1036   { "startfile_mvme",           STARTFILE_MVME_SPEC },                  \
1037   { "startfile_sim",            STARTFILE_SIM_SPEC },                   \
1038   { "startfile_freebsd",        STARTFILE_FREEBSD_SPEC },               \
1039   { "startfile_gnu",            STARTFILE_GNU_SPEC },                   \
1040   { "startfile_linux",          STARTFILE_LINUX_SPEC },                 \
1041   { "startfile_netbsd",         STARTFILE_NETBSD_SPEC },                \
1042   { "startfile_openbsd",        STARTFILE_OPENBSD_SPEC },               \
1043   { "startfile_windiss",        STARTFILE_WINDISS_SPEC },               \
1044   { "startfile_default",        STARTFILE_DEFAULT_SPEC },               \
1045   { "endfile_ads",              ENDFILE_ADS_SPEC },                     \
1046   { "endfile_yellowknife",      ENDFILE_YELLOWKNIFE_SPEC },             \
1047   { "endfile_mvme",             ENDFILE_MVME_SPEC },                    \
1048   { "endfile_sim",              ENDFILE_SIM_SPEC },                     \
1049   { "endfile_freebsd",          ENDFILE_FREEBSD_SPEC },                 \
1050   { "endfile_gnu",              ENDFILE_GNU_SPEC },                     \
1051   { "endfile_linux",            ENDFILE_LINUX_SPEC },                   \
1052   { "endfile_netbsd",           ENDFILE_NETBSD_SPEC },                  \
1053   { "endfile_openbsd",          ENDFILE_OPENBSD_SPEC },                 \
1054   { "endfile_windiss",          ENDFILE_WINDISS_SPEC },                 \
1055   { "endfile_default",          ENDFILE_DEFAULT_SPEC },                 \
1056   { "link_path",                LINK_PATH_SPEC },                       \
1057   { "link_shlib",               LINK_SHLIB_SPEC },                      \
1058   { "link_target",              LINK_TARGET_SPEC },                     \
1059   { "link_start",               LINK_START_SPEC },                      \
1060   { "link_start_ads",           LINK_START_ADS_SPEC },                  \
1061   { "link_start_yellowknife",   LINK_START_YELLOWKNIFE_SPEC },          \
1062   { "link_start_mvme",          LINK_START_MVME_SPEC },                 \
1063   { "link_start_sim",           LINK_START_SIM_SPEC },                  \
1064   { "link_start_freebsd",       LINK_START_FREEBSD_SPEC },              \
1065   { "link_start_gnu",           LINK_START_GNU_SPEC },                  \
1066   { "link_start_linux",         LINK_START_LINUX_SPEC },                \
1067   { "link_start_netbsd",        LINK_START_NETBSD_SPEC },               \
1068   { "link_start_openbsd",       LINK_START_OPENBSD_SPEC },              \
1069   { "link_start_windiss",       LINK_START_WINDISS_SPEC },              \
1070   { "link_start_default",       LINK_START_DEFAULT_SPEC },              \
1071   { "link_os",                  LINK_OS_SPEC },                         \
1072   { "link_os_ads",              LINK_OS_ADS_SPEC },                     \
1073   { "link_os_yellowknife",      LINK_OS_YELLOWKNIFE_SPEC },             \
1074   { "link_os_mvme",             LINK_OS_MVME_SPEC },                    \
1075   { "link_os_sim",              LINK_OS_SIM_SPEC },                     \
1076   { "link_os_freebsd",          LINK_OS_FREEBSD_SPEC },                 \
1077   { "link_os_linux",            LINK_OS_LINUX_SPEC },                   \
1078   { "link_os_gnu",              LINK_OS_GNU_SPEC },                     \
1079   { "link_os_netbsd",           LINK_OS_NETBSD_SPEC },                  \
1080   { "link_os_openbsd",          LINK_OS_OPENBSD_SPEC },                 \
1081   { "link_os_windiss",          LINK_OS_WINDISS_SPEC },                 \
1082   { "link_os_default",          LINK_OS_DEFAULT_SPEC },                 \
1083   { "cc1_endian_big",           CC1_ENDIAN_BIG_SPEC },                  \
1084   { "cc1_endian_little",        CC1_ENDIAN_LITTLE_SPEC },               \
1085   { "cc1_endian_default",       CC1_ENDIAN_DEFAULT_SPEC },              \
1086   { "cc1_secure_plt_default",   CC1_SECURE_PLT_DEFAULT_SPEC },          \
1087   { "cpp_os_ads",               CPP_OS_ADS_SPEC },                      \
1088   { "cpp_os_yellowknife",       CPP_OS_YELLOWKNIFE_SPEC },              \
1089   { "cpp_os_mvme",              CPP_OS_MVME_SPEC },                     \
1090   { "cpp_os_sim",               CPP_OS_SIM_SPEC },                      \
1091   { "cpp_os_freebsd",           CPP_OS_FREEBSD_SPEC },                  \
1092   { "cpp_os_gnu",               CPP_OS_GNU_SPEC },                      \
1093   { "cpp_os_linux",             CPP_OS_LINUX_SPEC },                    \
1094   { "cpp_os_netbsd",            CPP_OS_NETBSD_SPEC },                   \
1095   { "cpp_os_openbsd",           CPP_OS_OPENBSD_SPEC },                  \
1096   { "cpp_os_windiss",           CPP_OS_WINDISS_SPEC },                  \
1097   { "cpp_os_default",           CPP_OS_DEFAULT_SPEC },                  \
1098   { "fbsd_dynamic_linker",      FBSD_DYNAMIC_LINKER },                  \
1099   SUBSUBTARGET_EXTRA_SPECS
1100
1101 #define SUBSUBTARGET_EXTRA_SPECS
1102
1103 /* Define this macro as a C expression for the initializer of an
1104    array of string to tell the driver program which options are
1105    defaults for this target and thus do not need to be handled
1106    specially when using `MULTILIB_OPTIONS'.
1107
1108    Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1109    the target makefile fragment or if none of the options listed in
1110    `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
1111
1112 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1113
1114 /* Define this macro if the code for function profiling should come
1115    before the function prologue.  Normally, the profiling code comes
1116    after.  */
1117 #define PROFILE_BEFORE_PROLOGUE 1
1118
1119 /* Function name to call to do profiling.  */
1120 #define RS6000_MCOUNT "_mcount"
1121
1122 /* Define this macro (to a value of 1) if you want to support the
1123    Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1124    pack(pop)'.  The pack(push,<n>) pragma specifies the maximum
1125    alignment (in bytes) of fields within a structure, in much the
1126    same way as the __aligned__' and __packed__' __attribute__'s
1127    do.  A pack value of zero resets the behavior to the default.
1128    Successive invocations of this pragma cause the previous values to
1129    be stacked, so that invocations of #pragma pack(pop)' will return
1130    to the previous value.  */
1131
1132 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
1133
1134 /* Select a format to encode pointers in exception handling data.  CODE
1135    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
1136    true if the symbol may be affected by dynamic relocations.  */
1137 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                            \
1138   ((flag_pic || TARGET_RELOCATABLE)                                          \
1139    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1140    : DW_EH_PE_absptr)
1141
1142 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1143
1144 /* Generate entries in .fixup for relocatable addresses.  */
1145 #define RELOCATABLE_NEEDS_FIXUP 1
1146
1147 /* This target uses the sysv4.opt file.  */
1148 #define TARGET_USES_SYSV4_OPT 1