]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/rs6000/sysv4.h
configure.in: Check whether assembler supports section merging.
[thirdparty/gcc.git] / gcc / config / rs6000 / sysv4.h
CommitLineData
e3f1f242 1/* Target definitions for GNU compiler for PowerPC running System V.4
e556ad19
FS
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
e3f1f242
MM
4 Contributed by Cygnus Support.
5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GNU CC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU CC; see the file COPYING. If not, write to
c15c9075
RK
20the Free Software Foundation, 59 Temple Place - Suite 330,
21Boston, MA 02111-1307, USA. */
e3f1f242 22
9ebbca7d
GK
23
24/* Yes! We are ELF. */
25#define TARGET_OBJECT_FORMAT OBJECT_ELF
26
27/* Default ABI to compile code for. */
28#define DEFAULT_ABI rs6000_current_abi
29
30/* Default ABI to use. */
31#define RS6000_ABI_NAME "sysv"
32
33/* Override rs6000.h definition. */
34#undef ASM_DEFAULT_SPEC
35#define ASM_DEFAULT_SPEC "-mppc"
36
37/* Override rs6000.h definition. */
38#undef CPP_DEFAULT_SPEC
39#define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
40
41/* Small data support types. */
d9407988 42enum rs6000_sdata_type {
9ebbca7d
GK
43 SDATA_NONE, /* No small data support. */
44 SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */
45 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */
46 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */
d9407988 47};
d14a6d05 48
d9407988
MM
49extern enum rs6000_sdata_type rs6000_sdata;
50
9ebbca7d
GK
51/* V.4/eabi switches. */
52#define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */
d14a6d05 53#define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
9ebbca7d
GK
54#define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */
55#define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */
56#define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */
57#define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
58#define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
e0f7170a 59#define MASK_LONG_DOUBLE_128 0x00800000 /* Use IEEE quad long double. */
9a155f91 60#define MASK_NO_BITFIELD_WORD 0x00400000 /* Bitfields cannot cross word boundaries */
d14a6d05
MM
61
62#define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
9ebbca7d
GK
63#define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
64#define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
65#define TARGET_EABI (target_flags & MASK_EABI)
66#define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
67#define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
4697a36c 68#define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
e0f7170a 69#define TARGET_LONG_DOUBLE_128 (target_flags & MASK_LONG_DOUBLE_128)
9a155f91 70#define TARGET_NO_BITFIELD_WORD (target_flags & MASK_NO_BITFIELD_WORD)
64d732de
MM
71#define TARGET_TOC ((target_flags & MASK_64BIT) \
72 || ((target_flags & (MASK_RELOCATABLE \
73 | MASK_MINIMAL_TOC)) \
74 && flag_pic > 1) \
9ebbca7d 75 || DEFAULT_ABI == ABI_AIX)
7e69e155
MM
76
77#define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
9ebbca7d 78#define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
4697a36c
MM
79#define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
80#define TARGET_NO_TOC (! TARGET_TOC)
9ebbca7d 81#define TARGET_NO_EABI (! TARGET_EABI)
c81bebd7 82
d9407988 83/* Strings provided by SUBTARGET_OPTIONS */
815cdc52
MM
84extern const char *rs6000_abi_name;
85extern const char *rs6000_sdata_name;
d9407988 86
9ebbca7d
GK
87/* Override rs6000.h definition. */
88#undef SUBTARGET_OPTIONS
89#define SUBTARGET_OPTIONS \
047142d3
PT
90 { "call-", &rs6000_abi_name, N_("Select ABI calling convention.") }, \
91 { "sdata=", &rs6000_sdata_name, N_("Select method for sdata handling.") }
3933e0e1 92
88228c4b
MM
93/* Max # of bytes for variables to automatically be put into the .sdata
94 or .sdata2 sections. */
9ebbca7d
GK
95extern int g_switch_value; /* Value of the -G xx switch. */
96extern int g_switch_set; /* Whether -G xx was passed. */
88228c4b 97
88228c4b 98#define SDATA_DEFAULT_SIZE 8
9ebbca7d
GK
99
100/* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
101 the same as -mminimal-toc. */
102/* Override rs6000.h definition. */
103#undef SUBTARGET_SWITCHES
104#define SUBTARGET_SWITCHES \
047142d3
PT
105 { "bit-align", -MASK_NO_BITFIELD_TYPE, \
106 N_("Align to the base type of the bitfield.") }, \
107 { "no-bit-align", MASK_NO_BITFIELD_TYPE, \
108 N_("Don't align to the base type of the bitfield.") }, \
109 { "strict-align", MASK_STRICT_ALIGN, \
110 N_("Don't assume that unaligned accesses are handled by the system") }, \
111 { "no-strict-align", -MASK_STRICT_ALIGN, \
112 N_("Assume that unaligned accesses are handled by the system") }, \
113 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
114 N_("Produce code relocatable at runtime.") }, \
115 { "no-relocatable", -MASK_RELOCATABLE, \
116 N_("Don't produce code relocatable at runtime.") }, \
117 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
118 N_("Produce code relocatable at runtime.") }, \
119 { "no-relocatable-lib", -MASK_RELOCATABLE, \
120 N_("Don't produce code relocatable at runtime.") }, \
121 { "little-endian", MASK_LITTLE_ENDIAN, \
122 N_("Produce little endian code.") }, \
123 { "little", MASK_LITTLE_ENDIAN, \
124 N_("Produce little endian code.") }, \
125 { "big-endian", -MASK_LITTLE_ENDIAN, \
126 N_("Produce big endian code.") }, \
127 { "big", -MASK_LITTLE_ENDIAN, \
128 N_("Produce big endian code.") }, \
e0f7170a
GK
129 { "long-double-64", -MASK_LONG_DOUBLE_128, \
130 N_("Use 64 bit long doubles") }, \
131 { "long-double-128", MASK_LONG_DOUBLE_128, \
132 N_("Use 128 bit long doubles") }, \
047142d3
PT
133 { "no-toc", 0, N_("no description yet") }, \
134 { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
135 { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
136 { "prototype", MASK_PROTOTYPE, N_("no description yet") }, \
137 { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \
138 { "no-traceback", 0, N_("no description yet") }, \
139 { "eabi", MASK_EABI, N_("Use EABI.") }, \
140 { "no-eabi", -MASK_EABI, N_("Don't use EABI.") }, \
9a155f91
GK
141 { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \
142 { "no-bit-word", MASK_NO_BITFIELD_WORD, \
143 N_("Do not allow bitfields to cross word boundaries") }, \
047142d3
PT
144 { "regnames", MASK_REGNAMES, \
145 N_("Use alternate register names.") }, \
146 { "no-regnames", -MASK_REGNAMES, \
147 N_("Don't use alternate register names.") }, \
148 { "sdata", 0, N_("no description yet") }, \
149 { "no-sdata", 0, N_("no description yet") }, \
150 { "sim", 0, \
151 N_("Link with libsim.a, libc.a and sim-crt0.o.") }, \
152 { "ads", 0, \
153 N_("Link with libads.a, libc.a and crt0.o.") }, \
154 { "yellowknife", 0, \
155 N_("Link with libyk.a, libc.a and crt0.o.") }, \
156 { "mvme", 0, \
157 N_("Link with libmvme.a, libc.a and crt0.o.") }, \
158 { "emb", 0, \
159 N_("Set the PPC_EMB bit in the ELF flags header") }, \
160 { "vxworks", 0, N_("no description yet") }, \
161 { "solaris-cclib", 0, N_("no description yet") }, \
162 { "shlib", 0, N_("no description yet") }, \
163 EXTRA_SUBTARGET_SWITCHES \
164 { "newlib", 0, N_("no description yet") },
9ebbca7d
GK
165
166/* This is meant to be redefined in the host dependent files. */
167#define EXTRA_SUBTARGET_SWITCHES
88228c4b 168
3933e0e1
MM
169/* Sometimes certain combinations of command options do not make sense
170 on a particular target machine. You can define a macro
171 `OVERRIDE_OPTIONS' to take account of this. This macro, if
172 defined, is executed once just after all the command options have
173 been parsed.
174
175 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
176 get control. */
177
178#define SUBTARGET_OVERRIDE_OPTIONS \
179do { \
88228c4b
MM
180 if (!g_switch_set) \
181 g_switch_value = SDATA_DEFAULT_SIZE; \
182 \
c81bebd7
MM
183 if (!strcmp (rs6000_abi_name, "sysv")) \
184 rs6000_current_abi = ABI_V4; \
185 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
186 { \
187 rs6000_current_abi = ABI_V4; \
188 target_flags &= ~ MASK_EABI; \
189 } \
190 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
191 || !strcmp (rs6000_abi_name, "eabi")) \
192 { \
193 rs6000_current_abi = ABI_V4; \
194 target_flags |= MASK_EABI; \
195 } \
196 else if (!strcmp (rs6000_abi_name, "aix")) \
670866a5
MM
197 { \
198 rs6000_current_abi = ABI_AIX_NODESC; \
199 target_flags |= MASK_EABI; \
200 } \
c81bebd7
MM
201 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
202 rs6000_current_abi = ABI_AIX; \
c81bebd7
MM
203 else if (!strcmp (rs6000_abi_name, "linux")) \
204 rs6000_current_abi = ABI_V4; \
edf1b3f3
AC
205 else if (!strcmp (rs6000_abi_name, "netbsd")) \
206 rs6000_current_abi = ABI_V4; \
c81bebd7
MM
207 else if (!strcmp (rs6000_abi_name, "solaris")) \
208 rs6000_current_abi = ABI_SOLARIS; \
c36ae96c
GK
209 else if (!strcmp (rs6000_abi_name, "i960-old")) \
210 { \
211 rs6000_current_abi = ABI_V4; \
212 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \
213 | MASK_NO_BITFIELD_WORD); \
214 target_flags &= ~MASK_STRICT_ALIGN; \
215 } \
c81bebd7
MM
216 else \
217 { \
218 rs6000_current_abi = ABI_V4; \
219 error ("Bad value for -mcall-%s", rs6000_abi_name); \
220 } \
7509c759 221 \
d9407988
MM
222 if (rs6000_sdata_name) \
223 { \
d9407988 224 if (!strcmp (rs6000_sdata_name, "none")) \
38c1f2d7 225 rs6000_sdata = SDATA_NONE; \
d9407988
MM
226 else if (!strcmp (rs6000_sdata_name, "data")) \
227 rs6000_sdata = SDATA_DATA; \
228 else if (!strcmp (rs6000_sdata_name, "default")) \
229 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
230 else if (!strcmp (rs6000_sdata_name, "sysv")) \
231 rs6000_sdata = SDATA_SYSV; \
232 else if (!strcmp (rs6000_sdata_name, "eabi")) \
233 rs6000_sdata = SDATA_EABI; \
234 else \
235 error ("Bad value for -msdata=%s", rs6000_sdata_name); \
236 } \
5b9d9a0c 237 else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
d9407988
MM
238 { \
239 rs6000_sdata = SDATA_DATA; \
84f414bc 240 rs6000_sdata_name = "data"; \
d9407988
MM
241 } \
242 else \
84f414bc
MM
243 { \
244 rs6000_sdata = SDATA_NONE; \
245 rs6000_sdata_name = "none"; \
246 } \
9a57586f 247 \
d9407988
MM
248 if (TARGET_RELOCATABLE && \
249 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
7509c759 250 { \
5b9d9a0c 251 rs6000_sdata = SDATA_DATA; \
84f414bc
MM
252 error ("-mrelocatable and -msdata=%s are incompatible.", \
253 rs6000_sdata_name); \
7509c759
MM
254 } \
255 \
84f414bc
MM
256 else if (flag_pic && \
257 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
258 { \
259 rs6000_sdata = SDATA_DATA; \
260 error ("-f%s and -msdata=%s are incompatible.", \
261 (flag_pic > 1) ? "PIC" : "pic", \
262 rs6000_sdata_name); \
263 } \
264 \
38c1f2d7
MM
265 if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4 \
266 && DEFAULT_ABI != ABI_SOLARIS) \
7509c759 267 { \
38c1f2d7
MM
268 rs6000_sdata = SDATA_NONE; \
269 error ("-msdata=%s and -mcall-%s are incompatible.", \
270 rs6000_sdata_name, rs6000_abi_name); \
7509c759
MM
271 } \
272 \
3933e0e1
MM
273 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
274 { \
275 target_flags |= MASK_MINIMAL_TOC; \
276 error ("-mrelocatable and -mno-minimal-toc are incompatible."); \
3933e0e1 277 } \
b6c9286a 278 \
9ebbca7d 279 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
b6c9286a
MM
280 { \
281 target_flags &= ~MASK_RELOCATABLE; \
c81bebd7
MM
282 error ("-mrelocatable and -mcall-%s are incompatible.", \
283 rs6000_abi_name); \
b6c9286a
MM
284 } \
285 \
9ebbca7d 286 if (flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
3201f6d9
MM
287 { \
288 flag_pic = 0; \
289 error ("-fPIC and -mcall-%s are incompatible.", \
290 rs6000_abi_name); \
291 } \
292 \
c81bebd7 293 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
b6c9286a
MM
294 { \
295 target_flags &= ~MASK_LITTLE_ENDIAN; \
296 error ("-mcall-aixdesc must be big endian"); \
297 } \
298 \
9ebbca7d 299 /* Treat -fPIC the same as -mrelocatable. */ \
84f414bc 300 if (flag_pic > 1) \
3201f6d9 301 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
84f414bc
MM
302 \
303 else if (TARGET_RELOCATABLE) \
304 flag_pic = 2; \
305 \
3933e0e1 306} while (0)
75814ad4 307
a260abc9 308
9ebbca7d
GK
309/* Override rs6000.h definition. */
310#undef TARGET_DEFAULT
311#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
a260abc9 312
9ebbca7d
GK
313/* Override rs6000.h definition. */
314#undef PROCESSOR_DEFAULT
315#define PROCESSOR_DEFAULT PROCESSOR_PPC750
e3f1f242 316
5d36722d
RK
317/* System V.4 uses register 13 as a pointer to the small data area,
318 so it is not available to the normal user. */
319
5d36722d
RK
320#define FIXED_R13 1
321
9ebbca7d
GK
322/* Size of the V.4 varargs area if needed. */
323/* Override rs6000.h definition. */
4697a36c 324#undef RS6000_VARARGS_AREA
00dba523 325#define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
4697a36c 326
9ebbca7d
GK
327/* Override default big endianism definitions in rs6000.h. */
328#undef BYTES_BIG_ENDIAN
329#undef WORDS_BIG_ENDIAN
330#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
331#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
75814ad4 332
4d3f9f5b
RK
333/* Define this to set the endianness to use in libgcc2.c, which can
334 not depend on target_flags. */
7d473b07 335#if !defined(_LITTLE_ENDIAN) && !defined(__sun__)
4d3f9f5b
RK
336#define LIBGCC2_WORDS_BIG_ENDIAN 1
337#else
338#define LIBGCC2_WORDS_BIG_ENDIAN 0
339#endif
340
4697a36c 341/* Define cutoff for using external functions to save floating point.
9ebbca7d 342 Currently on V.4, always use inline stores. */
4697a36c
MM
343#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
344
e9a25f70 345/* Put jump tables in read-only memory, rather than in .text. */
75197b37 346#define JUMP_TABLES_IN_TEXT_SECTION 0
e9a25f70 347
9ebbca7d 348/* Prefix and suffix to use to saving floating point. */
e3f1f242
MM
349#define SAVE_FP_PREFIX "_savefpr_"
350#define SAVE_FP_SUFFIX "_l"
351
9ebbca7d 352/* Prefix and suffix to use to restoring floating point. */
e3f1f242
MM
353#define RESTORE_FP_PREFIX "_restfpr_"
354#define RESTORE_FP_SUFFIX "_l"
355
356/* Type used for ptrdiff_t, as a string used in a declaration. */
e3f1f242
MM
357#define PTRDIFF_TYPE "int"
358
359/* Type used for wchar_t, as a string used in a declaration. */
9ebbca7d 360/* Override svr4.h definition. */
e3f1f242 361#undef WCHAR_TYPE
f9317f0d 362#define WCHAR_TYPE "long int"
e3f1f242
MM
363
364/* Width of wchar_t in bits. */
9ebbca7d 365/* Override svr4.h definition. */
e3f1f242 366#undef WCHAR_TYPE_SIZE
f9317f0d 367#define WCHAR_TYPE_SIZE 32
e3f1f242 368
e0f7170a
GK
369/* Define for support of TFmode long double and REAL_ARITHMETIC.
370 PowerPC SVR4 ABI says that long double is 4 words. */
371#undef LONG_DOUBLE_TYPE_SIZE
372#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
373
374/* Constant which presents upper bound of the above value. */
375#define MAX_LONG_DOUBLE_TYPE_SIZE 128
376
377/* Define this to set long double type size to use in libgcc2.c, which can
378 not depend on target_flags. */
379#ifdef __LONG_DOUBLE_128__
380#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
381#else
382#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
383#endif
384
9ebbca7d
GK
385/* Make int foo : 8 not cause structures to be aligned to an int boundary. */
386/* Override elfos.h definition. */
c81bebd7
MM
387#undef PCC_BITFIELD_TYPE_MATTERS
388#define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
389
9a155f91
GK
390#undef BITFIELD_NBYTES_LIMITED
391#define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
392
c81bebd7
MM
393/* Define this macro to be the value 1 if instructions will fail to
394 work if given data not on the nominal alignment. If instructions
bef84347 395 will merely go slower in that case, define this macro as 0. */
c81bebd7 396#undef STRICT_ALIGNMENT
bef84347 397#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
c81bebd7 398
61b2fbe7
MM
399/* Alignment in bits of the stack boundary. Note, in order to allow building
400 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
401 versions, just use 64 as the stack boundary. */
e3f1f242 402#undef STACK_BOUNDARY
61b2fbe7
MM
403#define STACK_BOUNDARY 64
404
9ebbca7d 405/* Real stack boundary as mandated by the appropriate ABI. */
61b2fbe7 406#define ABI_STACK_BOUNDARY ((TARGET_EABI) ? 64 : 128)
e3f1f242
MM
407
408/* No data type wants to be aligned rounder than this. */
409#undef BIGGEST_ALIGNMENT
c81bebd7
MM
410#define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
411
f589b741 412#undef BIGGEST_FIELD_ALIGNMENT
3e99621c
DE
413#undef ADJUST_FIELD_ALIGN
414#undef ROUND_TYPE_ALIGN
e3f1f242
MM
415
416/* Use ELF style section commands. */
417
9ebbca7d 418#define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
e3f1f242 419
9ebbca7d 420#define DATA_SECTION_ASM_OP "\t.section\t\".data\""
fff4998b 421
9ebbca7d 422#define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
e3f1f242 423
9ebbca7d
GK
424/* Override elfos.h definition. */
425#undef INIT_SECTION_ASM_OP
426#define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
c81bebd7 427
9ebbca7d
GK
428/* Override elfos.h definition. */
429#undef FINI_SECTION_ASM_OP
430#define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
c81bebd7 431
9ebbca7d 432#define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
c81bebd7 433
9ebbca7d
GK
434/* Put PC relative got entries in .got2. */
435#define MINIMAL_TOC_SECTION_ASM_OP \
4f3397ae 436 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
c81bebd7 437
9ebbca7d
GK
438#define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
439#define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
440#define SBSS_SECTION_ASM_OP \
ba1a5707 441 ((DEFAULT_ABI == ABI_SOLARIS) ? "\t.section\t\".sbss\",\"aw\"" : "\t.section\t\".sbss\",\"aw\",@nobits")
c81bebd7
MM
442
443
e3f1f242 444/* Besides the usual ELF sections, we need a toc section. */
9ebbca7d
GK
445/* Override elfos.h definition. */
446#undef EXTRA_SECTIONS
2cc07db4 447#define EXTRA_SECTIONS in_const, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
e3f1f242 448
9ebbca7d
GK
449/* Override elfos.h definition. */
450#undef EXTRA_SECTION_FUNCTIONS
451#define EXTRA_SECTION_FUNCTIONS \
e3f1f242 452 CONST_SECTION_FUNCTION \
7509c759
MM
453 TOC_SECTION_FUNCTION \
454 SDATA_SECTION_FUNCTION \
455 SDATA2_SECTION_FUNCTION \
c81bebd7
MM
456 SBSS_SECTION_FUNCTION \
457 INIT_SECTION_FUNCTION \
458 FINI_SECTION_FUNCTION
7509c759 459
9ebbca7d 460#define TOC_SECTION_FUNCTION \
e3f1f242
MM
461void \
462toc_section () \
463{ \
d14a6d05
MM
464 if (in_section != in_toc) \
465 { \
4697a36c 466 in_section = in_toc; \
9ebbca7d 467 if (DEFAULT_ABI == ABI_AIX \
b6c9286a
MM
468 && TARGET_MINIMAL_TOC \
469 && !TARGET_RELOCATABLE) \
470 { \
471 if (! toc_initialized) \
472 { \
473 toc_initialized = 1; \
474 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
475 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
476 fprintf (asm_out_file, "\t.tc "); \
477 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
478 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
479 fprintf (asm_out_file, "\n"); \
480 \
481 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
482 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
483 fprintf (asm_out_file, " = .+32768\n"); \
484 } \
485 else \
486 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
487 } \
9ebbca7d 488 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
b6c9286a
MM
489 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
490 else \
e3f1f242 491 { \
b6c9286a
MM
492 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
493 if (! toc_initialized) \
494 { \
495 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
496 fprintf (asm_out_file, " = .+32768\n"); \
497 toc_initialized = 1; \
498 } \
e3f1f242 499 } \
e3f1f242
MM
500 } \
501}
502
9ebbca7d 503#define SDATA_SECTION_FUNCTION \
7509c759
MM
504void \
505sdata_section () \
506{ \
507 if (in_section != in_sdata) \
508 { \
509 in_section = in_sdata; \
510 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
511 } \
512}
513
9ebbca7d 514#define SDATA2_SECTION_FUNCTION \
7509c759
MM
515void \
516sdata2_section () \
517{ \
518 if (in_section != in_sdata2) \
519 { \
520 in_section = in_sdata2; \
521 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
522 } \
523}
524
9ebbca7d 525#define SBSS_SECTION_FUNCTION \
7509c759
MM
526void \
527sbss_section () \
528{ \
529 if (in_section != in_sbss) \
530 { \
531 in_section = in_sbss; \
532 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
533 } \
e3f1f242
MM
534}
535
9ebbca7d 536#define INIT_SECTION_FUNCTION \
c81bebd7
MM
537void \
538init_section () \
539{ \
540 if (in_section != in_init) \
541 { \
542 in_section = in_init; \
543 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
544 } \
545}
546
9ebbca7d 547#define FINI_SECTION_FUNCTION \
c81bebd7
MM
548void \
549fini_section () \
550{ \
551 if (in_section != in_fini) \
552 { \
553 in_section = in_fini; \
554 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
555 } \
556}
557
7509c759
MM
558/* A C statement or statements to switch to the appropriate section
559 for output of RTX in mode MODE. You can assume that RTX is some
560 kind of constant in RTL. The argument MODE is redundant except in
561 the case of a `const_int' rtx. Select the section by calling
562 `text_section' or one of the alternatives for other sections.
563
564 Do not define this macro if you put all constants in the read-only
565 data section. */
566
9ebbca7d
GK
567/* Override elfos.h definition. */
568#undef SELECT_RTX_SECTION
201556f0 569#define SELECT_RTX_SECTION(MODE, X, ALIGN) rs6000_select_rtx_section (MODE, X)
7509c759
MM
570
571/* A C statement or statements to switch to the appropriate
572 section for output of DECL. DECL is either a `VAR_DECL' node
573 or a constant of some sort. RELOC indicates whether forming
574 the initial value of DECL requires link-time relocations. */
575
9ebbca7d
GK
576/* Override elfos.h definition. */
577#undef SELECT_SECTION
201556f0 578#define SELECT_SECTION(DECL, RELOC, ALIGN) rs6000_select_section (DECL, RELOC)
63019373
GK
579
580/* A C statement to build up a unique section name, expressed as a
581 STRING_CST node, and assign it to DECL_SECTION_NAME (decl).
582 RELOC indicates whether the initial value of EXP requires
583 link-time relocations. If you do not define this macro, GCC will use
584 the symbol name prefixed by `.' as the section name. Note - this
585 macro can now be called for unitialised data items as well as
586 initialised data and functions. */
587
588/* Override elfos.h definition. */
589#undef UNIQUE_SECTION
590#define UNIQUE_SECTION(DECL, RELOC) rs6000_unique_section (DECL, RELOC)
7509c759 591
b6c9286a
MM
592/* Return non-zero if this entry is to be written into the constant pool
593 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
594 containing one of them. If -mfp-in-toc (the default), we also do
595 this for floating-point constants. We actually can only do this
596 if the FP formats of the target and host machines are the same, but
597 we can't check that since not every file that uses
598 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
599
956d6950 600 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
b6c9286a
MM
601 allow floating point constants in the TOC if -mrelocatable. */
602
603#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
a9098fd0 604#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
b6c9286a
MM
605 (TARGET_TOC \
606 && (GET_CODE (X) == SYMBOL_REF \
607 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
608 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
609 || GET_CODE (X) == LABEL_REF \
a9098fd0
GK
610 || (GET_CODE (X) == CONST_INT \
611 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
b6c9286a
MM
612 || (!TARGET_NO_FP_IN_TOC \
613 && !TARGET_RELOCATABLE \
614 && GET_CODE (X) == CONST_DOUBLE \
615 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
616 && BITS_PER_WORD == HOST_BITS_PER_INT)))
617
e3f1f242
MM
618/* These macros generate the special .type and .size directives which
619 are used to set the corresponding fields of the linker symbol table
620 entries in an ELF object file under SVR4. These macros also output
621 the starting labels for the relevant functions/objects. */
622
623/* Write the extra assembler code needed to declare a function properly.
624 Some svr4 assemblers need to also have something extra said about the
625 function's return value. We allow for that here. */
626
874a0744 627extern int rs6000_pic_labelno;
e3f1f242 628
9ebbca7d 629/* Override elfos.h definition. */
e3f1f242
MM
630#undef ASM_DECLARE_FUNCTION_NAME
631#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
632 do { \
ec940faa 633 const char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
b6c9286a 634 \
9ebbca7d
GK
635 if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag) \
636 && uses_TOC()) \
874a0744 637 { \
ec940faa 638 char buf[256]; \
874a0744
MM
639 \
640 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
641 \
642 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
9ebbca7d
GK
643 fprintf (FILE, "\t%s ", init_ptr); \
644 assemble_name (FILE, buf); \
645 putc ('-', FILE); \
874a0744 646 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
9ebbca7d
GK
647 assemble_name (FILE, buf); \
648 putc ('\n', FILE); \
874a0744
MM
649 } \
650 \
b9f7d63e 651 fprintf (FILE, "%s", TYPE_ASM_OP); \
9ebbca7d
GK
652 assemble_name (FILE, NAME); \
653 putc (',', FILE); \
e3f1f242
MM
654 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
655 putc ('\n', FILE); \
e3f1f242 656 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
b6c9286a 657 \
9ebbca7d 658 if (DEFAULT_ABI == ABI_AIX) \
b6c9286a 659 { \
9ebbca7d 660 const char *desc_name, *orig_name; \
b6c9286a 661 \
9ebbca7d
GK
662 STRIP_NAME_ENCODING (orig_name, NAME); \
663 desc_name = orig_name; \
b6c9286a
MM
664 while (*desc_name == '.') \
665 desc_name++; \
666 \
667 if (TREE_PUBLIC (DECL)) \
668 fprintf (FILE, "\t.globl %s\n", desc_name); \
669 \
670 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
671 fprintf (FILE, "%s:\n", desc_name); \
672 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
673 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
674 if (DEFAULT_ABI == ABI_AIX) \
675 fprintf (FILE, "\t%s 0\n", init_ptr); \
676 fprintf (FILE, "\t.previous\n"); \
677 } \
9ebbca7d 678 ASM_OUTPUT_LABEL (FILE, NAME); \
e3f1f242
MM
679 } while (0)
680
9ebbca7d
GK
681/* A C compound statement that outputs the assembler code for a thunk function,
682 used to implement C++ virtual function calls with multiple inheritance. The
683 thunk acts as a wrapper around a virtual function, adjusting the implicit
684 object parameter before handing control off to the real function.
685
686 First, emit code to add the integer DELTA to the location that contains the
687 incoming first argument. Assume that this argument contains a pointer, and
688 is the one used to pass the this' pointer in C++. This is the incoming
689 argument *before* the function prologue, e.g. %o0' on a sparc. The
690 addition must preserve the values of all other incoming arguments.
691
692 After the addition, emit code to jump to FUNCTION, which is a
693 FUNCTION_DECL'. This is a direct pure jump, not a call, and does not touch
694 the return address. Hence returning from FUNCTION will return to whoever
695 called the current thunk'.
696
2bfcf297
DB
697 The effect must be as if FUNCTION had been called directly with the adjusted
698 first argument. This macro is responsible for emitting all of the code for
699 a thunk function; FUNCTION_PROLOGUE' and FUNCTION_EPILOGUE' are not
9ebbca7d
GK
700 invoked.
701
702 The THUNK_FNDECL is redundant. (DELTA and FUNCTION have already been
703 extracted from it.) It might possibly be useful on some targets, but
704 probably not.
705
706 If you do not define this macro, the target-independent code in the C++
707 frontend will generate a less efficient heavyweight thunk that calls
708 FUNCTION instead of jumping to it. The generic approach does not support
709 varargs. */
710
711#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
712 output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION)
713
e3f1f242
MM
714/* How to renumber registers for dbx and gdb. */
715
9ebbca7d
GK
716#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
717
718/* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
719 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
720
721#define LOCAL_LABEL_PREFIX "."
722#define USER_LABEL_PREFIX ""
e3f1f242
MM
723
724/* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
725
9ebbca7d
GK
726#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
727 asm_fprintf (FILE, "%L%s", PREFIX)
728
729#define ASM_OUTPUT_LABEL(FILE,NAME) \
730 (assemble_name (FILE, NAME), fputs (":\n", FILE))
731
732/* This is how to output a command to make the user-level label named NAME
733 defined for reference from other files. */
734
735#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
736 do { fputs ("\t.globl ", FILE); \
737 assemble_name (FILE, NAME); putc ('\n', FILE);} while (0)
e3f1f242 738
c81bebd7
MM
739/* This is how to allocate empty space in some section. Use .space
740 instead of .zero because the Solaris PowerPC assembler doesn't
741 like it, and gas accepts either syntax. */
742
9ebbca7d 743/* Override elfos.h definition. */
c81bebd7 744#undef SKIP_ASM_OP
76bbee81 745#define SKIP_ASM_OP "\t.space\t"
c81bebd7 746
5f01fc14
MM
747/* This says how to output assembler code to declare an
748 uninitialized internal linkage data object. Under SVR4,
749 the linker seems to want the alignment of data objects
750 to depend on their types. We do exactly that here. */
751
76bbee81 752#define LOCAL_ASM_OP "\t.local\t"
5f01fc14 753
76bbee81 754#define LCOMM_ASM_OP "\t.lcomm\t"
e47ae1c2 755
9ebbca7d
GK
756/* Override elfos.h definition. */
757#undef ASM_OUTPUT_ALIGNED_LOCAL
758#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
5f01fc14 759do { \
38c1f2d7
MM
760 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
761 && (SIZE) <= g_switch_value) \
e47ae1c2 762 { \
a9aefc1e 763 sbss_section (); \
e47ae1c2
MM
764 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
765 ASM_OUTPUT_LABEL (FILE, NAME); \
766 ASM_OUTPUT_SKIP (FILE, SIZE); \
767 if (!flag_inhibit_size_directive && (SIZE) > 0) \
768 { \
b9f7d63e 769 fprintf (FILE, "%s", SIZE_ASM_OP); \
e47ae1c2
MM
770 assemble_name (FILE, NAME); \
771 fprintf (FILE, ",%d\n", SIZE); \
772 } \
773 } \
5f01fc14 774 else \
e47ae1c2 775 { \
b9f7d63e 776 fprintf (FILE, "%s", LCOMM_ASM_OP); \
e47ae1c2
MM
777 assemble_name ((FILE), (NAME)); \
778 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
779 } \
fff4998b
MM
780} while (0)
781
9ebbca7d
GK
782/* Describe how to emit uninitialized external linkage items. */
783#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
fff4998b
MM
784do { \
785 ASM_GLOBALIZE_LABEL (FILE, NAME); \
786 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
5f01fc14
MM
787} while (0)
788
9ebbca7d 789/* Switch Recognition by gcc.c. Add -G xx support. */
88228c4b 790
9ebbca7d
GK
791/* Override svr4.h definition. */
792#undef SWITCH_TAKES_ARG
793#define SWITCH_TAKES_ARG(CHAR) \
88228c4b
MM
794 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
795 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
3411a85a
MM
796 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
797 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
798 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
88228c4b 799
5f30b0ff 800/* Output .file. */
9ebbca7d
GK
801/* Override elfos.h definition. */
802#undef ASM_FILE_START
803#define ASM_FILE_START(FILE) \
4d3f9f5b 804do { \
4d3f9f5b 805 output_file_directive ((FILE), main_input_filename); \
3cfa4909 806 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
4d3f9f5b
RK
807} while (0)
808
b6c9286a 809
9ebbca7d
GK
810extern int fixuplabelno;
811
d9f6800d
RH
812/* Handle constructors specially for -mrelocatable. */
813#define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
814#define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
815
b6c9286a
MM
816/* This is how to output an assembler line defining an `int' constant.
817 For -mrelocatable, we mark all addresses that need to be fixed up
818 in the .fixup section. */
9ebbca7d 819/* Override rs6000.h definition. */
b6c9286a
MM
820#undef ASM_OUTPUT_INT
821#define ASM_OUTPUT_INT(FILE,VALUE) \
822do { \
823 static int recurse = 0; \
9ebbca7d 824 if (TARGET_RELOCATABLE \
b6c9286a
MM
825 && in_section != in_toc \
826 && in_section != in_text \
b6c9286a
MM
827 && !recurse \
828 && GET_CODE (VALUE) != CONST_INT \
829 && GET_CODE (VALUE) != CONST_DOUBLE \
830 && CONSTANT_P (VALUE)) \
831 { \
ec940faa 832 char buf[256]; \
b6c9286a
MM
833 \
834 recurse = 1; \
9ebbca7d
GK
835 ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", fixuplabelno); \
836 fixuplabelno++; \
837 ASM_OUTPUT_LABEL (FILE, buf); \
b6c9286a
MM
838 fprintf (FILE, "\t.long ("); \
839 output_addr_const (FILE, (VALUE)); \
840 fprintf (FILE, ")@fixup\n"); \
9ebbca7d 841 fprintf (FILE, "\t.section\t\".fixup\",\"aw\"\n"); \
b6c9286a 842 ASM_OUTPUT_ALIGN (FILE, 2); \
9ebbca7d
GK
843 fprintf (FILE, "\t.long\t"); \
844 assemble_name (FILE, buf); \
845 fprintf (FILE, "\n\t.previous\n"); \
b6c9286a
MM
846 recurse = 0; \
847 } \
9ebbca7d 848 /* Remove initial .'s to turn a -mcall-aixdesc function \
b6c9286a
MM
849 address into the address of the descriptor, not the function \
850 itself. */ \
851 else if (GET_CODE (VALUE) == SYMBOL_REF \
852 && XSTR (VALUE, 0)[0] == '.' \
9ebbca7d 853 && DEFAULT_ABI == ABI_AIX) \
b6c9286a 854 { \
3cce094d 855 const char *name = XSTR (VALUE, 0); \
b6c9286a
MM
856 while (*name == '.') \
857 name++; \
858 \
859 fprintf (FILE, "\t.long %s\n", name); \
860 } \
861 else \
862 { \
863 fprintf (FILE, "\t.long "); \
864 output_addr_const (FILE, (VALUE)); \
865 fprintf (FILE, "\n"); \
866 } \
867} while (0)
868
e3f1f242
MM
869/* This is the end of what might become sysv4.h. */
870
99e2a354 871/* Use DWARF 2 debugging information by default. */
c81bebd7 872#undef PREFERRED_DEBUGGING_TYPE
99e2a354 873#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
c81bebd7 874
99e2a354 875/* Historically we have also supported stabs debugging. */
e3f1f242 876#define DBX_DEBUGGING_INFO
e3f1f242 877
b6c9286a
MM
878/* If we are referencing a function that is static or is known to be
879 in this file, make the SYMBOL_REF special. We can use this to indicate
880 that we can branch to this function without emitting a no-op after the
9ebbca7d 881 call. For real AIX calling sequences, we also replace the
b6c9286a
MM
882 function name with the real name (1 or 2 leading .'s), rather than
883 the function descriptor name. This saves a lot of overriding code
9ebbca7d 884 to read the prefixes. */
b6c9286a
MM
885
886#undef ENCODE_SECTION_INFO
9ebbca7d 887#define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL)
d9407988 888
9ebbca7d
GK
889/* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
890
891#define RS6000_OUTPUT_BASENAME(FILE, NAME) \
892 assemble_name (FILE, NAME)
b6c9286a 893
24ba1fb8
MM
894/* This macro gets just the user-specified name
895 out of the string in a SYMBOL_REF. Discard
9ebbca7d
GK
896 a leading * or @. */
897#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
6fa02a05 898do { \
ec940faa 899 const char *_name = SYMBOL_NAME; \
6fa02a05
MM
900 while (*_name == '*' || *_name == '@') \
901 _name++; \
902 (VAR) = _name; \
903} while (0)
7509c759
MM
904
905/* This is how to output a reference to a user-level label named NAME.
906 `assemble_name' uses this. */
907
9ebbca7d
GK
908/* Override elfos.h definition. */
909#undef ASM_OUTPUT_LABELREF
910#define ASM_OUTPUT_LABELREF(FILE,NAME) \
911do { \
912 const char *_name = NAME; \
913 if (*_name == '@') \
914 _name++; \
915 \
916 if (*_name == '*') \
917 fprintf (FILE, "%s", _name + 1); \
918 else \
919 asm_fprintf (FILE, "%U%s", _name); \
6fa02a05 920} while (0)
24ba1fb8 921
e3f1f242
MM
922/* But, to make this work, we have to output the stabs for the function
923 name *first*... */
924
925#define DBX_FUNCTION_FIRST
926
927/* This is the end of what might become sysv4dbx.h. */
928
9ebbca7d
GK
929/* Override rs6000.h definition. */
930#undef TARGET_VERSION
931#define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
4697a36c 932\f
9ebbca7d 933#define CPP_PREDEFINES \
2b57e919 934 "-DPPC -Dunix -D__svr4__ -Asystem=unix -Asystem=svr4 -Acpu=powerpc -Amachine=powerpc"
c2baf133 935
9ebbca7d
GK
936/* Pass various options to the assembler. */
937/* Override svr4.h definition. */
938#undef ASM_SPEC
939#define ASM_SPEC "%(asm_cpu) \
38c1f2d7 940%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
c81bebd7 941%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
3201f6d9 942%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
b872164e 943%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
c81bebd7
MM
944%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
945%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
bef84347 946 %{mcall-solaris: -mlittle -msolaris} \
c36ae96c 947 %{mcall-i960-old: -mlittle} \
edf1b3f3
AC
948 %{mcall-linux: -mbig} \
949 %{mcall-netbsd: -mbig} }}}}"
bef84347 950
9ebbca7d 951#define CC1_ENDIAN_BIG_SPEC ""
bef84347 952
9ebbca7d 953#define CC1_ENDIAN_LITTLE_SPEC "\
bef84347 954%{!mstrict-align: %{!mno-strict-align: \
c36ae96c 955 %{!mcall-i960-old: \
bef84347 956 -mstrict-align \
c36ae96c 957 } \
bef84347 958}}"
bef84347 959
9ebbca7d 960#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big_spec)"
c81bebd7 961
9ebbca7d
GK
962/* Pass -G xxx to the compiler and set correct endian mode. */
963#define CC1_SPEC "%{G*} \
bef84347
VM
964%{mlittle: %(cc1_endian_little)} %{!mlittle: %{mlittle-endian: %(cc1_endian_little)}} \
965%{mbig: %(cc1_endian_big)} %{!mbig: %{mbig-endian: %(cc1_endian_big)}} \
56e4a0eb 966%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
56e4a0eb
JW
967 %{mcall-aixdesc: -mbig %(cc1_endian_big) } \
968 %{mcall-solaris: -mlittle %(cc1_endian_little) } \
c36ae96c 969 %{mcall-i960-old: -mlittle %(cc1_endian_little) } \
56e4a0eb 970 %{mcall-linux: -mbig %(cc1_endian_big) } \
edf1b3f3
AC
971 %{mcall-netbsd: -mbig %(cc1_endian_big) } \
972 %{!mcall-aixdesc: %{!mcall-solaris: %{!mcall-i960-old: %{!mcall-linux: %{!mcall-netbsd: \
bef84347 973 %(cc1_endian_default) \
edf1b3f3 974 }}}}} \
56e4a0eb 975}}}} \
5c7ad97f 976%{mcall-solaris: -mregnames } \
d9407988 977%{mno-sdata: -msdata=none } \
c81bebd7
MM
978%{meabi: %{!mcall-*: -mcall-sysv }} \
979%{!meabi: %{!mno-eabi: \
802a0058 980 %{mrelocatable: -meabi } \
c81bebd7 981 %{mcall-solaris: -mno-eabi } \
c36ae96c 982 %{mcall-i960-old: -meabi } \
edf1b3f3
AC
983 %{mcall-linux: -mno-eabi } \
984 %{mcall-netbsd: -mno-eabi }}} \
38c1f2d7 985%{msdata: -msdata=default} \
d540a32c
FS
986%{mno-sdata: -msdata=none} \
987%{profile: -p}"
c81bebd7 988
9ebbca7d 989/* Don't put -Y P,<path> for cross compilers. */
7509c759
MM
990#ifndef CROSS_COMPILE
991#define LINK_PATH_SPEC "\
d6a2af95 992%{!R*:%{L*:-R %*}} \
fba29a8c
MM
993%{!nostdlib: %{!YP,*: \
994 %{compat-bsd: \
995 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
996 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
997 %{!R*: %{!L*: -R /usr/ucblib}} \
998 %{!compat-bsd: \
999 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1000 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
7509c759 1001
113166a6 1002#else
7509c759
MM
1003#define LINK_PATH_SPEC ""
1004#endif
75814ad4 1005
9ebbca7d 1006/* Default starting address if specified. */
c81bebd7 1007#define LINK_START_SPEC "\
e9a25f70
JL
1008%{mads: %(link_start_ads) } \
1009%{myellowknife: %(link_start_yellowknife) } \
c81bebd7
MM
1010%{mmvme: %(link_start_mvme) } \
1011%{msim: %(link_start_sim) } \
1012%{mcall-linux: %(link_start_linux) } \
edf1b3f3 1013%{mcall-netbsd: %(link_start_netbsd) } \
c81bebd7 1014%{mcall-solaris: %(link_start_solaris) } \
edf1b3f3 1015%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-solaris: %(link_start_default) }}}}}}}"
c81bebd7 1016
9da71b16 1017#define LINK_START_DEFAULT_SPEC ""
c81bebd7 1018
9ebbca7d
GK
1019/* Override svr4.h definition. */
1020#undef LINK_SPEC
1021#define LINK_SPEC "\
48a0fabb 1022%{h*} %{v:-V} %{G*} \
51610b0a 1023%{YP,*} %{R*} \
fba29a8c
MM
1024%{Qy:} %{!Qn:-Qy} \
1025%(link_shlib) \
362c63a5 1026%{!Wl,-T*: %{!T*: %(link_start) }} \
fba29a8c
MM
1027%(link_target) \
1028%(link_os)"
1029
1030/* For now, turn off shared libraries by default. */
1031#ifndef SHARED_LIB_SUPPORT
1032#define NO_SHARED_LIB_SUPPORT
1033#endif
1034
fba29a8c 1035#ifndef NO_SHARED_LIB_SUPPORT
956d6950 1036/* Shared libraries are default. */
fba29a8c
MM
1037#define LINK_SHLIB_SPEC "\
1038%{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
1039%{mshlib: } \
afec0ea9 1040%{static:-dn -Bstatic} \
8b496c8d
ILT
1041%{shared:-G -dy -z text} \
1042%{symbolic:-Bsymbolic -G -dy -z text}"
fba29a8c
MM
1043
1044#else
1045/* Shared libraries are not default. */
1046#define LINK_SHLIB_SPEC "\
d6a2af95 1047%{mshlib: %(link_path) } \
fba29a8c
MM
1048%{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
1049%{static: } \
8b496c8d
ILT
1050%{shared:-G -dy -z text %(link_path) } \
1051%{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
fba29a8c
MM
1052#endif
1053
1054/* Override the default target of the linker. */
fba29a8c 1055#define LINK_TARGET_SPEC "\
36b8ffbe 1056%{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
9ebbca7d 1057%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
c36ae96c 1058 %{mcall-i960-old: --oformat elf32-powerpcle} \
36b8ffbe 1059 %{mcall-solaris: --oformat elf32-powerpcle} \
9ebbca7d 1060 }}}}"
fba29a8c 1061
9ebbca7d 1062/* Any specific OS flags. */
fba29a8c 1063#define LINK_OS_SPEC "\
e9a25f70
JL
1064%{mads: %(link_os_ads) } \
1065%{myellowknife: %(link_os_yellowknife) } \
fba29a8c
MM
1066%{mmvme: %(link_os_mvme) } \
1067%{msim: %(link_os_sim) } \
1068%{mcall-linux: %(link_os_linux) } \
edf1b3f3 1069%{mcall-netbsd: %(link_os_netbsd) } \
fba29a8c 1070%{mcall-solaris: %(link_os_solaris) } \
edf1b3f3 1071%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-solaris: %(link_os_default) }}}}}}}"
c81bebd7 1072
fba29a8c 1073#define LINK_OS_DEFAULT_SPEC ""
afec0ea9 1074
841faeed 1075#define CPP_SYSV_SPEC \
3cfa4909 1076"%{mrelocatable*: -D_RELOCATABLE} \
5b9d9a0c 1077%{fpic: -D__PIC__=1 -D__pic__=1} \
d540a32c 1078%{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}} \
e0f7170a
GK
1079%{mlong-double-128: -D__LONG_DOUBLE_128__=1} \
1080%{!mlong-double-64: %(cpp_longdouble_default)} \
9ebbca7d 1081%{mcall-sysv: -D_CALL_SYSV} \
b6c9286a 1082%{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
9ebbca7d
GK
1083%{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %(cpp_sysv_default) }}} \
1084%{msoft-float: -D_SOFT_FLOAT} \
1085%{!msoft-float: %{!mhard-float: \
1086 %{mcpu=401: -D_SOFT_FLOAT} \
1087 %{mcpu=403: -D_SOFT_FLOAT} \
1088 %{mcpu=ec603e: -D_SOFT_FLOAT} \
1089 %{mcpu=801: -D_SOFT_FLOAT} \
1090 %{mcpu=821: -D_SOFT_FLOAT} \
1091 %{mcpu=823: -D_SOFT_FLOAT} \
1092 %{mcpu=860: -D_SOFT_FLOAT} \
1093 %{!mcpu*: %(cpp_float_default) }}}"
1094
1095/* Whether floating point is disabled by default. */
1096#define CPP_FLOAT_DEFAULT_SPEC ""
841faeed 1097
e0f7170a
GK
1098/* Whether 'long double' is 128 bits by default. */
1099#define CPP_LONGDOUBLE_DEFAULT_SPEC ""
1100
841faeed
MM
1101#define CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
1102
2bfcf297 1103#define CPP_ENDIAN_BIG_SPEC "-D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine=bigendian"
5b9d9a0c 1104
2bfcf297 1105#define CPP_ENDIAN_LITTLE_SPEC "-D_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -Amachine=littleendian"
5b9d9a0c 1106
2bfcf297 1107#define CPP_ENDIAN_SOLARIS_SPEC "-D__LITTLE_ENDIAN__ -Amachine=littleendian"
5b9d9a0c 1108
c81bebd7 1109/* For solaris, don't define _LITTLE_ENDIAN, it conflicts with a header file. */
841faeed 1110#define CPP_ENDIAN_SPEC \
5b9d9a0c
MM
1111"%{mlittle: %(cpp_endian_little) } \
1112%{mlittle-endian: %(cpp_endian_little) } \
1113%{mbig: %(cpp_endian_big) } \
1114%{mbig-endian: %(cpp_endian_big) } \
c81bebd7 1115%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
5b9d9a0c 1116 %{mcall-solaris: %(cpp_endian_solaris) } \
5b9d9a0c 1117 %{mcall-linux: %(cpp_endian_big) } \
edf1b3f3 1118 %{mcall-netbsd: %(cpp_endian_big) } \
c36ae96c 1119 %{mcall-i960-old: %(cpp_endian_little) } \
5b9d9a0c 1120 %{mcall-aixdesc: %(cpp_endian_big) } \
edf1b3f3 1121 %{!mcall-solaris: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-aixdesc: %(cpp_endian_default) }}}}}}}}"
c81bebd7 1122
5b9d9a0c 1123#define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
841faeed 1124
9ebbca7d
GK
1125/* Override rs6000.h definition. */
1126#undef CPP_SPEC
1127#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
e9a25f70
JL
1128%{mads: %(cpp_os_ads) } \
1129%{myellowknife: %(cpp_os_yellowknife) } \
c81bebd7
MM
1130%{mmvme: %(cpp_os_mvme) } \
1131%{msim: %(cpp_os_sim) } \
1132%{mcall-linux: %(cpp_os_linux) } \
edf1b3f3 1133%{mcall-netbsd: %(cpp_os_netbsd) } \
c81bebd7 1134%{mcall-solaris: %(cpp_os_solaris) } \
edf1b3f3 1135%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-solaris: %(cpp_os_default) }}}}}}}"
c81bebd7 1136
9ebbca7d 1137#define CPP_OS_DEFAULT_SPEC ""
c81bebd7 1138
9ebbca7d
GK
1139/* Override svr4.h definition. */
1140#undef STARTFILE_SPEC
c81bebd7 1141#define STARTFILE_SPEC "\
e9a25f70
JL
1142%{mads: %(startfile_ads) } \
1143%{myellowknife: %(startfile_yellowknife) } \
c81bebd7
MM
1144%{mmvme: %(startfile_mvme) } \
1145%{msim: %(startfile_sim) } \
1146%{mcall-linux: %(startfile_linux) } \
edf1b3f3 1147%{mcall-netbsd: %(startfile_netbsd) } \
c81bebd7 1148%{mcall-solaris: %(startfile_solaris) } \
edf1b3f3 1149%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-solaris: %(startfile_default) }}}}}}}"
c81bebd7 1150
c81bebd7
MM
1151#define STARTFILE_DEFAULT_SPEC ""
1152
9ebbca7d 1153/* Override svr4.h definition. */
c81bebd7
MM
1154#undef LIB_SPEC
1155#define LIB_SPEC "\
e9a25f70
JL
1156%{mads: %(lib_ads) } \
1157%{myellowknife: %(lib_yellowknife) } \
c81bebd7
MM
1158%{mmvme: %(lib_mvme) } \
1159%{msim: %(lib_sim) } \
1160%{mcall-linux: %(lib_linux) } \
edf1b3f3 1161%{mcall-netbsd: %(lib_netbsd) } \
c81bebd7 1162%{mcall-solaris: %(lib_solaris) } \
edf1b3f3 1163%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-solaris: %(lib_default) }}}}}}}"
c81bebd7 1164
9da71b16 1165#define LIB_DEFAULT_SPEC ""
9da71b16 1166
9ebbca7d 1167/* Override svr4.h definition. */
c81bebd7
MM
1168#undef ENDFILE_SPEC
1169#define ENDFILE_SPEC "\
362c63a5
GK
1170%{mads: %(endfile_ads)} \
1171%{myellowknife: %(endfile_yellowknife)} \
1172%{mmvme: %(endfile_mvme)} \
1173%{msim: %(endfile_sim)} \
03453a9f 1174%{mcall-linux: %(endfile_linux) } \
edf1b3f3 1175%{mcall-netbsd: %(endfile_netbsd) } \
362c63a5 1176%{mcall-solaris: %(endfile_solaris)} \
9ebbca7d 1177%{mvxworks: %(endfile_vxworks) } \
edf1b3f3 1178%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-solaris: %{!mvxworks: %(endfile_default) }}}}}}}}"
c81bebd7 1179
c81bebd7
MM
1180#define ENDFILE_DEFAULT_SPEC ""
1181
e9a25f70 1182/* Motorola ADS support. */
e9a25f70 1183#define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
e9a25f70 1184
362c63a5 1185#define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
e9a25f70 1186
362c63a5 1187#define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
e9a25f70 1188
e9a25f70 1189#define LINK_START_ADS_SPEC "-T ads.ld%s"
e9a25f70 1190
e9a25f70 1191#define LINK_OS_ADS_SPEC ""
e9a25f70 1192
e9a25f70 1193#define CPP_OS_ADS_SPEC ""
e9a25f70
JL
1194
1195/* Motorola Yellowknife support. */
e9a25f70 1196#define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
e9a25f70 1197
362c63a5 1198#define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
e9a25f70 1199
362c63a5 1200#define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
e9a25f70 1201
e9a25f70 1202#define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
e9a25f70 1203
e9a25f70 1204#define LINK_OS_YELLOWKNIFE_SPEC ""
e9a25f70 1205
e9a25f70 1206#define CPP_OS_YELLOWKNIFE_SPEC ""
e9a25f70 1207
c81bebd7 1208/* Motorola MVME support. */
e9a25f70 1209#define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
c81bebd7 1210
362c63a5 1211#define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
c81bebd7 1212
362c63a5 1213#define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
c81bebd7 1214
362c63a5 1215#define LINK_START_MVME_SPEC "-Ttext 0x40000"
c81bebd7 1216
fba29a8c 1217#define LINK_OS_MVME_SPEC ""
fba29a8c 1218
c81bebd7 1219#define CPP_OS_MVME_SPEC ""
c81bebd7
MM
1220
1221/* PowerPC simulator based on netbsd system calls support. */
e9a25f70 1222#define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
c81bebd7 1223
362c63a5 1224#define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
c81bebd7 1225
362c63a5 1226#define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
c81bebd7 1227
362c63a5 1228#define LINK_START_SIM_SPEC ""
c81bebd7 1229
362c63a5 1230#define LINK_OS_SIM_SPEC "-m elf32ppcsim"
fba29a8c 1231
c81bebd7 1232#define CPP_OS_SIM_SPEC ""
c81bebd7 1233
956d6950 1234/* GNU/Linux support. */
d540a32c
FS
1235#ifdef USE_GNULIBC_1
1236#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1237%{!mnewlib: -lc }"
1238#else
1239#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1240%{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1241%{profile:-lc_p} %{!profile:-lc}}}"
1242#endif
c81bebd7 1243
9a57586f
MM
1244#define STARTFILE_LINUX_SPEC "\
1245%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
b26e3a82 1246%{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
362c63a5 1247%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
c81bebd7 1248
362c63a5
GK
1249#define ENDFILE_LINUX_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1250%{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
c81bebd7 1251
362c63a5 1252#define LINK_START_LINUX_SPEC ""
c81bebd7 1253
362c63a5
GK
1254#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1255 %{rdynamic:-export-dynamic} \
1256 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
fba29a8c 1257
d540a32c 1258#ifdef USE_GNULIBC_1
5a1b894d
FS
1259#define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1260%{!undef: \
1261 %{!ansi: \
1262 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1263 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
2b57e919 1264-Asystem=unix -Asystem=posix"
d540a32c 1265#else
5a1b894d
FS
1266#define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1267%{!undef: \
1268 %{!ansi: \
1269 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1270 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
2b57e919 1271-Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
d540a32c 1272#endif
c81bebd7 1273
edf1b3f3
AC
1274/* NetBSD support. */
1275#define LIB_NETBSD_SPEC "\
1276%{profile:-lgmon -lc_p} %{!profile:-lc}"
1277
1278#define STARTFILE_NETBSD_SPEC "\
1279ncrti.o%s crt0.o%s \
1280%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1281
1282#define ENDFILE_NETBSD_SPEC "\
1283%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1284ncrtn.o%s"
1285
1286#define LINK_START_NETBSD_SPEC "\
1287"
1288
1289#define LINK_OS_NETBSD_SPEC "\
1290%{!shared: %{!static: \
1291 %{rdynamic:-export-dynamic} \
1292 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
1293
1294#define CPP_OS_NETBSD_SPEC "\
1295-D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__"
1296
c81bebd7
MM
1297/* Solaris support. */
1298/* For Solaris, Gcc automatically adds in one of the files
1299 /usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
1300 /usr/ccs/lib/values-Xt.o for each final link step (depending upon the other
1301 gcc options selected, such as -traditional and -ansi). These files each
1302 contain one (initialized) copy of a special variable called `_lib_version'.
1303 Each one of these files has `_lib_version' initialized to a different (enum)
1304 value. The SVR4 library routines query the value of `_lib_version' at run
1305 to decide how they should behave. Specifically, they decide (based upon the
1306 value of `_lib_version') if they will act in a strictly ANSI conforming
1307 manner or not. */
1308
c81bebd7 1309#define LIB_SOLARIS_SPEC "\
e9a25f70 1310%{mnewlib: --start-group -lsolaris -lc --end-group } \
c81bebd7
MM
1311%{!mnewlib: \
1312 %{ansi:values-Xc.o%s} \
1313 %{!ansi: \
1314 %{traditional:values-Xt.o%s} \
1315 %{!traditional:values-Xa.o%s}} \
1316 %{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
f7856bbc 1317 %{solaris-cclib: /opt/SUNWspro/SC4.0/lib/libabi.a} \
35cf49d4 1318 %{!shared: %{!symbolic: -lc }}}"
c81bebd7 1319
0bc25b2b
MM
1320#define STARTFILE_SOLARIS_SPEC "\
1321%{!msolaris-cclib: scrti.o%s scrt0.o%s} \
362c63a5
GK
1322%{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crti.o%s /opt/SUNWspro/SC4.0/lib/crt1.o%s} \
1323%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
c81bebd7 1324
0bc25b2b 1325#define ENDFILE_SOLARIS_SPEC "\
362c63a5 1326%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
0bc25b2b 1327%{!msolaris-cclib: scrtn.o%s} \
f7856bbc 1328%{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crtn.o%s}"
c81bebd7 1329
c81bebd7 1330#define LINK_START_SOLARIS_SPEC ""
c81bebd7 1331
fba29a8c 1332#define LINK_OS_SOLARIS_SPEC ""
fba29a8c 1333
c81bebd7 1334#define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__ -D__SVR4__ \
f58f9450
DJ
1335%{!undef:%{!ansi:%{!std=*:-Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__} \
1336 %{std=gnu*:-Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__}}} \
2b57e919 1337-Amachine=prep"
9ebbca7d
GK
1338
1339/* VxWorks support. */
1340/* VxWorks does all the library stuff itself. */
1341#define LIB_VXWORKS_SPEC ""
1342
1343/* VxWorks provides the functionality of crt0.o and friends itself. */
1344
1345#define STARTFILE_VXWORKS_SPEC ""
1346
1347#define ENDFILE_VXWORKS_SPEC ""
1348
1349/* Because it uses ld -r, vxworks has no start/end files, nor starting
1350 address. */
1351
1352#define LINK_START_VXWORKS_SPEC ""
1353
1354#define LINK_OS_VXWORKS_SPEC "-r"
1355
1356#define CPP_OS_VXWORKS_SPEC "\
1357-DCPU_FAMILY=PPC \
1358%{!mcpu*: \
1359 %{mpowerpc*: -DCPU=PPC603} \
1360 %{!mno-powerpc: -DCPU=PPC603}} \
1361%{mcpu=powerpc: -DCPU=PPC603} \
1362%{mcpu=401: -DCPU=PPC403} \
1363%{mcpu=403: -DCPU=PPC403} \
1364%{mcpu=601: -DCPU=PPC601} \
1365%{mcpu=602: -DCPU=PPC603} \
1366%{mcpu=603: -DCPU=PPC603} \
1367%{mcpu=603e: -DCPU=PPC603} \
1368%{mcpu=ec603e: -DCPU=PPC603} \
1369%{mcpu=604: -DCPU=PPC604} \
1370%{mcpu=604e: -DCPU=PPC604} \
1371%{mcpu=620: -DCPU=PPC604} \
1372%{mcpu=740: -DCPU=PPC603} \
1373%{mcpu=750: -DCPU=PPC603} \
1374%{mcpu=801: -DCPU=PPC603} \
1375%{mcpu=821: -DCPU=PPC603} \
1376%{mcpu=823: -DCPU=PPC603} \
1377%{mcpu=860: -DCPU=PPC603}"
c81bebd7
MM
1378
1379/* Define any extra SPECS that the compiler needs to generate. */
9ebbca7d 1380/* Override rs6000.h definition. */
c81bebd7 1381#undef SUBTARGET_EXTRA_SPECS
9ebbca7d
GK
1382#define SUBTARGET_EXTRA_SPECS \
1383 { "cpp_sysv", CPP_SYSV_SPEC }, \
1384 { "cpp_sysv_default", CPP_SYSV_DEFAULT_SPEC }, \
1385 { "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
1386 { "cpp_endian", CPP_ENDIAN_SPEC }, \
e9a25f70
JL
1387 { "lib_ads", LIB_ADS_SPEC }, \
1388 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
c81bebd7
MM
1389 { "lib_mvme", LIB_MVME_SPEC }, \
1390 { "lib_sim", LIB_SIM_SPEC }, \
1391 { "lib_linux", LIB_LINUX_SPEC }, \
edf1b3f3 1392 { "lib_netbsd", LIB_NETBSD_SPEC }, \
c81bebd7 1393 { "lib_solaris", LIB_SOLARIS_SPEC }, \
9ebbca7d 1394 { "lib_vxworks", LIB_VXWORKS_SPEC }, \
c81bebd7 1395 { "lib_default", LIB_DEFAULT_SPEC }, \
e9a25f70
JL
1396 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1397 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
c81bebd7
MM
1398 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1399 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1400 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
edf1b3f3 1401 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
c81bebd7 1402 { "startfile_solaris", STARTFILE_SOLARIS_SPEC }, \
9ebbca7d 1403 { "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \
c81bebd7 1404 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
e9a25f70
JL
1405 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1406 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
c81bebd7
MM
1407 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1408 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1409 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
edf1b3f3 1410 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
c81bebd7 1411 { "endfile_solaris", ENDFILE_SOLARIS_SPEC }, \
9ebbca7d 1412 { "endfile_vxworks", ENDFILE_VXWORKS_SPEC }, \
c81bebd7 1413 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
fba29a8c
MM
1414 { "link_path", LINK_PATH_SPEC }, \
1415 { "link_shlib", LINK_SHLIB_SPEC }, \
1416 { "link_target", LINK_TARGET_SPEC }, \
83cd7147 1417 { "link_start", LINK_START_SPEC }, \
e9a25f70
JL
1418 { "link_start_ads", LINK_START_ADS_SPEC }, \
1419 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
c81bebd7
MM
1420 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1421 { "link_start_sim", LINK_START_SIM_SPEC }, \
1422 { "link_start_linux", LINK_START_LINUX_SPEC }, \
edf1b3f3 1423 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
c81bebd7 1424 { "link_start_solaris", LINK_START_SOLARIS_SPEC }, \
9ebbca7d 1425 { "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \
c81bebd7 1426 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
fba29a8c 1427 { "link_os", LINK_OS_SPEC }, \
e9a25f70
JL
1428 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1429 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
fba29a8c
MM
1430 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1431 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1432 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
edf1b3f3 1433 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
fba29a8c 1434 { "link_os_solaris", LINK_OS_SOLARIS_SPEC }, \
9ebbca7d 1435 { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \
fba29a8c 1436 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
bef84347
VM
1437 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1438 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1439 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
5b9d9a0c
MM
1440 { "cpp_endian_big", CPP_ENDIAN_BIG_SPEC }, \
1441 { "cpp_endian_little", CPP_ENDIAN_LITTLE_SPEC }, \
1442 { "cpp_endian_solaris", CPP_ENDIAN_SOLARIS_SPEC }, \
9ebbca7d 1443 { "cpp_float_default", CPP_FLOAT_DEFAULT_SPEC }, \
e0f7170a 1444 { "cpp_longdouble_default", CPP_LONGDOUBLE_DEFAULT_SPEC }, \
e9a25f70
JL
1445 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1446 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
c81bebd7
MM
1447 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1448 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1449 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
edf1b3f3 1450 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
c81bebd7 1451 { "cpp_os_solaris", CPP_OS_SOLARIS_SPEC }, \
9ebbca7d 1452 { "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \
fba29a8c 1453 { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
b6c9286a
MM
1454
1455/* Define this macro as a C expression for the initializer of an
1456 array of string to tell the driver program which options are
1457 defaults for this target and thus do not need to be handled
1458 specially when using `MULTILIB_OPTIONS'.
1459
1460 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1461 the target makefile fragment or if none of the options listed in
1462 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1463
3807773b 1464#define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
38c1f2d7
MM
1465
1466/* Define this macro if the code for function profiling should come
1467 before the function prologue. Normally, the profiling code comes
1468 after. */
1469#define PROFILE_BEFORE_PROLOGUE 1
1470
1471/* Function name to call to do profiling. */
38c1f2d7 1472#define RS6000_MCOUNT "_mcount"
e0f7170a 1473
edf11378
FS
1474/* Define this macro (to a value of 1) if you want to support the
1475 Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1476 pack(pop)'. The pack(push,<n>) pragma specifies the maximum
1477 alignment (in bytes) of fields within a structure, in much the
1478 same way as the __aligned__' and __packed__' __attribute__'s
1479 do. A pack value of zero resets the behaviour to the default.
1480 Successive invocations of this pragma cause the previous values to
1481 be stacked, so that invocations of #pragma pack(pop)' will return
1482 to the previous value. */
1483
1484#define HANDLE_PRAGMA_PACK_PUSH_POP 1
1485
e0f7170a
GK
1486/* Define library calls for quad FP operations. These are all part of the
1487 PowerPC 32bit ABI. */
1488#define ADDTF3_LIBCALL "_q_add"
1489#define DIVTF3_LIBCALL "_q_div"
1490#define EXTENDDFTF2_LIBCALL "_q_dtoq"
1491#define EQTF2_LIBCALL "_q_feq"
1492#define GETF2_LIBCALL "_q_fge"
1493#define GTTF2_LIBCALL "_q_fgt"
1494#define LETF2_LIBCALL "_q_fle"
1495#define LTTF2_LIBCALL "_q_flt"
1496#define NETF2_LIBCALL "_q_fne"
1497#define FLOATSITF2_LIBCALL "_q_itoq"
1498#define MULTF3_LIBCALL "_q_mul"
1499#define NEGTF2_LIBCALL "_q_neg"
1500#define TRUNCTFDF2_LIBCALL "_q_qtod"
1501#define FIX_TRUNCTFSI2_LIBCALL "_q_qtoi"
1502#define TRUNCTFSF2_LIBCALL "_q_qtos"
1503#define FIXUNS_TRUNCTFSI2_LIBCALL "_q_qtou"
1504#define SQRTTF_LIBCALL "_q_sqrt"
1505#define EXTENDSFTF2_LIBCALL "_q_stoq"
1506#define SUBTF3_LIBCALL "_q_sub"
1507#define FLOATUNSSITF2_LIBCALL "_q_utoq"
1508
1509#define INIT_TARGET_OPTABS \
1510 do { \
1511 if (TARGET_HARD_FLOAT) \
1512 { \
1513 add_optab->handlers[(int) TFmode].libfunc \
1514 = init_one_libfunc (ADDTF3_LIBCALL); \
1515 sub_optab->handlers[(int) TFmode].libfunc \
1516 = init_one_libfunc (SUBTF3_LIBCALL); \
1517 neg_optab->handlers[(int) TFmode].libfunc \
1518 = init_one_libfunc (NEGTF2_LIBCALL); \
1519 smul_optab->handlers[(int) TFmode].libfunc \
1520 = init_one_libfunc (MULTF3_LIBCALL); \
ef89d648 1521 sdiv_optab->handlers[(int) TFmode].libfunc \
e0f7170a
GK
1522 = init_one_libfunc (DIVTF3_LIBCALL); \
1523 eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL); \
1524 netf2_libfunc = init_one_libfunc (NETF2_LIBCALL); \
1525 gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL); \
1526 getf2_libfunc = init_one_libfunc (GETF2_LIBCALL); \
1527 lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL); \
1528 letf2_libfunc = init_one_libfunc (LETF2_LIBCALL); \
1529 trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL); \
1530 trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL); \
1531 extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL); \
1532 extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL); \
1533 floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL); \
1534 fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL); \
1535 fixunstfsi_libfunc \
1536 = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL); \
1537 if (TARGET_PPC_GPOPT || TARGET_POWER2) \
1538 sqrt_optab->handlers[(int) TFmode].libfunc \
1539 = init_one_libfunc (SQRTTF_LIBCALL); \
1540 } \
1541 } while (0)
e44713f7
GK
1542
1543/* Select a format to encode pointers in exception handling data. CODE
1544 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1545 true if the symbol may be affected by dynamic relocations. */
50c30603
GK
1546#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1547 ((flag_pic || TARGET_RELOCATABLE) \
e44713f7
GK
1548 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1549 : DW_EH_PE_absptr)
50c30603 1550
e44713f7 1551#define EXCEPTION_SECTION readonly_data_section
362b68a8 1552#define DOUBLE_INT_ASM_OP "\t.quad\t"