OSDN Git Service

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