OSDN Git Service

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