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