]>
Commit | Line | Data |
---|---|---|
e3f1f242 | 1 | /* Target definitions for GNU compiler for PowerPC running System V.4 |
38a3dbbb | 2 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
e556ad19 | 3 | 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 | |
20 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, | |
21 | MA 02111-1307, USA. */ | |
9ebbca7d | 22 | |
7bb9f927 ZW |
23 | /* Header files should be C++ aware in general. */ |
24 | #define NO_IMPLICIT_EXTERN_C | |
25 | ||
9ebbca7d GK |
26 | /* Yes! We are ELF. */ |
27 | #define TARGET_OBJECT_FORMAT OBJECT_ELF | |
28 | ||
29 | /* Default ABI to compile code for. */ | |
30 | #define DEFAULT_ABI rs6000_current_abi | |
31 | ||
32 | /* Default ABI to use. */ | |
33 | #define RS6000_ABI_NAME "sysv" | |
34 | ||
35 | /* Override rs6000.h definition. */ | |
36 | #undef ASM_DEFAULT_SPEC | |
37 | #define ASM_DEFAULT_SPEC "-mppc" | |
38 | ||
9ebbca7d | 39 | /* Small data support types. */ |
d9407988 | 40 | enum rs6000_sdata_type { |
9ebbca7d GK |
41 | SDATA_NONE, /* No small data support. */ |
42 | SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */ | |
43 | SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */ | |
44 | SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */ | |
d9407988 | 45 | }; |
d14a6d05 | 46 | |
d9407988 MM |
47 | extern enum rs6000_sdata_type rs6000_sdata; |
48 | ||
9ebbca7d GK |
49 | /* V.4/eabi switches. */ |
50 | #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */ | |
d14a6d05 | 51 | #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */ |
9ebbca7d GK |
52 | #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */ |
53 | #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */ | |
54 | #define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */ | |
55 | #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */ | |
56 | #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */ | |
06f4e019 | 57 | #define MASK_NO_BITFIELD_WORD 0x00800000 /* Bitfields cannot cross word boundaries */ |
d14a6d05 MM |
58 | |
59 | #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE) | |
9ebbca7d GK |
60 | #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN) |
61 | #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE) | |
62 | #define TARGET_EABI (target_flags & MASK_EABI) | |
63 | #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN) | |
64 | #define TARGET_REGNAMES (target_flags & MASK_REGNAMES) | |
4697a36c | 65 | #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE) |
9a155f91 | 66 | #define TARGET_NO_BITFIELD_WORD (target_flags & MASK_NO_BITFIELD_WORD) |
64d732de MM |
67 | #define TARGET_TOC ((target_flags & MASK_64BIT) \ |
68 | || ((target_flags & (MASK_RELOCATABLE \ | |
69 | | MASK_MINIMAL_TOC)) \ | |
70 | && flag_pic > 1) \ | |
9ebbca7d | 71 | || DEFAULT_ABI == ABI_AIX) |
7e69e155 MM |
72 | |
73 | #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE) | |
9ebbca7d | 74 | #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) |
4697a36c MM |
75 | #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE) |
76 | #define TARGET_NO_TOC (! TARGET_TOC) | |
9ebbca7d | 77 | #define TARGET_NO_EABI (! TARGET_EABI) |
c81bebd7 | 78 | |
d9407988 | 79 | /* Strings provided by SUBTARGET_OPTIONS */ |
815cdc52 MM |
80 | extern const char *rs6000_abi_name; |
81 | extern const char *rs6000_sdata_name; | |
c4501e62 | 82 | extern const char *rs6000_tls_size_string; /* For -mtls-size= */ |
d9407988 | 83 | |
9ebbca7d GK |
84 | /* Override rs6000.h definition. */ |
85 | #undef SUBTARGET_OPTIONS | |
c409ea0d DD |
86 | #define SUBTARGET_OPTIONS \ |
87 | { "call-", &rs6000_abi_name, N_("Select ABI calling convention"), 0}, \ | |
c4501e62 JJ |
88 | { "sdata=", &rs6000_sdata_name, N_("Select method for sdata handling"), 0}, \ |
89 | { "tls-size=", &rs6000_tls_size_string, \ | |
90 | N_("Specify bit size of immediate TLS offsets"), 0 } | |
3933e0e1 | 91 | |
88228c4b | 92 | #define SDATA_DEFAULT_SIZE 8 |
9ebbca7d GK |
93 | |
94 | /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just | |
95 | the same as -mminimal-toc. */ | |
96 | /* Override rs6000.h definition. */ | |
97 | #undef SUBTARGET_SWITCHES | |
98 | #define SUBTARGET_SWITCHES \ | |
047142d3 | 99 | { "bit-align", -MASK_NO_BITFIELD_TYPE, \ |
b0287a90 | 100 | N_("Align to the base type of the bit-field") }, \ |
047142d3 | 101 | { "no-bit-align", MASK_NO_BITFIELD_TYPE, \ |
b0287a90 | 102 | N_("Don't align to the base type of the bit-field") }, \ |
047142d3 PT |
103 | { "strict-align", MASK_STRICT_ALIGN, \ |
104 | N_("Don't assume that unaligned accesses are handled by the system") }, \ | |
105 | { "no-strict-align", -MASK_STRICT_ALIGN, \ | |
106 | N_("Assume that unaligned accesses are handled by the system") }, \ | |
107 | { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \ | |
c725bd79 | 108 | N_("Produce code relocatable at runtime") }, \ |
047142d3 | 109 | { "no-relocatable", -MASK_RELOCATABLE, \ |
c725bd79 | 110 | N_("Don't produce code relocatable at runtime") }, \ |
047142d3 | 111 | { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \ |
c725bd79 | 112 | N_("Produce code relocatable at runtime") }, \ |
047142d3 | 113 | { "no-relocatable-lib", -MASK_RELOCATABLE, \ |
c725bd79 | 114 | N_("Don't produce code relocatable at runtime") }, \ |
047142d3 | 115 | { "little-endian", MASK_LITTLE_ENDIAN, \ |
c725bd79 | 116 | N_("Produce little endian code") }, \ |
047142d3 | 117 | { "little", MASK_LITTLE_ENDIAN, \ |
c725bd79 | 118 | N_("Produce little endian code") }, \ |
047142d3 | 119 | { "big-endian", -MASK_LITTLE_ENDIAN, \ |
c725bd79 | 120 | N_("Produce big endian code") }, \ |
047142d3 | 121 | { "big", -MASK_LITTLE_ENDIAN, \ |
c725bd79 | 122 | N_("Produce big endian code") }, \ |
047142d3 PT |
123 | { "no-toc", 0, N_("no description yet") }, \ |
124 | { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \ | |
125 | { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \ | |
126 | { "prototype", MASK_PROTOTYPE, N_("no description yet") }, \ | |
127 | { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \ | |
128 | { "no-traceback", 0, N_("no description yet") }, \ | |
c725bd79 NB |
129 | { "eabi", MASK_EABI, N_("Use EABI") }, \ |
130 | { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \ | |
9a155f91 GK |
131 | { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \ |
132 | { "no-bit-word", MASK_NO_BITFIELD_WORD, \ | |
b0287a90 | 133 | N_("Do not allow bit-fields to cross word boundaries") }, \ |
047142d3 | 134 | { "regnames", MASK_REGNAMES, \ |
c725bd79 | 135 | N_("Use alternate register names") }, \ |
047142d3 | 136 | { "no-regnames", -MASK_REGNAMES, \ |
c725bd79 | 137 | N_("Don't use alternate register names") }, \ |
047142d3 PT |
138 | { "sdata", 0, N_("no description yet") }, \ |
139 | { "no-sdata", 0, N_("no description yet") }, \ | |
140 | { "sim", 0, \ | |
c725bd79 | 141 | N_("Link with libsim.a, libc.a and sim-crt0.o") }, \ |
047142d3 | 142 | { "ads", 0, \ |
c725bd79 | 143 | N_("Link with libads.a, libc.a and crt0.o") }, \ |
047142d3 | 144 | { "yellowknife", 0, \ |
c725bd79 | 145 | N_("Link with libyk.a, libc.a and crt0.o") }, \ |
047142d3 | 146 | { "mvme", 0, \ |
c725bd79 | 147 | N_("Link with libmvme.a, libc.a and crt0.o") }, \ |
047142d3 PT |
148 | { "emb", 0, \ |
149 | N_("Set the PPC_EMB bit in the ELF flags header") }, \ | |
a1ffecd9 | 150 | { "windiss", 0, N_("Use the WindISS simulator") }, \ |
047142d3 PT |
151 | { "shlib", 0, N_("no description yet") }, \ |
152 | EXTRA_SUBTARGET_SWITCHES \ | |
153 | { "newlib", 0, N_("no description yet") }, | |
9ebbca7d GK |
154 | |
155 | /* This is meant to be redefined in the host dependent files. */ | |
156 | #define EXTRA_SUBTARGET_SWITCHES | |
88228c4b | 157 | |
3933e0e1 MM |
158 | /* Sometimes certain combinations of command options do not make sense |
159 | on a particular target machine. You can define a macro | |
160 | `OVERRIDE_OPTIONS' to take account of this. This macro, if | |
161 | defined, is executed once just after all the command options have | |
162 | been parsed. | |
163 | ||
164 | The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to | |
165 | get control. */ | |
166 | ||
167 | #define SUBTARGET_OVERRIDE_OPTIONS \ | |
168 | do { \ | |
307b599c MK |
169 | extern unsigned HOST_WIDE_INT g_switch_value; \ |
170 | extern int g_switch_set; \ | |
171 | \ | |
88228c4b MM |
172 | if (!g_switch_set) \ |
173 | g_switch_value = SDATA_DEFAULT_SIZE; \ | |
174 | \ | |
c81bebd7 MM |
175 | if (!strcmp (rs6000_abi_name, "sysv")) \ |
176 | rs6000_current_abi = ABI_V4; \ | |
177 | else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \ | |
178 | { \ | |
179 | rs6000_current_abi = ABI_V4; \ | |
180 | target_flags &= ~ MASK_EABI; \ | |
181 | } \ | |
182 | else if (!strcmp (rs6000_abi_name, "sysv-eabi") \ | |
183 | || !strcmp (rs6000_abi_name, "eabi")) \ | |
184 | { \ | |
185 | rs6000_current_abi = ABI_V4; \ | |
186 | target_flags |= MASK_EABI; \ | |
187 | } \ | |
c81bebd7 MM |
188 | else if (!strcmp (rs6000_abi_name, "aixdesc")) \ |
189 | rs6000_current_abi = ABI_AIX; \ | |
b91da81f DB |
190 | else if (!strcmp (rs6000_abi_name, "freebsd")) \ |
191 | rs6000_current_abi = ABI_V4; \ | |
c81bebd7 MM |
192 | else if (!strcmp (rs6000_abi_name, "linux")) \ |
193 | rs6000_current_abi = ABI_V4; \ | |
ddb28441 RM |
194 | else if (!strcmp (rs6000_abi_name, "gnu")) \ |
195 | rs6000_current_abi = ABI_V4; \ | |
edf1b3f3 AC |
196 | else if (!strcmp (rs6000_abi_name, "netbsd")) \ |
197 | rs6000_current_abi = ABI_V4; \ | |
c36ae96c GK |
198 | else if (!strcmp (rs6000_abi_name, "i960-old")) \ |
199 | { \ | |
200 | rs6000_current_abi = ABI_V4; \ | |
201 | target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \ | |
202 | | MASK_NO_BITFIELD_WORD); \ | |
203 | target_flags &= ~MASK_STRICT_ALIGN; \ | |
204 | } \ | |
c81bebd7 MM |
205 | else \ |
206 | { \ | |
207 | rs6000_current_abi = ABI_V4; \ | |
c725bd79 | 208 | error ("bad value for -mcall-%s", rs6000_abi_name); \ |
c81bebd7 | 209 | } \ |
7509c759 | 210 | \ |
d9407988 MM |
211 | if (rs6000_sdata_name) \ |
212 | { \ | |
d9407988 | 213 | if (!strcmp (rs6000_sdata_name, "none")) \ |
38c1f2d7 | 214 | rs6000_sdata = SDATA_NONE; \ |
d9407988 MM |
215 | else if (!strcmp (rs6000_sdata_name, "data")) \ |
216 | rs6000_sdata = SDATA_DATA; \ | |
217 | else if (!strcmp (rs6000_sdata_name, "default")) \ | |
218 | rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \ | |
219 | else if (!strcmp (rs6000_sdata_name, "sysv")) \ | |
220 | rs6000_sdata = SDATA_SYSV; \ | |
221 | else if (!strcmp (rs6000_sdata_name, "eabi")) \ | |
222 | rs6000_sdata = SDATA_EABI; \ | |
223 | else \ | |
c725bd79 | 224 | error ("bad value for -msdata=%s", rs6000_sdata_name); \ |
d9407988 | 225 | } \ |
f607bc57 | 226 | else if (DEFAULT_ABI == ABI_V4) \ |
d9407988 MM |
227 | { \ |
228 | rs6000_sdata = SDATA_DATA; \ | |
84f414bc | 229 | rs6000_sdata_name = "data"; \ |
d9407988 MM |
230 | } \ |
231 | else \ | |
84f414bc MM |
232 | { \ |
233 | rs6000_sdata = SDATA_NONE; \ | |
234 | rs6000_sdata_name = "none"; \ | |
235 | } \ | |
9a57586f | 236 | \ |
d9407988 MM |
237 | if (TARGET_RELOCATABLE && \ |
238 | (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \ | |
7509c759 | 239 | { \ |
5b9d9a0c | 240 | rs6000_sdata = SDATA_DATA; \ |
c725bd79 | 241 | error ("-mrelocatable and -msdata=%s are incompatible", \ |
84f414bc | 242 | rs6000_sdata_name); \ |
7509c759 MM |
243 | } \ |
244 | \ | |
f1384257 AM |
245 | else if (flag_pic && DEFAULT_ABI != ABI_AIX \ |
246 | && (rs6000_sdata == SDATA_EABI \ | |
247 | || rs6000_sdata == SDATA_SYSV)) \ | |
84f414bc MM |
248 | { \ |
249 | rs6000_sdata = SDATA_DATA; \ | |
c725bd79 | 250 | error ("-f%s and -msdata=%s are incompatible", \ |
84f414bc MM |
251 | (flag_pic > 1) ? "PIC" : "pic", \ |
252 | rs6000_sdata_name); \ | |
253 | } \ | |
254 | \ | |
f607bc57 | 255 | if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \ |
7509c759 | 256 | { \ |
38c1f2d7 | 257 | rs6000_sdata = SDATA_NONE; \ |
c725bd79 | 258 | error ("-msdata=%s and -mcall-%s are incompatible", \ |
38c1f2d7 | 259 | rs6000_sdata_name, rs6000_abi_name); \ |
7509c759 MM |
260 | } \ |
261 | \ | |
0e5dbd9b DE |
262 | targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \ |
263 | \ | |
3933e0e1 MM |
264 | if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \ |
265 | { \ | |
266 | target_flags |= MASK_MINIMAL_TOC; \ | |
c725bd79 | 267 | error ("-mrelocatable and -mno-minimal-toc are incompatible"); \ |
3933e0e1 | 268 | } \ |
b6c9286a | 269 | \ |
9ebbca7d | 270 | if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \ |
b6c9286a MM |
271 | { \ |
272 | target_flags &= ~MASK_RELOCATABLE; \ | |
c725bd79 | 273 | error ("-mrelocatable and -mcall-%s are incompatible", \ |
c81bebd7 | 274 | rs6000_abi_name); \ |
b6c9286a MM |
275 | } \ |
276 | \ | |
9ebbca7d | 277 | if (flag_pic > 1 && rs6000_current_abi == ABI_AIX) \ |
3201f6d9 MM |
278 | { \ |
279 | flag_pic = 0; \ | |
c725bd79 | 280 | error ("-fPIC and -mcall-%s are incompatible", \ |
3201f6d9 MM |
281 | rs6000_abi_name); \ |
282 | } \ | |
283 | \ | |
c81bebd7 | 284 | if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \ |
b6c9286a MM |
285 | { \ |
286 | target_flags &= ~MASK_LITTLE_ENDIAN; \ | |
287 | error ("-mcall-aixdesc must be big endian"); \ | |
288 | } \ | |
289 | \ | |
9ebbca7d | 290 | /* Treat -fPIC the same as -mrelocatable. */ \ |
f1384257 | 291 | if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \ |
3201f6d9 | 292 | target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \ |
84f414bc MM |
293 | \ |
294 | else if (TARGET_RELOCATABLE) \ | |
295 | flag_pic = 2; \ | |
296 | \ | |
3933e0e1 | 297 | } while (0) |
75814ad4 | 298 | |
a260abc9 | 299 | |
9ebbca7d GK |
300 | /* Override rs6000.h definition. */ |
301 | #undef TARGET_DEFAULT | |
302 | #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) | |
a260abc9 | 303 | |
9ebbca7d GK |
304 | /* Override rs6000.h definition. */ |
305 | #undef PROCESSOR_DEFAULT | |
306 | #define PROCESSOR_DEFAULT PROCESSOR_PPC750 | |
e3f1f242 | 307 | |
5dead3e5 | 308 | #define FIXED_R2 1 |
5d36722d RK |
309 | /* System V.4 uses register 13 as a pointer to the small data area, |
310 | so it is not available to the normal user. */ | |
5d36722d RK |
311 | #define FIXED_R13 1 |
312 | ||
9ebbca7d GK |
313 | /* Size of the V.4 varargs area if needed. */ |
314 | /* Override rs6000.h definition. */ | |
4697a36c | 315 | #undef RS6000_VARARGS_AREA |
00dba523 | 316 | #define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0) |
4697a36c | 317 | |
9ebbca7d GK |
318 | /* Override default big endianism definitions in rs6000.h. */ |
319 | #undef BYTES_BIG_ENDIAN | |
320 | #undef WORDS_BIG_ENDIAN | |
321 | #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN) | |
322 | #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN) | |
75814ad4 | 323 | |
4d3f9f5b RK |
324 | /* Define this to set the endianness to use in libgcc2.c, which can |
325 | not depend on target_flags. */ | |
88467101 | 326 | #if !defined(__LITTLE_ENDIAN__) && !defined(__sun__) |
4d3f9f5b RK |
327 | #define LIBGCC2_WORDS_BIG_ENDIAN 1 |
328 | #else | |
329 | #define LIBGCC2_WORDS_BIG_ENDIAN 0 | |
330 | #endif | |
331 | ||
4697a36c | 332 | /* Define cutoff for using external functions to save floating point. |
9ebbca7d | 333 | Currently on V.4, always use inline stores. */ |
4697a36c MM |
334 | #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64) |
335 | ||
e9a25f70 | 336 | /* Put jump tables in read-only memory, rather than in .text. */ |
75197b37 | 337 | #define JUMP_TABLES_IN_TEXT_SECTION 0 |
e9a25f70 | 338 | |
9ebbca7d | 339 | /* Prefix and suffix to use to saving floating point. */ |
e3f1f242 MM |
340 | #define SAVE_FP_PREFIX "_savefpr_" |
341 | #define SAVE_FP_SUFFIX "_l" | |
342 | ||
9ebbca7d | 343 | /* Prefix and suffix to use to restoring floating point. */ |
e3f1f242 MM |
344 | #define RESTORE_FP_PREFIX "_restfpr_" |
345 | #define RESTORE_FP_SUFFIX "_l" | |
346 | ||
347 | /* Type used for ptrdiff_t, as a string used in a declaration. */ | |
e3f1f242 MM |
348 | #define PTRDIFF_TYPE "int" |
349 | ||
350 | /* Type used for wchar_t, as a string used in a declaration. */ | |
9ebbca7d | 351 | /* Override svr4.h definition. */ |
e3f1f242 | 352 | #undef WCHAR_TYPE |
f9317f0d | 353 | #define WCHAR_TYPE "long int" |
e3f1f242 MM |
354 | |
355 | /* Width of wchar_t in bits. */ | |
9ebbca7d | 356 | /* Override svr4.h definition. */ |
e3f1f242 | 357 | #undef WCHAR_TYPE_SIZE |
f9317f0d | 358 | #define WCHAR_TYPE_SIZE 32 |
e3f1f242 | 359 | |
9ebbca7d GK |
360 | /* Make int foo : 8 not cause structures to be aligned to an int boundary. */ |
361 | /* Override elfos.h definition. */ | |
c81bebd7 MM |
362 | #undef PCC_BITFIELD_TYPE_MATTERS |
363 | #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE) | |
364 | ||
9a155f91 GK |
365 | #undef BITFIELD_NBYTES_LIMITED |
366 | #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD) | |
367 | ||
c81bebd7 MM |
368 | /* Define this macro to be the value 1 if instructions will fail to |
369 | work if given data not on the nominal alignment. If instructions | |
bef84347 | 370 | will merely go slower in that case, define this macro as 0. */ |
c81bebd7 | 371 | #undef STRICT_ALIGNMENT |
bef84347 | 372 | #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN) |
c81bebd7 | 373 | |
61b2fbe7 MM |
374 | /* Alignment in bits of the stack boundary. Note, in order to allow building |
375 | one set of libraries with -mno-eabi instead of eabi libraries and non-eabi | |
376 | versions, just use 64 as the stack boundary. */ | |
e3f1f242 | 377 | #undef STACK_BOUNDARY |
0ac081f6 | 378 | #define STACK_BOUNDARY (TARGET_ALTIVEC_ABI ? 128 : 64) |
61b2fbe7 | 379 | |
9ebbca7d | 380 | /* Real stack boundary as mandated by the appropriate ABI. */ |
0ac081f6 | 381 | #define ABI_STACK_BOUNDARY ((TARGET_EABI && !TARGET_ALTIVEC_ABI) ? 64 : 128) |
e3f1f242 | 382 | |
3b85fe5f JJ |
383 | /* An expression for the alignment of a structure field FIELD if the |
384 | alignment computed in the usual way is COMPUTED. */ | |
385 | #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ | |
386 | ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ | |
387 | ? 128 : COMPUTED) | |
388 | ||
0ac081f6 AH |
389 | /* Define this macro as an expression for the alignment of a type |
390 | (given by TYPE as a tree node) if the alignment computed in the | |
391 | usual way is COMPUTED and the alignment explicitly specified was | |
392 | SPECIFIED. */ | |
393 | #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \ | |
394 | ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) \ | |
b8513691 AH |
395 | ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ |
396 | : MAX (COMPUTED, SPECIFIED)) | |
c81bebd7 | 397 | |
f589b741 | 398 | #undef BIGGEST_FIELD_ALIGNMENT |
e3f1f242 MM |
399 | |
400 | /* Use ELF style section commands. */ | |
401 | ||
9ebbca7d | 402 | #define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" |
e3f1f242 | 403 | |
9ebbca7d | 404 | #define DATA_SECTION_ASM_OP "\t.section\t\".data\"" |
fff4998b | 405 | |
9ebbca7d | 406 | #define BSS_SECTION_ASM_OP "\t.section\t\".bss\"" |
e3f1f242 | 407 | |
9ebbca7d GK |
408 | /* Override elfos.h definition. */ |
409 | #undef INIT_SECTION_ASM_OP | |
410 | #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\"" | |
c81bebd7 | 411 | |
9ebbca7d GK |
412 | /* Override elfos.h definition. */ |
413 | #undef FINI_SECTION_ASM_OP | |
414 | #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\"" | |
c81bebd7 | 415 | |
9ebbca7d | 416 | #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\"" |
c81bebd7 | 417 | |
9ebbca7d GK |
418 | /* Put PC relative got entries in .got2. */ |
419 | #define MINIMAL_TOC_SECTION_ASM_OP \ | |
f1384257 AM |
420 | (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \ |
421 | ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"") | |
c81bebd7 | 422 | |
9ebbca7d GK |
423 | #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\"" |
424 | #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\"" | |
f607bc57 | 425 | #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits" |
c81bebd7 | 426 | |
e3f1f242 | 427 | /* Besides the usual ELF sections, we need a toc section. */ |
9ebbca7d GK |
428 | /* Override elfos.h definition. */ |
429 | #undef EXTRA_SECTIONS | |
d48bc59a | 430 | #define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini |
e3f1f242 | 431 | |
9ebbca7d GK |
432 | /* Override elfos.h definition. */ |
433 | #undef EXTRA_SECTION_FUNCTIONS | |
434 | #define EXTRA_SECTION_FUNCTIONS \ | |
7509c759 MM |
435 | TOC_SECTION_FUNCTION \ |
436 | SDATA_SECTION_FUNCTION \ | |
437 | SDATA2_SECTION_FUNCTION \ | |
c81bebd7 MM |
438 | SBSS_SECTION_FUNCTION \ |
439 | INIT_SECTION_FUNCTION \ | |
440 | FINI_SECTION_FUNCTION | |
7509c759 | 441 | |
9ebbca7d | 442 | #define TOC_SECTION_FUNCTION \ |
e3f1f242 MM |
443 | void \ |
444 | toc_section () \ | |
445 | { \ | |
d14a6d05 MM |
446 | if (in_section != in_toc) \ |
447 | { \ | |
4697a36c | 448 | in_section = in_toc; \ |
9ebbca7d | 449 | if (DEFAULT_ABI == ABI_AIX \ |
b6c9286a MM |
450 | && TARGET_MINIMAL_TOC \ |
451 | && !TARGET_RELOCATABLE) \ | |
452 | { \ | |
453 | if (! toc_initialized) \ | |
454 | { \ | |
455 | toc_initialized = 1; \ | |
456 | fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \ | |
4977bab6 | 457 | (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \ |
b6c9286a MM |
458 | fprintf (asm_out_file, "\t.tc "); \ |
459 | ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \ | |
460 | ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \ | |
461 | fprintf (asm_out_file, "\n"); \ | |
462 | \ | |
463 | fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ | |
464 | ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \ | |
465 | fprintf (asm_out_file, " = .+32768\n"); \ | |
466 | } \ | |
467 | else \ | |
468 | fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ | |
469 | } \ | |
9ebbca7d | 470 | else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \ |
b6c9286a MM |
471 | fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \ |
472 | else \ | |
e3f1f242 | 473 | { \ |
b6c9286a MM |
474 | fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ |
475 | if (! toc_initialized) \ | |
476 | { \ | |
477 | ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \ | |
478 | fprintf (asm_out_file, " = .+32768\n"); \ | |
479 | toc_initialized = 1; \ | |
480 | } \ | |
e3f1f242 | 481 | } \ |
e3f1f242 | 482 | } \ |
301d03af RS |
483 | } \ |
484 | \ | |
485 | extern int in_toc_section PARAMS ((void)); \ | |
486 | int in_toc_section () \ | |
487 | { \ | |
488 | return in_section == in_toc; \ | |
e3f1f242 MM |
489 | } |
490 | ||
9ebbca7d | 491 | #define SDATA_SECTION_FUNCTION \ |
7509c759 MM |
492 | void \ |
493 | sdata_section () \ | |
494 | { \ | |
495 | if (in_section != in_sdata) \ | |
496 | { \ | |
497 | in_section = in_sdata; \ | |
498 | fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \ | |
499 | } \ | |
500 | } | |
501 | ||
9ebbca7d | 502 | #define SDATA2_SECTION_FUNCTION \ |
7509c759 MM |
503 | void \ |
504 | sdata2_section () \ | |
505 | { \ | |
506 | if (in_section != in_sdata2) \ | |
507 | { \ | |
508 | in_section = in_sdata2; \ | |
509 | fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \ | |
510 | } \ | |
511 | } | |
512 | ||
9ebbca7d | 513 | #define SBSS_SECTION_FUNCTION \ |
7509c759 MM |
514 | void \ |
515 | sbss_section () \ | |
516 | { \ | |
517 | if (in_section != in_sbss) \ | |
518 | { \ | |
519 | in_section = in_sbss; \ | |
520 | fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \ | |
521 | } \ | |
e3f1f242 MM |
522 | } |
523 | ||
9ebbca7d | 524 | #define INIT_SECTION_FUNCTION \ |
c81bebd7 MM |
525 | void \ |
526 | init_section () \ | |
527 | { \ | |
528 | if (in_section != in_init) \ | |
529 | { \ | |
530 | in_section = in_init; \ | |
531 | fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \ | |
532 | } \ | |
533 | } | |
534 | ||
9ebbca7d | 535 | #define FINI_SECTION_FUNCTION \ |
c81bebd7 MM |
536 | void \ |
537 | fini_section () \ | |
538 | { \ | |
539 | if (in_section != in_fini) \ | |
540 | { \ | |
541 | in_section = in_fini; \ | |
542 | fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \ | |
543 | } \ | |
544 | } | |
545 | ||
b64a1b53 RH |
546 | /* Override default elf definitions. */ |
547 | #undef TARGET_ASM_SELECT_RTX_SECTION | |
548 | #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section | |
ae46c4e0 RH |
549 | #undef TARGET_ASM_SELECT_SECTION |
550 | #define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section | |
ae46c4e0 | 551 | #define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section |
7509c759 | 552 | |
a0ab749a | 553 | /* Return nonzero if this entry is to be written into the constant pool |
b6c9286a MM |
554 | in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST |
555 | containing one of them. If -mfp-in-toc (the default), we also do | |
556 | this for floating-point constants. We actually can only do this | |
557 | if the FP formats of the target and host machines are the same, but | |
558 | we can't check that since not every file that uses | |
559 | GO_IF_LEGITIMATE_ADDRESS_P includes real.h. | |
560 | ||
956d6950 | 561 | Unlike AIX, we don't key off of -mminimal-toc, but instead do not |
b6c9286a MM |
562 | allow floating point constants in the TOC if -mrelocatable. */ |
563 | ||
564 | #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P | |
a9098fd0 | 565 | #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ |
b6c9286a MM |
566 | (TARGET_TOC \ |
567 | && (GET_CODE (X) == SYMBOL_REF \ | |
568 | || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ | |
569 | && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \ | |
570 | || GET_CODE (X) == LABEL_REF \ | |
a9098fd0 GK |
571 | || (GET_CODE (X) == CONST_INT \ |
572 | && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ | |
b6c9286a MM |
573 | || (!TARGET_NO_FP_IN_TOC \ |
574 | && !TARGET_RELOCATABLE \ | |
575 | && GET_CODE (X) == CONST_DOUBLE \ | |
576 | && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ | |
577 | && BITS_PER_WORD == HOST_BITS_PER_INT))) | |
578 | ||
e3f1f242 MM |
579 | /* These macros generate the special .type and .size directives which |
580 | are used to set the corresponding fields of the linker symbol table | |
581 | entries in an ELF object file under SVR4. These macros also output | |
582 | the starting labels for the relevant functions/objects. */ | |
583 | ||
584 | /* Write the extra assembler code needed to declare a function properly. | |
585 | Some svr4 assemblers need to also have something extra said about the | |
586 | function's return value. We allow for that here. */ | |
587 | ||
874a0744 | 588 | extern int rs6000_pic_labelno; |
e3f1f242 | 589 | |
9ebbca7d | 590 | /* Override elfos.h definition. */ |
e3f1f242 MM |
591 | #undef ASM_DECLARE_FUNCTION_NAME |
592 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ | |
593 | do { \ | |
27c38fbe | 594 | const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \ |
b6c9286a | 595 | \ |
70f4f91c WC |
596 | if (TARGET_RELOCATABLE \ |
597 | && (get_pool_size () != 0 || current_function_profile) \ | |
9ebbca7d | 598 | && uses_TOC()) \ |
874a0744 | 599 | { \ |
ec940faa | 600 | char buf[256]; \ |
874a0744 | 601 | \ |
4977bab6 | 602 | (*targetm.asm_out.internal_label) (FILE, "LCL", rs6000_pic_labelno); \ |
874a0744 MM |
603 | \ |
604 | ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \ | |
9ebbca7d GK |
605 | fprintf (FILE, "\t%s ", init_ptr); \ |
606 | assemble_name (FILE, buf); \ | |
607 | putc ('-', FILE); \ | |
874a0744 | 608 | ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \ |
9ebbca7d GK |
609 | assemble_name (FILE, buf); \ |
610 | putc ('\n', FILE); \ | |
874a0744 MM |
611 | } \ |
612 | \ | |
2be2ac70 | 613 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ |
e3f1f242 | 614 | ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ |
b6c9286a | 615 | \ |
9ebbca7d | 616 | if (DEFAULT_ABI == ABI_AIX) \ |
b6c9286a | 617 | { \ |
9ebbca7d | 618 | const char *desc_name, *orig_name; \ |
b6c9286a | 619 | \ |
772c5265 | 620 | orig_name = (*targetm.strip_name_encoding) (NAME); \ |
9ebbca7d | 621 | desc_name = orig_name; \ |
b6c9286a MM |
622 | while (*desc_name == '.') \ |
623 | desc_name++; \ | |
624 | \ | |
625 | if (TREE_PUBLIC (DECL)) \ | |
626 | fprintf (FILE, "\t.globl %s\n", desc_name); \ | |
627 | \ | |
628 | fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ | |
629 | fprintf (FILE, "%s:\n", desc_name); \ | |
630 | fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \ | |
631 | fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \ | |
632 | if (DEFAULT_ABI == ABI_AIX) \ | |
633 | fprintf (FILE, "\t%s 0\n", init_ptr); \ | |
634 | fprintf (FILE, "\t.previous\n"); \ | |
635 | } \ | |
9ebbca7d | 636 | ASM_OUTPUT_LABEL (FILE, NAME); \ |
e3f1f242 MM |
637 | } while (0) |
638 | ||
9ebbca7d GK |
639 | /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore |
640 | flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */ | |
641 | ||
642 | #define LOCAL_LABEL_PREFIX "." | |
643 | #define USER_LABEL_PREFIX "" | |
e3f1f242 | 644 | |
4977bab6 | 645 | /* svr4.h overrides (*targetm.asm_out.internal_label). */ |
e3f1f242 | 646 | |
9ebbca7d GK |
647 | #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \ |
648 | asm_fprintf (FILE, "%L%s", PREFIX) | |
649 | ||
506a61b1 KG |
650 | /* Globalizing directive for a label. */ |
651 | #define GLOBAL_ASM_OP "\t.globl " | |
e3f1f242 | 652 | |
5f01fc14 MM |
653 | /* This says how to output assembler code to declare an |
654 | uninitialized internal linkage data object. Under SVR4, | |
655 | the linker seems to want the alignment of data objects | |
656 | to depend on their types. We do exactly that here. */ | |
657 | ||
76bbee81 | 658 | #define LOCAL_ASM_OP "\t.local\t" |
5f01fc14 | 659 | |
76bbee81 | 660 | #define LCOMM_ASM_OP "\t.lcomm\t" |
e47ae1c2 | 661 | |
9ebbca7d GK |
662 | /* Override elfos.h definition. */ |
663 | #undef ASM_OUTPUT_ALIGNED_LOCAL | |
664 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
5f01fc14 | 665 | do { \ |
307b599c MK |
666 | extern unsigned HOST_WIDE_INT g_switch_value; \ |
667 | \ | |
38c1f2d7 | 668 | if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \ |
307b599c | 669 | && (SIZE) <= g_switch_value) \ |
e47ae1c2 | 670 | { \ |
a9aefc1e | 671 | sbss_section (); \ |
e47ae1c2 MM |
672 | ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \ |
673 | ASM_OUTPUT_LABEL (FILE, NAME); \ | |
674 | ASM_OUTPUT_SKIP (FILE, SIZE); \ | |
675 | if (!flag_inhibit_size_directive && (SIZE) > 0) \ | |
2be2ac70 | 676 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ |
e47ae1c2 | 677 | } \ |
5f01fc14 | 678 | else \ |
e47ae1c2 | 679 | { \ |
b9f7d63e | 680 | fprintf (FILE, "%s", LCOMM_ASM_OP); \ |
e47ae1c2 | 681 | assemble_name ((FILE), (NAME)); \ |
7aabff18 JJ |
682 | fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ |
683 | (SIZE), (ALIGN) / BITS_PER_UNIT); \ | |
e47ae1c2 | 684 | } \ |
38a3dbbb | 685 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ |
fff4998b MM |
686 | } while (0) |
687 | ||
9ebbca7d GK |
688 | /* Describe how to emit uninitialized external linkage items. */ |
689 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
fff4998b | 690 | do { \ |
fff4998b | 691 | ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \ |
5f01fc14 MM |
692 | } while (0) |
693 | ||
6d6ab190 DE |
694 | #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
695 | /* To support -falign-* switches we need to use .p2align so | |
696 | that alignment directives in code sections will be padded | |
697 | with no-op instructions, rather than zeroes. */ | |
698 | #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ | |
699 | if ((LOG) != 0) \ | |
700 | { \ | |
701 | if ((MAX_SKIP) == 0) \ | |
702 | fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ | |
703 | else \ | |
704 | fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ | |
705 | } | |
706 | #endif | |
707 | ||
09eeeacb AM |
708 | /* This is how to output code to push a register on the stack. |
709 | It need not be very fast code. | |
710 | ||
711 | On the rs6000, we must keep the backchain up to date. In order | |
712 | to simplify things, always allocate 16 bytes for a push (System V | |
713 | wants to keep stack aligned to a 16 byte boundary). */ | |
714 | ||
715 | #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ | |
716 | do { \ | |
717 | if (DEFAULT_ABI == ABI_V4) \ | |
718 | asm_fprintf (FILE, \ | |
99bcb625 | 719 | "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \ |
09eeeacb AM |
720 | reg_names[1], reg_names[1], reg_names[REGNO], \ |
721 | reg_names[1]); \ | |
722 | } while (0) | |
723 | ||
724 | /* This is how to output an insn to pop a register from the stack. | |
725 | It need not be very fast code. */ | |
726 | ||
727 | #define ASM_OUTPUT_REG_POP(FILE, REGNO) \ | |
728 | do { \ | |
729 | if (DEFAULT_ABI == ABI_V4) \ | |
730 | asm_fprintf (FILE, \ | |
99bcb625 | 731 | "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \ |
09eeeacb AM |
732 | reg_names[REGNO], reg_names[1], reg_names[1], \ |
733 | reg_names[1]); \ | |
734 | } while (0) | |
735 | ||
9ebbca7d | 736 | /* Switch Recognition by gcc.c. Add -G xx support. */ |
88228c4b | 737 | |
9ebbca7d GK |
738 | /* Override svr4.h definition. */ |
739 | #undef SWITCH_TAKES_ARG | |
740 | #define SWITCH_TAKES_ARG(CHAR) \ | |
88228c4b MM |
741 | ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ |
742 | || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ | |
3411a85a MM |
743 | || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \ |
744 | || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \ | |
745 | || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G') | |
88228c4b | 746 | |
5f30b0ff | 747 | /* Output .file. */ |
9ebbca7d GK |
748 | /* Override elfos.h definition. */ |
749 | #undef ASM_FILE_START | |
750 | #define ASM_FILE_START(FILE) \ | |
4d3f9f5b | 751 | do { \ |
4d3f9f5b | 752 | output_file_directive ((FILE), main_input_filename); \ |
3cfa4909 | 753 | rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \ |
4d3f9f5b RK |
754 | } while (0) |
755 | ||
b6c9286a | 756 | |
9ebbca7d GK |
757 | extern int fixuplabelno; |
758 | ||
d9f6800d RH |
759 | /* Handle constructors specially for -mrelocatable. */ |
760 | #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor | |
761 | #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor | |
762 | ||
e3f1f242 MM |
763 | /* This is the end of what might become sysv4.h. */ |
764 | ||
99e2a354 | 765 | /* Use DWARF 2 debugging information by default. */ |
0e5dbd9b DE |
766 | #undef PREFERRED_DEBUGGING_TYPE |
767 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
c81bebd7 | 768 | |
99e2a354 | 769 | /* Historically we have also supported stabs debugging. */ |
0e5dbd9b | 770 | #define DBX_DEBUGGING_INFO 1 |
e3f1f242 | 771 | |
0e5dbd9b | 772 | #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info |
0e5dbd9b | 773 | #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p |
5add3202 | 774 | #define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags |
d9407988 | 775 | |
54ee9799 DE |
776 | /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ |
777 | ||
778 | #define RS6000_OUTPUT_BASENAME(FILE, NAME) \ | |
779 | assemble_name (FILE, NAME) | |
780 | ||
d1908feb JJ |
781 | /* We have to output the stabs for the function name *first*, before |
782 | outputting its label. */ | |
e3f1f242 MM |
783 | |
784 | #define DBX_FUNCTION_FIRST | |
785 | ||
786 | /* This is the end of what might become sysv4dbx.h. */ | |
787 | ||
b91da81f | 788 | #ifndef TARGET_VERSION |
9ebbca7d | 789 | #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)"); |
b91da81f | 790 | #endif |
4697a36c | 791 | \f |
7990b46f MK |
792 | #ifndef TARGET_OS_CPP_BUILTINS |
793 | #define TARGET_OS_CPP_BUILTINS() \ | |
794 | do \ | |
795 | { \ | |
796 | builtin_define_std ("PPC"); \ | |
797 | builtin_define_std ("unix"); \ | |
798 | builtin_define ("__svr4__"); \ | |
799 | builtin_assert ("system=unix"); \ | |
800 | builtin_assert ("system=svr4"); \ | |
801 | builtin_assert ("cpu=powerpc"); \ | |
802 | builtin_assert ("machine=powerpc"); \ | |
803 | } \ | |
804 | while (0) | |
b91da81f | 805 | #endif |
c2baf133 | 806 | |
9ebbca7d GK |
807 | /* Pass various options to the assembler. */ |
808 | /* Override svr4.h definition. */ | |
809 | #undef ASM_SPEC | |
810 | #define ASM_SPEC "%(asm_cpu) \ | |
38c1f2d7 | 811 | %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ |
c81bebd7 | 812 | %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ |
3201f6d9 | 813 | %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ |
4977bab6 ZW |
814 | %{memb|msdata|msdata=eabi: -memb} \ |
815 | %{mlittle|mlittle-endian:-mlittle; \ | |
816 | mbig|mbig-endian :-mbig; \ | |
817 | mcall-aixdesc | \ | |
818 | mcall-freebsd | \ | |
819 | mcall-netbsd | \ | |
820 | mcall-linux | \ | |
821 | mcall-gnu :-mbig; \ | |
822 | mcall-i960-old :-mlittle}" | |
bef84347 | 823 | |
9ebbca7d | 824 | #define CC1_ENDIAN_BIG_SPEC "" |
bef84347 | 825 | |
9ebbca7d | 826 | #define CC1_ENDIAN_LITTLE_SPEC "\ |
bef84347 | 827 | %{!mstrict-align: %{!mno-strict-align: \ |
c36ae96c | 828 | %{!mcall-i960-old: \ |
bef84347 | 829 | -mstrict-align \ |
c36ae96c | 830 | } \ |
bef84347 | 831 | }}" |
bef84347 | 832 | |
ccd84f51 | 833 | #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)" |
c81bebd7 | 834 | |
9ebbca7d GK |
835 | /* Pass -G xxx to the compiler and set correct endian mode. */ |
836 | #define CC1_SPEC "%{G*} \ | |
4977bab6 ZW |
837 | %{mlittle|mlittle-endian: %(cc1_endian_little); \ |
838 | mbig |mbig-endian : %(cc1_endian_big); \ | |
839 | mcall-aixdesc | \ | |
840 | mcall-freebsd | \ | |
841 | mcall-netbsd | \ | |
842 | mcall-linux | \ | |
843 | mcall-gnu : -mbig %(cc1_endian_big); \ | |
844 | mcall-i960-old : -mlittle %(cc1_endian_little); \ | |
845 | : %(cc1_endian_default)} \ | |
d9407988 | 846 | %{mno-sdata: -msdata=none } \ |
c81bebd7 MM |
847 | %{meabi: %{!mcall-*: -mcall-sysv }} \ |
848 | %{!meabi: %{!mno-eabi: \ | |
802a0058 | 849 | %{mrelocatable: -meabi } \ |
b91da81f | 850 | %{mcall-freebsd: -mno-eabi } \ |
c36ae96c | 851 | %{mcall-i960-old: -meabi } \ |
edf1b3f3 | 852 | %{mcall-linux: -mno-eabi } \ |
ddb28441 | 853 | %{mcall-gnu: -mno-eabi } \ |
edf1b3f3 | 854 | %{mcall-netbsd: -mno-eabi }}} \ |
38c1f2d7 | 855 | %{msdata: -msdata=default} \ |
d540a32c FS |
856 | %{mno-sdata: -msdata=none} \ |
857 | %{profile: -p}" | |
c81bebd7 | 858 | |
9ebbca7d | 859 | /* Don't put -Y P,<path> for cross compilers. */ |
7509c759 MM |
860 | #ifndef CROSS_COMPILE |
861 | #define LINK_PATH_SPEC "\ | |
d6a2af95 | 862 | %{!R*:%{L*:-R %*}} \ |
fba29a8c MM |
863 | %{!nostdlib: %{!YP,*: \ |
864 | %{compat-bsd: \ | |
865 | %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ | |
866 | %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \ | |
867 | %{!R*: %{!L*: -R /usr/ucblib}} \ | |
868 | %{!compat-bsd: \ | |
869 | %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ | |
870 | %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}" | |
7509c759 | 871 | |
113166a6 | 872 | #else |
7509c759 MM |
873 | #define LINK_PATH_SPEC "" |
874 | #endif | |
75814ad4 | 875 | |
9ebbca7d | 876 | /* Default starting address if specified. */ |
c81bebd7 | 877 | #define LINK_START_SPEC "\ |
4977bab6 ZW |
878 | %{mads : %(link_start_ads) ; \ |
879 | myellowknife : %(link_start_yellowknife) ; \ | |
880 | mmvme : %(link_start_mvme) ; \ | |
881 | msim : %(link_start_sim) ; \ | |
882 | mwindiss : %(link_start_windiss) ; \ | |
883 | mcall-freebsd: %(link_start_freebsd) ; \ | |
884 | mcall-linux : %(link_start_linux) ; \ | |
885 | mcall-gnu : %(link_start_gnu) ; \ | |
886 | mcall-netbsd : %(link_start_netbsd) ; \ | |
887 | : %(link_start_default) }" | |
c81bebd7 | 888 | |
9da71b16 | 889 | #define LINK_START_DEFAULT_SPEC "" |
c81bebd7 | 890 | |
9ebbca7d GK |
891 | /* Override svr4.h definition. */ |
892 | #undef LINK_SPEC | |
893 | #define LINK_SPEC "\ | |
f3597919 | 894 | %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \ |
51610b0a | 895 | %{YP,*} %{R*} \ |
fba29a8c MM |
896 | %{Qy:} %{!Qn:-Qy} \ |
897 | %(link_shlib) \ | |
362c63a5 | 898 | %{!Wl,-T*: %{!T*: %(link_start) }} \ |
fba29a8c MM |
899 | %(link_target) \ |
900 | %(link_os)" | |
901 | ||
902 | /* For now, turn off shared libraries by default. */ | |
903 | #ifndef SHARED_LIB_SUPPORT | |
904 | #define NO_SHARED_LIB_SUPPORT | |
905 | #endif | |
906 | ||
fba29a8c | 907 | #ifndef NO_SHARED_LIB_SUPPORT |
956d6950 | 908 | /* Shared libraries are default. */ |
fba29a8c MM |
909 | #define LINK_SHLIB_SPEC "\ |
910 | %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \ | |
911 | %{mshlib: } \ | |
afec0ea9 | 912 | %{static:-dn -Bstatic} \ |
8b496c8d ILT |
913 | %{shared:-G -dy -z text} \ |
914 | %{symbolic:-Bsymbolic -G -dy -z text}" | |
fba29a8c MM |
915 | |
916 | #else | |
917 | /* Shared libraries are not default. */ | |
918 | #define LINK_SHLIB_SPEC "\ | |
d6a2af95 | 919 | %{mshlib: %(link_path) } \ |
fba29a8c MM |
920 | %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \ |
921 | %{static: } \ | |
8b496c8d ILT |
922 | %{shared:-G -dy -z text %(link_path) } \ |
923 | %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }" | |
fba29a8c MM |
924 | #endif |
925 | ||
926 | /* Override the default target of the linker. */ | |
fba29a8c | 927 | #define LINK_TARGET_SPEC "\ |
36b8ffbe | 928 | %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \ |
9ebbca7d | 929 | %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ |
c36ae96c | 930 | %{mcall-i960-old: --oformat elf32-powerpcle} \ |
9ebbca7d | 931 | }}}}" |
fba29a8c | 932 | |
9ebbca7d | 933 | /* Any specific OS flags. */ |
fba29a8c | 934 | #define LINK_OS_SPEC "\ |
4977bab6 ZW |
935 | %{mads : %(link_os_ads) ; \ |
936 | myellowknife : %(link_os_yellowknife) ; \ | |
937 | mmvme : %(link_os_mvme) ; \ | |
938 | msim : %(link_os_sim) ; \ | |
939 | mwindiss : %(link_os_windiss) ; \ | |
940 | mcall-freebsd: %(link_os_freebsd) ; \ | |
941 | mcall-linux : %(link_os_linux) ; \ | |
942 | mcall-gnu : %(link_os_gnu) ; \ | |
943 | mcall-netbsd : %(link_os_netbsd) ; \ | |
944 | : %(link_os_default) }" | |
c81bebd7 | 945 | |
fba29a8c | 946 | #define LINK_OS_DEFAULT_SPEC "" |
afec0ea9 | 947 | |
841faeed | 948 | #define CPP_SYSV_SPEC \ |
3cfa4909 | 949 | "%{mrelocatable*: -D_RELOCATABLE} \ |
5b9d9a0c | 950 | %{fpic: -D__PIC__=1 -D__pic__=1} \ |
4c4eb375 | 951 | %{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}}" |
841faeed | 952 | |
9ebbca7d GK |
953 | /* Override rs6000.h definition. */ |
954 | #undef CPP_SPEC | |
4c4eb375 | 955 | #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) \ |
4977bab6 ZW |
956 | %{mads : %(cpp_os_ads) ; \ |
957 | myellowknife : %(cpp_os_yellowknife) ; \ | |
958 | mmvme : %(cpp_os_mvme) ; \ | |
959 | msim : %(cpp_os_sim) ; \ | |
960 | mwindiss : %(cpp_os_windiss) ; \ | |
961 | mcall-freebsd: %(cpp_os_freebsd) ; \ | |
962 | mcall-linux : %(cpp_os_linux) ; \ | |
963 | mcall-gnu : %(cpp_os_gnu) ; \ | |
964 | mcall-netbsd : %(cpp_os_netbsd) ; \ | |
965 | : %(cpp_os_default) }" | |
c81bebd7 | 966 | |
9ebbca7d | 967 | #define CPP_OS_DEFAULT_SPEC "" |
c81bebd7 | 968 | |
9ebbca7d GK |
969 | /* Override svr4.h definition. */ |
970 | #undef STARTFILE_SPEC | |
c81bebd7 | 971 | #define STARTFILE_SPEC "\ |
4977bab6 ZW |
972 | %{mads : %(startfile_ads) ; \ |
973 | myellowknife : %(startfile_yellowknife) ; \ | |
974 | mmvme : %(startfile_mvme) ; \ | |
975 | msim : %(startfile_sim) ; \ | |
976 | mwindiss : %(startfile_windiss) ; \ | |
977 | mcall-freebsd: %(startfile_freebsd) ; \ | |
978 | mcall-linux : %(startfile_linux) ; \ | |
979 | mcall-gnu : %(startfile_gnu) ; \ | |
980 | mcall-netbsd : %(startfile_netbsd) ; \ | |
981 | : %(startfile_default) }" | |
c81bebd7 | 982 | |
c81bebd7 MM |
983 | #define STARTFILE_DEFAULT_SPEC "" |
984 | ||
9ebbca7d | 985 | /* Override svr4.h definition. */ |
c81bebd7 MM |
986 | #undef LIB_SPEC |
987 | #define LIB_SPEC "\ | |
4977bab6 ZW |
988 | %{mads : %(lib_ads) ; \ |
989 | myellowknife : %(lib_yellowknife) ; \ | |
990 | mmvme : %(lib_mvme) ; \ | |
991 | msim : %(lib_sim) ; \ | |
992 | mwindiss : %(lib_windiss) ; \ | |
993 | mcall-freebsd: %(lib_freebsd) ; \ | |
994 | mcall-linux : %(lib_linux) ; \ | |
995 | mcall-gnu : %(lib_gnu) ; \ | |
996 | mcall-netbsd : %(lib_netbsd) ; \ | |
997 | : %(lib_default) }" | |
c81bebd7 | 998 | |
9da71b16 | 999 | #define LIB_DEFAULT_SPEC "" |
9da71b16 | 1000 | |
9ebbca7d | 1001 | /* Override svr4.h definition. */ |
c81bebd7 | 1002 | #undef ENDFILE_SPEC |
a1ffecd9 | 1003 | #define ENDFILE_SPEC "\ |
4977bab6 ZW |
1004 | %{mads : crtsavres.o%s %(endfile_ads) ; \ |
1005 | myellowknife : crtsavres.o%s %(endfile_yellowknife) ; \ | |
1006 | mmvme : crtsavres.o%s %(endfile_mvme) ; \ | |
1007 | msim : crtsavres.o%s %(endfile_sim) ; \ | |
1008 | mwindiss : %(endfile_windiss) ; \ | |
1009 | mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \ | |
1010 | mcall-linux : crtsavres.o%s %(endfile_linux) ; \ | |
1011 | mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \ | |
1012 | mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \ | |
1013 | : %(crtsavres_default) %(endfile_default) }" | |
a1ffecd9 MM |
1014 | |
1015 | #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s" | |
c81bebd7 | 1016 | |
c81bebd7 MM |
1017 | #define ENDFILE_DEFAULT_SPEC "" |
1018 | ||
e9a25f70 | 1019 | /* Motorola ADS support. */ |
e9a25f70 | 1020 | #define LIB_ADS_SPEC "--start-group -lads -lc --end-group" |
e9a25f70 | 1021 | |
362c63a5 | 1022 | #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" |
e9a25f70 | 1023 | |
362c63a5 | 1024 | #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s" |
e9a25f70 | 1025 | |
e9a25f70 | 1026 | #define LINK_START_ADS_SPEC "-T ads.ld%s" |
e9a25f70 | 1027 | |
e9a25f70 | 1028 | #define LINK_OS_ADS_SPEC "" |
e9a25f70 | 1029 | |
e9a25f70 | 1030 | #define CPP_OS_ADS_SPEC "" |
e9a25f70 JL |
1031 | |
1032 | /* Motorola Yellowknife support. */ | |
e9a25f70 | 1033 | #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group" |
e9a25f70 | 1034 | |
362c63a5 | 1035 | #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" |
e9a25f70 | 1036 | |
362c63a5 | 1037 | #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s" |
e9a25f70 | 1038 | |
e9a25f70 | 1039 | #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s" |
e9a25f70 | 1040 | |
e9a25f70 | 1041 | #define LINK_OS_YELLOWKNIFE_SPEC "" |
e9a25f70 | 1042 | |
e9a25f70 | 1043 | #define CPP_OS_YELLOWKNIFE_SPEC "" |
e9a25f70 | 1044 | |
c81bebd7 | 1045 | /* Motorola MVME support. */ |
e9a25f70 | 1046 | #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group" |
c81bebd7 | 1047 | |
362c63a5 | 1048 | #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" |
c81bebd7 | 1049 | |
362c63a5 | 1050 | #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s" |
c81bebd7 | 1051 | |
362c63a5 | 1052 | #define LINK_START_MVME_SPEC "-Ttext 0x40000" |
c81bebd7 | 1053 | |
fba29a8c | 1054 | #define LINK_OS_MVME_SPEC "" |
fba29a8c | 1055 | |
c81bebd7 | 1056 | #define CPP_OS_MVME_SPEC "" |
c81bebd7 MM |
1057 | |
1058 | /* PowerPC simulator based on netbsd system calls support. */ | |
e9a25f70 | 1059 | #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group" |
c81bebd7 | 1060 | |
362c63a5 | 1061 | #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s" |
c81bebd7 | 1062 | |
362c63a5 | 1063 | #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s" |
c81bebd7 | 1064 | |
362c63a5 | 1065 | #define LINK_START_SIM_SPEC "" |
c81bebd7 | 1066 | |
362c63a5 | 1067 | #define LINK_OS_SIM_SPEC "-m elf32ppcsim" |
fba29a8c | 1068 | |
c81bebd7 | 1069 | #define CPP_OS_SIM_SPEC "" |
c81bebd7 | 1070 | |
b91da81f DB |
1071 | /* FreeBSD support. */ |
1072 | ||
1073 | #define CPP_OS_FREEBSD_SPEC "\ | |
4e2e315f | 1074 | -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \ |
b91da81f DB |
1075 | -Acpu=powerpc -Amachine=powerpc" |
1076 | ||
1077 | #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC | |
1078 | #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC | |
1079 | #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC | |
1080 | #define LINK_START_FREEBSD_SPEC "" | |
1081 | ||
1082 | #define LINK_OS_FREEBSD_SPEC "\ | |
88467101 DB |
1083 | %{p:%e`-p' not supported; use `-pg' and gprof(1)} \ |
1084 | %{Wl,*:%*} \ | |
1085 | %{v:-V} \ | |
1086 | %{assert*} %{R*} %{rpath*} %{defsym*} \ | |
1087 | %{shared:-Bshareable %{h*} %{soname*}} \ | |
1088 | %{!shared: \ | |
1089 | %{!static: \ | |
1090 | %{rdynamic: -export-dynamic} \ | |
1091 | %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \ | |
1092 | %{static:-Bstatic}} \ | |
1093 | %{symbolic:-Bsymbolic}" | |
b91da81f | 1094 | |
956d6950 | 1095 | /* GNU/Linux support. */ |
d540a32c FS |
1096 | #ifdef USE_GNULIBC_1 |
1097 | #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \ | |
1098 | %{!mnewlib: -lc }" | |
1099 | #else | |
1100 | #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \ | |
1101 | %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \ | |
1102 | %{profile:-lc_p} %{!profile:-lc}}}" | |
1103 | #endif | |
c81bebd7 | 1104 | |
ccd84f51 | 1105 | #ifdef USE_GNULIBC_1 |
9a57586f MM |
1106 | #define STARTFILE_LINUX_SPEC "\ |
1107 | %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ | |
b26e3a82 | 1108 | %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \ |
362c63a5 | 1109 | %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" |
ccd84f51 FS |
1110 | #else |
1111 | #define STARTFILE_LINUX_SPEC "\ | |
1112 | %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ | |
1113 | %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \ | |
1114 | %{static:crtbeginT.o%s} \ | |
1115 | %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" | |
1116 | #endif | |
c81bebd7 | 1117 | |
362c63a5 GK |
1118 | #define ENDFILE_LINUX_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ |
1119 | %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}" | |
c81bebd7 | 1120 | |
362c63a5 | 1121 | #define LINK_START_LINUX_SPEC "" |
c81bebd7 | 1122 | |
362c63a5 GK |
1123 | #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ |
1124 | %{rdynamic:-export-dynamic} \ | |
1125 | %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" | |
fba29a8c | 1126 | |
ccd84f51 FS |
1127 | #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR) |
1128 | # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " | |
1129 | #endif | |
1130 | ||
d540a32c | 1131 | #ifdef USE_GNULIBC_1 |
d29350c0 MM |
1132 | #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \ |
1133 | %{!undef: \ | |
1134 | %{!ansi: \ | |
1135 | %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \ | |
1136 | %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \ | |
2b57e919 | 1137 | -Asystem=unix -Asystem=posix" |
d540a32c | 1138 | #else |
d29350c0 MM |
1139 | #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \ |
1140 | %{!undef: \ | |
1141 | %{!ansi: \ | |
1142 | %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \ | |
1143 | %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \ | |
2b57e919 | 1144 | -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}" |
d540a32c | 1145 | #endif |
c81bebd7 | 1146 | |
ddb28441 RM |
1147 | /* GNU/Hurd support. */ |
1148 | #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \ | |
1149 | %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \ | |
1150 | %{profile:-lc_p} %{!profile:-lc}}}" | |
1151 | ||
1152 | #define STARTFILE_GNU_SPEC "\ | |
1153 | %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \ | |
1154 | %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \ | |
1155 | %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \ | |
1156 | %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" | |
1157 | ||
1158 | #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ | |
1159 | %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}" | |
1160 | ||
1161 | #define LINK_START_GNU_SPEC "" | |
1162 | ||
1163 | #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \ | |
1164 | %{rdynamic:-export-dynamic} \ | |
1165 | %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" | |
1166 | ||
8fe2d853 | 1167 | #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \ |
d29350c0 MM |
1168 | %{!undef: \ |
1169 | %{!ansi: -Dunix -D__unix}} \ | |
ddb28441 RM |
1170 | -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}" |
1171 | ||
edf1b3f3 AC |
1172 | /* NetBSD support. */ |
1173 | #define LIB_NETBSD_SPEC "\ | |
1174 | %{profile:-lgmon -lc_p} %{!profile:-lc}" | |
1175 | ||
1176 | #define STARTFILE_NETBSD_SPEC "\ | |
1177 | ncrti.o%s crt0.o%s \ | |
1178 | %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" | |
1179 | ||
1180 | #define ENDFILE_NETBSD_SPEC "\ | |
1181 | %{!shared:crtend.o%s} %{shared:crtendS.o%s} \ | |
1182 | ncrtn.o%s" | |
1183 | ||
1184 | #define LINK_START_NETBSD_SPEC "\ | |
1185 | " | |
1186 | ||
1187 | #define LINK_OS_NETBSD_SPEC "\ | |
1188 | %{!shared: %{!static: \ | |
1189 | %{rdynamic:-export-dynamic} \ | |
1190 | %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}" | |
1191 | ||
1192 | #define CPP_OS_NETBSD_SPEC "\ | |
4e2e315f | 1193 | -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__" |
edf1b3f3 | 1194 | |
a1ffecd9 MM |
1195 | /* WindISS support. */ |
1196 | ||
1197 | #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group" | |
1198 | ||
1199 | #define CPP_OS_WINDISS_SPEC "\ | |
1200 | -D__rtasim \ | |
1201 | -D__EABI__ \ | |
1202 | -D__ppc \ | |
1203 | %{!msoft-float: -D__hardfp} \ | |
1204 | " | |
1205 | ||
1206 | #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s" | |
1207 | ||
1208 | #define ENDFILE_WINDISS_SPEC "crtend.o%s" | |
1209 | ||
1210 | #define LINK_START_WINDISS_SPEC "" | |
1211 | ||
1212 | #define LINK_OS_WINDISS_SPEC "" | |
1213 | ||
c81bebd7 | 1214 | /* Define any extra SPECS that the compiler needs to generate. */ |
9ebbca7d | 1215 | /* Override rs6000.h definition. */ |
c81bebd7 | 1216 | #undef SUBTARGET_EXTRA_SPECS |
9ebbca7d GK |
1217 | #define SUBTARGET_EXTRA_SPECS \ |
1218 | { "cpp_sysv", CPP_SYSV_SPEC }, \ | |
a1ffecd9 | 1219 | { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \ |
e9a25f70 JL |
1220 | { "lib_ads", LIB_ADS_SPEC }, \ |
1221 | { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
1222 | { "lib_mvme", LIB_MVME_SPEC }, \ |
1223 | { "lib_sim", LIB_SIM_SPEC }, \ | |
b91da81f | 1224 | { "lib_freebsd", LIB_FREEBSD_SPEC }, \ |
ddb28441 | 1225 | { "lib_gnu", LIB_GNU_SPEC }, \ |
c81bebd7 | 1226 | { "lib_linux", LIB_LINUX_SPEC }, \ |
edf1b3f3 | 1227 | { "lib_netbsd", LIB_NETBSD_SPEC }, \ |
a1ffecd9 | 1228 | { "lib_windiss", LIB_WINDISS_SPEC }, \ |
c81bebd7 | 1229 | { "lib_default", LIB_DEFAULT_SPEC }, \ |
e9a25f70 JL |
1230 | { "startfile_ads", STARTFILE_ADS_SPEC }, \ |
1231 | { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
1232 | { "startfile_mvme", STARTFILE_MVME_SPEC }, \ |
1233 | { "startfile_sim", STARTFILE_SIM_SPEC }, \ | |
b91da81f | 1234 | { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \ |
ddb28441 | 1235 | { "startfile_gnu", STARTFILE_GNU_SPEC }, \ |
c81bebd7 | 1236 | { "startfile_linux", STARTFILE_LINUX_SPEC }, \ |
edf1b3f3 | 1237 | { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \ |
a1ffecd9 | 1238 | { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \ |
c81bebd7 | 1239 | { "startfile_default", STARTFILE_DEFAULT_SPEC }, \ |
e9a25f70 JL |
1240 | { "endfile_ads", ENDFILE_ADS_SPEC }, \ |
1241 | { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
1242 | { "endfile_mvme", ENDFILE_MVME_SPEC }, \ |
1243 | { "endfile_sim", ENDFILE_SIM_SPEC }, \ | |
b91da81f | 1244 | { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \ |
ddb28441 | 1245 | { "endfile_gnu", ENDFILE_GNU_SPEC }, \ |
c81bebd7 | 1246 | { "endfile_linux", ENDFILE_LINUX_SPEC }, \ |
edf1b3f3 | 1247 | { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \ |
a1ffecd9 | 1248 | { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \ |
c81bebd7 | 1249 | { "endfile_default", ENDFILE_DEFAULT_SPEC }, \ |
fba29a8c MM |
1250 | { "link_path", LINK_PATH_SPEC }, \ |
1251 | { "link_shlib", LINK_SHLIB_SPEC }, \ | |
1252 | { "link_target", LINK_TARGET_SPEC }, \ | |
83cd7147 | 1253 | { "link_start", LINK_START_SPEC }, \ |
e9a25f70 JL |
1254 | { "link_start_ads", LINK_START_ADS_SPEC }, \ |
1255 | { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
1256 | { "link_start_mvme", LINK_START_MVME_SPEC }, \ |
1257 | { "link_start_sim", LINK_START_SIM_SPEC }, \ | |
b91da81f | 1258 | { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \ |
ddb28441 | 1259 | { "link_start_gnu", LINK_START_GNU_SPEC }, \ |
c81bebd7 | 1260 | { "link_start_linux", LINK_START_LINUX_SPEC }, \ |
edf1b3f3 | 1261 | { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \ |
a1ffecd9 | 1262 | { "link_start_windiss", LINK_START_WINDISS_SPEC }, \ |
c81bebd7 | 1263 | { "link_start_default", LINK_START_DEFAULT_SPEC }, \ |
fba29a8c | 1264 | { "link_os", LINK_OS_SPEC }, \ |
e9a25f70 JL |
1265 | { "link_os_ads", LINK_OS_ADS_SPEC }, \ |
1266 | { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \ | |
fba29a8c MM |
1267 | { "link_os_mvme", LINK_OS_MVME_SPEC }, \ |
1268 | { "link_os_sim", LINK_OS_SIM_SPEC }, \ | |
b91da81f | 1269 | { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ |
fba29a8c | 1270 | { "link_os_linux", LINK_OS_LINUX_SPEC }, \ |
ddb28441 | 1271 | { "link_os_gnu", LINK_OS_GNU_SPEC }, \ |
edf1b3f3 | 1272 | { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ |
a1ffecd9 | 1273 | { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \ |
fba29a8c | 1274 | { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ |
bef84347 VM |
1275 | { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \ |
1276 | { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \ | |
1277 | { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \ | |
e9a25f70 JL |
1278 | { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ |
1279 | { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
1280 | { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ |
1281 | { "cpp_os_sim", CPP_OS_SIM_SPEC }, \ | |
b91da81f | 1282 | { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \ |
ddb28441 | 1283 | { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \ |
c81bebd7 | 1284 | { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \ |
edf1b3f3 | 1285 | { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \ |
a1ffecd9 | 1286 | { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \ |
fba29a8c | 1287 | { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, |
b6c9286a MM |
1288 | |
1289 | /* Define this macro as a C expression for the initializer of an | |
1290 | array of string to tell the driver program which options are | |
1291 | defaults for this target and thus do not need to be handled | |
1292 | specially when using `MULTILIB_OPTIONS'. | |
1293 | ||
1294 | Do not define this macro if `MULTILIB_OPTIONS' is not defined in | |
1295 | the target makefile fragment or if none of the options listed in | |
1296 | `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */ | |
1297 | ||
3807773b | 1298 | #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" } |
38c1f2d7 MM |
1299 | |
1300 | /* Define this macro if the code for function profiling should come | |
1301 | before the function prologue. Normally, the profiling code comes | |
1302 | after. */ | |
1303 | #define PROFILE_BEFORE_PROLOGUE 1 | |
1304 | ||
1305 | /* Function name to call to do profiling. */ | |
38c1f2d7 | 1306 | #define RS6000_MCOUNT "_mcount" |
e0f7170a | 1307 | |
edf11378 FS |
1308 | /* Define this macro (to a value of 1) if you want to support the |
1309 | Win32 style pragmas #pragma pack(push,<n>)' and #pragma | |
1310 | pack(pop)'. The pack(push,<n>) pragma specifies the maximum | |
1311 | alignment (in bytes) of fields within a structure, in much the | |
1312 | same way as the __aligned__' and __packed__' __attribute__'s | |
a0ab749a | 1313 | do. A pack value of zero resets the behavior to the default. |
edf11378 FS |
1314 | Successive invocations of this pragma cause the previous values to |
1315 | be stacked, so that invocations of #pragma pack(pop)' will return | |
1316 | to the previous value. */ | |
1317 | ||
1318 | #define HANDLE_PRAGMA_PACK_PUSH_POP 1 | |
1319 | ||
e0f7170a GK |
1320 | /* Define library calls for quad FP operations. These are all part of the |
1321 | PowerPC 32bit ABI. */ | |
1322 | #define ADDTF3_LIBCALL "_q_add" | |
1323 | #define DIVTF3_LIBCALL "_q_div" | |
1324 | #define EXTENDDFTF2_LIBCALL "_q_dtoq" | |
1325 | #define EQTF2_LIBCALL "_q_feq" | |
1326 | #define GETF2_LIBCALL "_q_fge" | |
1327 | #define GTTF2_LIBCALL "_q_fgt" | |
1328 | #define LETF2_LIBCALL "_q_fle" | |
1329 | #define LTTF2_LIBCALL "_q_flt" | |
1330 | #define NETF2_LIBCALL "_q_fne" | |
1331 | #define FLOATSITF2_LIBCALL "_q_itoq" | |
1332 | #define MULTF3_LIBCALL "_q_mul" | |
1333 | #define NEGTF2_LIBCALL "_q_neg" | |
1334 | #define TRUNCTFDF2_LIBCALL "_q_qtod" | |
1335 | #define FIX_TRUNCTFSI2_LIBCALL "_q_qtoi" | |
1336 | #define TRUNCTFSF2_LIBCALL "_q_qtos" | |
1337 | #define FIXUNS_TRUNCTFSI2_LIBCALL "_q_qtou" | |
1338 | #define SQRTTF_LIBCALL "_q_sqrt" | |
1339 | #define EXTENDSFTF2_LIBCALL "_q_stoq" | |
1340 | #define SUBTF3_LIBCALL "_q_sub" | |
1341 | #define FLOATUNSSITF2_LIBCALL "_q_utoq" | |
1342 | ||
1343 | #define INIT_TARGET_OPTABS \ | |
1344 | do { \ | |
1345 | if (TARGET_HARD_FLOAT) \ | |
1346 | { \ | |
1347 | add_optab->handlers[(int) TFmode].libfunc \ | |
1348 | = init_one_libfunc (ADDTF3_LIBCALL); \ | |
1349 | sub_optab->handlers[(int) TFmode].libfunc \ | |
1350 | = init_one_libfunc (SUBTF3_LIBCALL); \ | |
1351 | neg_optab->handlers[(int) TFmode].libfunc \ | |
1352 | = init_one_libfunc (NEGTF2_LIBCALL); \ | |
1353 | smul_optab->handlers[(int) TFmode].libfunc \ | |
1354 | = init_one_libfunc (MULTF3_LIBCALL); \ | |
ef89d648 | 1355 | sdiv_optab->handlers[(int) TFmode].libfunc \ |
e0f7170a GK |
1356 | = init_one_libfunc (DIVTF3_LIBCALL); \ |
1357 | eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL); \ | |
1358 | netf2_libfunc = init_one_libfunc (NETF2_LIBCALL); \ | |
1359 | gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL); \ | |
1360 | getf2_libfunc = init_one_libfunc (GETF2_LIBCALL); \ | |
1361 | lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL); \ | |
1362 | letf2_libfunc = init_one_libfunc (LETF2_LIBCALL); \ | |
1363 | trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL); \ | |
1364 | trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL); \ | |
1365 | extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL); \ | |
1366 | extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL); \ | |
1367 | floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL); \ | |
1368 | fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL); \ | |
1369 | fixunstfsi_libfunc \ | |
1370 | = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL); \ | |
1371 | if (TARGET_PPC_GPOPT || TARGET_POWER2) \ | |
1372 | sqrt_optab->handlers[(int) TFmode].libfunc \ | |
1373 | = init_one_libfunc (SQRTTF_LIBCALL); \ | |
1374 | } \ | |
1375 | } while (0) | |
e44713f7 GK |
1376 | |
1377 | /* Select a format to encode pointers in exception handling data. CODE | |
1378 | is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is | |
1379 | true if the symbol may be affected by dynamic relocations. */ | |
50c30603 GK |
1380 | #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ |
1381 | ((flag_pic || TARGET_RELOCATABLE) \ | |
e44713f7 GK |
1382 | ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \ |
1383 | : DW_EH_PE_absptr) | |
50c30603 | 1384 | |
07c9d2eb SS |
1385 | #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section |
1386 | ||
362b68a8 | 1387 | #define DOUBLE_INT_ASM_OP "\t.quad\t" |
301d03af RS |
1388 | |
1389 | /* Generate entries in .fixup for relocatable addresses. */ | |
1390 | #define RELOCATABLE_NEEDS_FIXUP |