OSDN Git Service

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