OSDN Git Service

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