OSDN Git Service

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