OSDN Git Service

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