]>
Commit | Line | Data |
---|---|---|
e3f1f242 | 1 | /* Target definitions for GNU compiler for PowerPC running System V.4 |
7adcbafe | 2 | Copyright (C) 1995-2022 Free Software Foundation, Inc. |
e3f1f242 MM |
3 | Contributed by Cygnus Support. |
4 | ||
5de601cf | 5 | This file is part of GCC. |
e3f1f242 | 6 | |
5de601cf NC |
7 | GCC is free software; you can redistribute it and/or modify it |
8 | under the terms of the GNU General Public License as published | |
2f83c7d6 | 9 | by the Free Software Foundation; either version 3, or (at your |
5de601cf | 10 | option) any later version. |
e3f1f242 | 11 | |
5de601cf NC |
12 | GCC is distributed in the hope that it will be useful, but WITHOUT |
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
15 | License for more details. | |
e3f1f242 | 16 | |
748086b7 JJ |
17 | Under Section 7 of GPL version 3, you are granted additional |
18 | permissions described in the GCC Runtime Library Exception, version | |
19 | 3.1, as published by the Free Software Foundation. | |
20 | ||
21 | You should have received a copy of the GNU General Public License and | |
22 | a copy of the GCC Runtime Library Exception along with this program; | |
23 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
2f83c7d6 | 24 | <http://www.gnu.org/licenses/>. */ |
9ebbca7d | 25 | |
62045234 AM |
26 | #undef GNU_USER_TARGET_CRTI |
27 | #define GNU_USER_TARGET_CRTI "%{mnewlib:ecrti.o%s;:crti.o%s}" | |
28 | #undef GNU_USER_TARGET_CRTN | |
29 | #define GNU_USER_TARGET_CRTN "%{mnewlib:ecrtn.o%s;:crtn.o%s}" | |
30 | ||
9ebbca7d GK |
31 | /* Yes! We are ELF. */ |
32 | #define TARGET_OBJECT_FORMAT OBJECT_ELF | |
33 | ||
34 | /* Default ABI to compile code for. */ | |
35 | #define DEFAULT_ABI rs6000_current_abi | |
36 | ||
37 | /* Default ABI to use. */ | |
38 | #define RS6000_ABI_NAME "sysv" | |
39 | ||
40 | /* Override rs6000.h definition. */ | |
41 | #undef ASM_DEFAULT_SPEC | |
8d852645 | 42 | #define ASM_DEFAULT_SPEC "-mppc%{m64:64}" |
9ebbca7d | 43 | |
9ae813e8 | 44 | #define TARGET_HAS_TOC (TARGET_64BIT \ |
967245d1 | 45 | || (TARGET_MINIMAL_TOC \ |
64d732de | 46 | && flag_pic > 1) \ |
008e32c0 | 47 | || DEFAULT_ABI != ABI_V4) |
7e69e155 MM |
48 | |
49 | #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE) | |
9ebbca7d | 50 | #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) |
aa1ca044 | 51 | #define TARGET_PROTOTYPE target_prototype |
4697a36c | 52 | #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE) |
9ebbca7d | 53 | #define TARGET_NO_EABI (! TARGET_EABI) |
fc07d9e3 | 54 | #define TARGET_REGNAMES rs6000_regnames |
c81bebd7 | 55 | |
7f970b70 AM |
56 | #ifdef HAVE_AS_REL16 |
57 | #undef TARGET_SECURE_PLT | |
58 | #define TARGET_SECURE_PLT secure_plt | |
59 | #endif | |
60 | ||
ff7fa488 AM |
61 | #if HAVE_AS_PLTSEQ |
62 | #undef TARGET_PLTSEQ | |
63 | #define TARGET_PLTSEQ rs6000_pltseq | |
64 | #endif | |
65 | ||
88228c4b | 66 | #define SDATA_DEFAULT_SIZE 8 |
9ebbca7d | 67 | |
c5387660 JM |
68 | /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to |
69 | get control in TARGET_OPTION_OVERRIDE. */ | |
3933e0e1 MM |
70 | |
71 | #define SUBTARGET_OVERRIDE_OPTIONS \ | |
72 | do { \ | |
00f34291 | 73 | if (!OPTION_SET_P (g_switch_value)) \ |
88228c4b MM |
74 | g_switch_value = SDATA_DEFAULT_SIZE; \ |
75 | \ | |
9739c90c JJ |
76 | if (rs6000_abi_name == NULL) \ |
77 | rs6000_abi_name = RS6000_ABI_NAME; \ | |
78 | \ | |
c81bebd7 MM |
79 | if (!strcmp (rs6000_abi_name, "sysv")) \ |
80 | rs6000_current_abi = ABI_V4; \ | |
81 | else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \ | |
82 | { \ | |
83 | rs6000_current_abi = ABI_V4; \ | |
4d967549 | 84 | rs6000_isa_flags &= ~ OPTION_MASK_EABI; \ |
c81bebd7 MM |
85 | } \ |
86 | else if (!strcmp (rs6000_abi_name, "sysv-eabi") \ | |
87 | || !strcmp (rs6000_abi_name, "eabi")) \ | |
88 | { \ | |
89 | rs6000_current_abi = ABI_V4; \ | |
4d967549 | 90 | rs6000_isa_flags |= OPTION_MASK_EABI; \ |
c81bebd7 | 91 | } \ |
c81bebd7 MM |
92 | else if (!strcmp (rs6000_abi_name, "aixdesc")) \ |
93 | rs6000_current_abi = ABI_AIX; \ | |
a26f86dc AT |
94 | else if (!strcmp (rs6000_abi_name, "freebsd") \ |
95 | || !strcmp (rs6000_abi_name, "linux")) \ | |
85b776df AM |
96 | { \ |
97 | if (TARGET_64BIT) \ | |
98 | rs6000_current_abi = ABI_AIX; \ | |
99 | else \ | |
100 | rs6000_current_abi = ABI_V4; \ | |
101 | } \ | |
edf1b3f3 AC |
102 | else if (!strcmp (rs6000_abi_name, "netbsd")) \ |
103 | rs6000_current_abi = ABI_V4; \ | |
457ef797 ME |
104 | else if (!strcmp (rs6000_abi_name, "openbsd")) \ |
105 | rs6000_current_abi = ABI_V4; \ | |
c36ae96c GK |
106 | else if (!strcmp (rs6000_abi_name, "i960-old")) \ |
107 | { \ | |
108 | rs6000_current_abi = ABI_V4; \ | |
4d967549 MM |
109 | rs6000_isa_flags |= (OPTION_MASK_LITTLE_ENDIAN | OPTION_MASK_EABI); \ |
110 | rs6000_isa_flags &= ~OPTION_MASK_STRICT_ALIGN; \ | |
cacf1ca8 | 111 | TARGET_NO_BITFIELD_WORD = 1; \ |
c36ae96c | 112 | } \ |
c81bebd7 MM |
113 | else \ |
114 | { \ | |
115 | rs6000_current_abi = ABI_V4; \ | |
a72a7e39 | 116 | error ("bad value for %<%s-%s%>", "-mcall", rs6000_abi_name); \ |
c81bebd7 | 117 | } \ |
7509c759 | 118 | \ |
d9407988 MM |
119 | if (rs6000_sdata_name) \ |
120 | { \ | |
d9407988 | 121 | if (!strcmp (rs6000_sdata_name, "none")) \ |
38c1f2d7 | 122 | rs6000_sdata = SDATA_NONE; \ |
d9407988 MM |
123 | else if (!strcmp (rs6000_sdata_name, "data")) \ |
124 | rs6000_sdata = SDATA_DATA; \ | |
125 | else if (!strcmp (rs6000_sdata_name, "default")) \ | |
126 | rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \ | |
127 | else if (!strcmp (rs6000_sdata_name, "sysv")) \ | |
128 | rs6000_sdata = SDATA_SYSV; \ | |
129 | else if (!strcmp (rs6000_sdata_name, "eabi")) \ | |
130 | rs6000_sdata = SDATA_EABI; \ | |
131 | else \ | |
a72a7e39 | 132 | error ("bad value for %<%s=%s%>", "-msdata", rs6000_sdata_name);\ |
d9407988 | 133 | } \ |
f607bc57 | 134 | else if (DEFAULT_ABI == ABI_V4) \ |
d9407988 MM |
135 | { \ |
136 | rs6000_sdata = SDATA_DATA; \ | |
84f414bc | 137 | rs6000_sdata_name = "data"; \ |
d9407988 MM |
138 | } \ |
139 | else \ | |
84f414bc MM |
140 | { \ |
141 | rs6000_sdata = SDATA_NONE; \ | |
142 | rs6000_sdata_name = "none"; \ | |
143 | } \ | |
9a57586f | 144 | \ |
d9407988 MM |
145 | if (TARGET_RELOCATABLE && \ |
146 | (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \ | |
7509c759 | 147 | { \ |
5b9d9a0c | 148 | rs6000_sdata = SDATA_DATA; \ |
a72a7e39 BS |
149 | error ("%qs and %<%s=%s%> are incompatible", rs6000_sdata_name, \ |
150 | "-mrelocatable", "-msdata"); \ | |
7509c759 MM |
151 | } \ |
152 | \ | |
008e32c0 | 153 | else if (flag_pic && DEFAULT_ABI == ABI_V4 \ |
f1384257 AM |
154 | && (rs6000_sdata == SDATA_EABI \ |
155 | || rs6000_sdata == SDATA_SYSV)) \ | |
84f414bc MM |
156 | { \ |
157 | rs6000_sdata = SDATA_DATA; \ | |
a72a7e39 | 158 | error ("%<-f%s%> and %<%s=%s%> are incompatible", \ |
84f414bc | 159 | (flag_pic > 1) ? "PIC" : "pic", \ |
a72a7e39 | 160 | "-msdata", rs6000_sdata_name); \ |
84f414bc MM |
161 | } \ |
162 | \ | |
7cf6c927 FS |
163 | if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \ |
164 | || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \ | |
7509c759 | 165 | { \ |
38c1f2d7 | 166 | rs6000_sdata = SDATA_NONE; \ |
a72a7e39 | 167 | error ("%<%s=%s%> and %<%s-%s%> are incompatible", \ |
b8888a0f | 168 | "-msdata", rs6000_sdata_name, "-mcall", rs6000_abi_name); \ |
7509c759 MM |
169 | } \ |
170 | \ | |
0e5dbd9b DE |
171 | targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \ |
172 | \ | |
3933e0e1 MM |
173 | if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \ |
174 | { \ | |
4d967549 | 175 | rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \ |
a72a7e39 BS |
176 | error ("%qs and %qs are incompatible", "-mrelocatable", \ |
177 | "-mno-minimal-toc"); \ | |
3933e0e1 | 178 | } \ |
b6c9286a | 179 | \ |
008e32c0 | 180 | if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \ |
b6c9286a | 181 | { \ |
4d967549 | 182 | rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ |
a72a7e39 BS |
183 | error ("%qs and %<%s-%s%> are incompatible", \ |
184 | "-mrelocatable", "-mcall", rs6000_abi_name); \ | |
b6c9286a MM |
185 | } \ |
186 | \ | |
008e32c0 | 187 | if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \ |
3201f6d9 MM |
188 | { \ |
189 | flag_pic = 0; \ | |
a72a7e39 BS |
190 | error ("%qs and %<%s-%s%> are incompatible", \ |
191 | "-fPIC", "-mcall", rs6000_abi_name); \ | |
3201f6d9 MM |
192 | } \ |
193 | \ | |
7f970b70 AM |
194 | if (TARGET_SECURE_PLT != secure_plt) \ |
195 | { \ | |
a72a7e39 | 196 | error ("%qs not supported by your assembler", "-msecure-plt"); \ |
7f970b70 AM |
197 | } \ |
198 | \ | |
ff7fa488 | 199 | if (TARGET_PLTSEQ != rs6000_pltseq \ |
00f34291 | 200 | && OPTION_SET_P (rs6000_pltseq)) \ |
ff7fa488 AM |
201 | { \ |
202 | error ("%qs not supported by your assembler", "-mpltseq"); \ | |
203 | } \ | |
204 | \ | |
205 | if (DEFAULT_ABI == ABI_V4 && TARGET_PLTSEQ && !TARGET_SECURE_PLT) \ | |
206 | { \ | |
00f34291 | 207 | if (OPTION_SET_P (rs6000_pltseq)) \ |
ff7fa488 | 208 | { \ |
00f34291 | 209 | if (OPTION_SET_P (secure_plt)) \ |
ff7fa488 AM |
210 | error ("%qs and %qs are incompatible", \ |
211 | "-mpltseq", "-mbss-plt"); \ | |
212 | else \ | |
213 | secure_plt = true; \ | |
214 | } \ | |
215 | if (!TARGET_SECURE_PLT) \ | |
216 | rs6000_pltseq = false; \ | |
217 | } \ | |
218 | \ | |
008e32c0 | 219 | if (flag_pic > 1 && DEFAULT_ABI == ABI_V4) \ |
d2894ab5 | 220 | { \ |
6a67e81b AM |
221 | /* Note: flag_pic should not change any option flags that would \ |
222 | be invalid with or pessimise -fno-PIC code. LTO turns off \ | |
223 | flag_pic when linking/recompiling a fixed position executable. \ | |
224 | However, if the objects were originally compiled with -fPIC, \ | |
225 | then other target options forced on here by -fPIC are restored \ | |
226 | when recompiling those objects without -fPIC. In particular \ | |
227 | TARGET_RELOCATABLE must not be enabled here by flag_pic. */ \ | |
228 | rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \ | |
d2894ab5 DE |
229 | TARGET_NO_FP_IN_TOC = 1; \ |
230 | } \ | |
84f414bc | 231 | \ |
6a67e81b AM |
232 | if (TARGET_RELOCATABLE) \ |
233 | { \ | |
234 | if (!flag_pic) \ | |
235 | flag_pic = 2; \ | |
236 | TARGET_NO_FP_IN_TOC = 1; \ | |
237 | } \ | |
3933e0e1 | 238 | } while (0) |
75814ad4 | 239 | |
9739c90c JJ |
240 | #ifndef RS6000_BI_ARCH |
241 | # define SUBSUBTARGET_OVERRIDE_OPTIONS \ | |
242 | do { \ | |
4d967549 | 243 | if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT) \ |
a72a7e39 | 244 | error ("%<-m%s%> not supported in this configuration", \ |
4d967549 | 245 | (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32"); \ |
9739c90c JJ |
246 | } while (0) |
247 | #endif | |
a260abc9 | 248 | |
9ebbca7d GK |
249 | /* Override rs6000.h definition. */ |
250 | #undef TARGET_DEFAULT | |
6b39bc38 | 251 | #define TARGET_DEFAULT 0 |
a260abc9 | 252 | |
9ebbca7d GK |
253 | /* Override rs6000.h definition. */ |
254 | #undef PROCESSOR_DEFAULT | |
255 | #define PROCESSOR_DEFAULT PROCESSOR_PPC750 | |
e3f1f242 | 256 | |
5dead3e5 | 257 | #define FIXED_R2 1 |
5d36722d RK |
258 | /* System V.4 uses register 13 as a pointer to the small data area, |
259 | so it is not available to the normal user. */ | |
5d36722d RK |
260 | #define FIXED_R13 1 |
261 | ||
9ebbca7d GK |
262 | /* Override default big endianism definitions in rs6000.h. */ |
263 | #undef BYTES_BIG_ENDIAN | |
264 | #undef WORDS_BIG_ENDIAN | |
265 | #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN) | |
266 | #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN) | |
75814ad4 | 267 | |
e9a25f70 | 268 | /* Put jump tables in read-only memory, rather than in .text. */ |
75197b37 | 269 | #define JUMP_TABLES_IN_TEXT_SECTION 0 |
e9a25f70 | 270 | |
9ebbca7d | 271 | /* Prefix and suffix to use to saving floating point. */ |
e3f1f242 | 272 | #define SAVE_FP_PREFIX "_savefpr_" |
d7a9e7c5 | 273 | #define SAVE_FP_SUFFIX "" |
e3f1f242 | 274 | |
9ebbca7d | 275 | /* Prefix and suffix to use to restoring floating point. */ |
e3f1f242 | 276 | #define RESTORE_FP_PREFIX "_restfpr_" |
d7a9e7c5 | 277 | #define RESTORE_FP_SUFFIX "" |
e3f1f242 | 278 | |
a1cd969e JM |
279 | /* Type used for size_t, as a string used in a declaration. */ |
280 | #undef SIZE_TYPE | |
281 | #define SIZE_TYPE "unsigned int" | |
282 | ||
e3f1f242 | 283 | /* Type used for ptrdiff_t, as a string used in a declaration. */ |
e3f1f242 MM |
284 | #define PTRDIFF_TYPE "int" |
285 | ||
e3f1f242 | 286 | #undef WCHAR_TYPE |
f9317f0d | 287 | #define WCHAR_TYPE "long int" |
e3f1f242 | 288 | |
e3f1f242 | 289 | #undef WCHAR_TYPE_SIZE |
f9317f0d | 290 | #define WCHAR_TYPE_SIZE 32 |
e3f1f242 | 291 | |
9ebbca7d GK |
292 | /* Make int foo : 8 not cause structures to be aligned to an int boundary. */ |
293 | /* Override elfos.h definition. */ | |
c81bebd7 MM |
294 | #undef PCC_BITFIELD_TYPE_MATTERS |
295 | #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE) | |
296 | ||
9a155f91 GK |
297 | #undef BITFIELD_NBYTES_LIMITED |
298 | #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD) | |
299 | ||
c81bebd7 MM |
300 | /* Define this macro to be the value 1 if instructions will fail to |
301 | work if given data not on the nominal alignment. If instructions | |
bef84347 | 302 | will merely go slower in that case, define this macro as 0. */ |
c81bebd7 | 303 | #undef STRICT_ALIGNMENT |
bef84347 | 304 | #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN) |
c81bebd7 | 305 | |
06ba5854 FS |
306 | /* Define this macro if you wish to preserve a certain alignment for |
307 | the stack pointer, greater than what the hardware enforces. The | |
308 | definition is a C expression for the desired alignment (measured | |
309 | in bits). This macro must evaluate to a value equal to or larger | |
310 | than STACK_BOUNDARY. | |
311 | For the SYSV ABI and variants the alignment of the stack pointer | |
312 | is usually controlled manually in rs6000.c. However, to maintain | |
313 | alignment across alloca () in all circumstances, | |
314 | PREFERRED_STACK_BOUNDARY needs to be set as well. | |
315 | This has the additional advantage of allowing a bigger maximum | |
316 | alignment of user objects on the stack. */ | |
317 | ||
318 | #undef PREFERRED_STACK_BOUNDARY | |
319 | #define PREFERRED_STACK_BOUNDARY 128 | |
320 | ||
9ebbca7d | 321 | /* Real stack boundary as mandated by the appropriate ABI. */ |
19fb36e3 AM |
322 | #define ABI_STACK_BOUNDARY \ |
323 | ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128) | |
e3f1f242 | 324 | |
3b85fe5f JJ |
325 | /* An expression for the alignment of a structure field FIELD if the |
326 | alignment computed in the usual way is COMPUTED. */ | |
a4cf4b64 | 327 | #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ |
79cf0004 | 328 | (COMPUTED) |
3b85fe5f | 329 | |
f589b741 | 330 | #undef BIGGEST_FIELD_ALIGNMENT |
e3f1f242 MM |
331 | |
332 | /* Use ELF style section commands. */ | |
333 | ||
9ebbca7d | 334 | #define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" |
e3f1f242 | 335 | |
9ebbca7d | 336 | #define DATA_SECTION_ASM_OP "\t.section\t\".data\"" |
fff4998b | 337 | |
9ebbca7d | 338 | #define BSS_SECTION_ASM_OP "\t.section\t\".bss\"" |
e3f1f242 | 339 | |
9ebbca7d GK |
340 | /* Override elfos.h definition. */ |
341 | #undef INIT_SECTION_ASM_OP | |
342 | #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\"" | |
c81bebd7 | 343 | |
9ebbca7d GK |
344 | /* Override elfos.h definition. */ |
345 | #undef FINI_SECTION_ASM_OP | |
346 | #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\"" | |
c81bebd7 | 347 | |
9ebbca7d | 348 | #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\"" |
c81bebd7 | 349 | |
9ebbca7d GK |
350 | /* Put PC relative got entries in .got2. */ |
351 | #define MINIMAL_TOC_SECTION_ASM_OP \ | |
6a67e81b | 352 | (flag_pic ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"") |
c81bebd7 | 353 | |
9ebbca7d GK |
354 | #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\"" |
355 | #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\"" | |
f607bc57 | 356 | #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits" |
c81bebd7 | 357 | |
b64a1b53 | 358 | /* Override default elf definitions. */ |
d6b5193b | 359 | #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections |
9b580a0b RH |
360 | #undef TARGET_ASM_RELOC_RW_MASK |
361 | #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask | |
b64a1b53 RH |
362 | #undef TARGET_ASM_SELECT_RTX_SECTION |
363 | #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section | |
7509c759 | 364 | |
a0ab749a | 365 | /* Return nonzero if this entry is to be written into the constant pool |
b6c9286a MM |
366 | in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST |
367 | containing one of them. If -mfp-in-toc (the default), we also do | |
368 | this for floating-point constants. We actually can only do this | |
369 | if the FP formats of the target and host machines are the same, but | |
331d9186 PB |
370 | we can't check that since not every file that uses these target macros |
371 | includes real.h. | |
b6c9286a | 372 | |
956d6950 | 373 | Unlike AIX, we don't key off of -mminimal-toc, but instead do not |
b6c9286a MM |
374 | allow floating point constants in the TOC if -mrelocatable. */ |
375 | ||
376 | #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P | |
a9098fd0 | 377 | #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ |
b6c9286a | 378 | (TARGET_TOC \ |
2e42a52f | 379 | && (SYMBOL_REF_P (X) \ |
b6c9286a | 380 | || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ |
2e42a52f | 381 | && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0))) \ |
b6c9286a | 382 | || GET_CODE (X) == LABEL_REF \ |
2e42a52f | 383 | || (CONST_INT_P (X) \ |
a9098fd0 | 384 | && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ |
b6c9286a | 385 | || (!TARGET_NO_FP_IN_TOC \ |
2e42a52f | 386 | && CONST_DOUBLE_P (X) \ |
ebb109ad | 387 | && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ |
b6c9286a MM |
388 | && BITS_PER_WORD == HOST_BITS_PER_INT))) |
389 | ||
e3f1f242 MM |
390 | /* These macros generate the special .type and .size directives which |
391 | are used to set the corresponding fields of the linker symbol table | |
392 | entries in an ELF object file under SVR4. These macros also output | |
393 | the starting labels for the relevant functions/objects. */ | |
394 | ||
395 | /* Write the extra assembler code needed to declare a function properly. | |
396 | Some svr4 assemblers need to also have something extra said about the | |
397 | function's return value. We allow for that here. */ | |
398 | ||
9ebbca7d | 399 | /* Override elfos.h definition. */ |
e3f1f242 MM |
400 | #undef ASM_DECLARE_FUNCTION_NAME |
401 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ | |
9739c90c | 402 | rs6000_elf_declare_function_name ((FILE), (NAME), (DECL)) |
e3f1f242 | 403 | |
9ebbca7d GK |
404 | /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore |
405 | flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */ | |
406 | ||
407 | #define LOCAL_LABEL_PREFIX "." | |
408 | #define USER_LABEL_PREFIX "" | |
e3f1f242 | 409 | |
9ebbca7d GK |
410 | #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \ |
411 | asm_fprintf (FILE, "%L%s", PREFIX) | |
412 | ||
506a61b1 KG |
413 | /* Globalizing directive for a label. */ |
414 | #define GLOBAL_ASM_OP "\t.globl " | |
e3f1f242 | 415 | |
5f01fc14 MM |
416 | /* This says how to output assembler code to declare an |
417 | uninitialized internal linkage data object. Under SVR4, | |
418 | the linker seems to want the alignment of data objects | |
419 | to depend on their types. We do exactly that here. */ | |
420 | ||
76bbee81 | 421 | #define LOCAL_ASM_OP "\t.local\t" |
5f01fc14 | 422 | |
76bbee81 | 423 | #define LCOMM_ASM_OP "\t.lcomm\t" |
e47ae1c2 | 424 | |
c1b7d95a AM |
425 | /* Describe how to emit uninitialized local items. */ |
426 | #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ | |
5f01fc14 | 427 | do { \ |
c1b7d95a | 428 | if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \ |
e47ae1c2 | 429 | { \ |
d6b5193b | 430 | switch_to_section (sbss_section); \ |
e47ae1c2 MM |
431 | ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \ |
432 | ASM_OUTPUT_LABEL (FILE, NAME); \ | |
433 | ASM_OUTPUT_SKIP (FILE, SIZE); \ | |
434 | if (!flag_inhibit_size_directive && (SIZE) > 0) \ | |
2be2ac70 | 435 | ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ |
e47ae1c2 | 436 | } \ |
5f01fc14 | 437 | else \ |
e47ae1c2 | 438 | { \ |
b9f7d63e | 439 | fprintf (FILE, "%s", LCOMM_ASM_OP); \ |
e47ae1c2 | 440 | assemble_name ((FILE), (NAME)); \ |
16998094 | 441 | fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ |
7aabff18 | 442 | (SIZE), (ALIGN) / BITS_PER_UNIT); \ |
e47ae1c2 | 443 | } \ |
38a3dbbb | 444 | ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ |
fff4998b MM |
445 | } while (0) |
446 | ||
9ebbca7d GK |
447 | /* Describe how to emit uninitialized external linkage items. */ |
448 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
fff4998b | 449 | do { \ |
c1b7d95a | 450 | ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \ |
5f01fc14 MM |
451 | } while (0) |
452 | ||
6d6ab190 DE |
453 | #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
454 | /* To support -falign-* switches we need to use .p2align so | |
455 | that alignment directives in code sections will be padded | |
456 | with no-op instructions, rather than zeroes. */ | |
457 | #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ | |
458 | if ((LOG) != 0) \ | |
459 | { \ | |
460 | if ((MAX_SKIP) == 0) \ | |
461 | fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ | |
462 | else \ | |
463 | fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ | |
464 | } | |
465 | #endif | |
466 | ||
09eeeacb AM |
467 | /* This is how to output code to push a register on the stack. |
468 | It need not be very fast code. | |
469 | ||
470 | On the rs6000, we must keep the backchain up to date. In order | |
471 | to simplify things, always allocate 16 bytes for a push (System V | |
472 | wants to keep stack aligned to a 16 byte boundary). */ | |
473 | ||
474 | #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ | |
475 | do { \ | |
476 | if (DEFAULT_ABI == ABI_V4) \ | |
477 | asm_fprintf (FILE, \ | |
6b39bc38 | 478 | "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n", \ |
09eeeacb AM |
479 | reg_names[1], reg_names[1], reg_names[REGNO], \ |
480 | reg_names[1]); \ | |
481 | } while (0) | |
482 | ||
483 | /* This is how to output an insn to pop a register from the stack. | |
484 | It need not be very fast code. */ | |
485 | ||
486 | #define ASM_OUTPUT_REG_POP(FILE, REGNO) \ | |
487 | do { \ | |
488 | if (DEFAULT_ABI == ABI_V4) \ | |
489 | asm_fprintf (FILE, \ | |
484d637f | 490 | "\tlwz %s,12(%s)\n\taddi %s,%s,16\n", \ |
09eeeacb AM |
491 | reg_names[REGNO], reg_names[1], reg_names[1], \ |
492 | reg_names[1]); \ | |
493 | } while (0) | |
494 | ||
9ebbca7d GK |
495 | extern int fixuplabelno; |
496 | ||
d9f6800d RH |
497 | /* Handle constructors specially for -mrelocatable. */ |
498 | #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor | |
499 | #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor | |
500 | ||
e3f1f242 MM |
501 | /* This is the end of what might become sysv4.h. */ |
502 | ||
99e2a354 | 503 | /* Use DWARF 2 debugging information by default. */ |
0e5dbd9b DE |
504 | #undef PREFERRED_DEBUGGING_TYPE |
505 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
c81bebd7 | 506 | |
99e2a354 | 507 | /* Historically we have also supported stabs debugging. */ |
0e5dbd9b | 508 | #define DBX_DEBUGGING_INFO 1 |
e3f1f242 | 509 | |
0e5dbd9b | 510 | #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info |
0e5dbd9b | 511 | #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p |
d9407988 | 512 | |
54ee9799 DE |
513 | /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ |
514 | ||
515 | #define RS6000_OUTPUT_BASENAME(FILE, NAME) \ | |
516 | assemble_name (FILE, NAME) | |
517 | ||
d1908feb JJ |
518 | /* We have to output the stabs for the function name *first*, before |
519 | outputting its label. */ | |
e3f1f242 MM |
520 | |
521 | #define DBX_FUNCTION_FIRST | |
522 | ||
523 | /* This is the end of what might become sysv4dbx.h. */ | |
4697a36c | 524 | \f |
c4ad648e AM |
525 | #define TARGET_OS_SYSV_CPP_BUILTINS() \ |
526 | do \ | |
527 | { \ | |
4d967549 MM |
528 | if (rs6000_isa_flags_explicit \ |
529 | & OPTION_MASK_RELOCATABLE) \ | |
c4ad648e AM |
530 | builtin_define ("_RELOCATABLE"); \ |
531 | } \ | |
9739c90c JJ |
532 | while (0) |
533 | ||
7990b46f | 534 | #ifndef TARGET_OS_CPP_BUILTINS |
c4ad648e AM |
535 | #define TARGET_OS_CPP_BUILTINS() \ |
536 | do \ | |
537 | { \ | |
538 | builtin_define_std ("PPC"); \ | |
539 | builtin_define_std ("unix"); \ | |
540 | builtin_define ("__svr4__"); \ | |
541 | builtin_assert ("system=unix"); \ | |
542 | builtin_assert ("system=svr4"); \ | |
543 | builtin_assert ("cpu=powerpc"); \ | |
544 | builtin_assert ("machine=powerpc"); \ | |
545 | TARGET_OS_SYSV_CPP_BUILTINS (); \ | |
546 | } \ | |
7990b46f | 547 | while (0) |
b91da81f | 548 | #endif |
c2baf133 | 549 | |
8f1dbf8d AM |
550 | /* Select one of BIG_OPT, LITTLE_OPT or DEFAULT_OPT depending |
551 | on various -mbig, -mlittle and -mcall- options. */ | |
552 | #define ENDIAN_SELECT(BIG_OPT, LITTLE_OPT, DEFAULT_OPT) \ | |
553 | "%{mlittle|mlittle-endian:" LITTLE_OPT ";" \ | |
554 | "mbig|mbig-endian:" BIG_OPT ";" \ | |
8f1dbf8d AM |
555 | "mcall-i960-old:" LITTLE_OPT ";" \ |
556 | ":" DEFAULT_OPT "}" | |
557 | ||
8f1dbf8d | 558 | #define DEFAULT_ASM_ENDIAN " -mbig" |
8f1dbf8d | 559 | |
9ebbca7d GK |
560 | #undef ASM_SPEC |
561 | #define ASM_SPEC "%(asm_cpu) \ | |
a1cd969e | 562 | %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ |
428b3812 | 563 | %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ |
8f1dbf8d AM |
564 | %{memb|msdata=eabi: -memb}" \ |
565 | ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) | |
bef84347 | 566 | |
7f970b70 AM |
567 | #ifndef CC1_SECURE_PLT_DEFAULT_SPEC |
568 | #define CC1_SECURE_PLT_DEFAULT_SPEC "" | |
569 | #endif | |
efbab234 GR |
570 | #ifndef LINK_SECURE_PLT_DEFAULT_SPEC |
571 | #define LINK_SECURE_PLT_DEFAULT_SPEC "" | |
572 | #endif | |
7f970b70 | 573 | |
e15e3815 | 574 | /* Pass -G xxx to the compiler. */ |
f0c5fd44 | 575 | #undef CC1_SPEC |
8f1dbf8d | 576 | #define CC1_SPEC "%{G*} %(cc1_cpu)" \ |
8f1dbf8d | 577 | "%{meabi: %{!mcall-*: -mcall-sysv }} \ |
c81bebd7 | 578 | %{!meabi: %{!mno-eabi: \ |
802a0058 | 579 | %{mrelocatable: -meabi } \ |
b91da81f | 580 | %{mcall-freebsd: -mno-eabi } \ |
c36ae96c | 581 | %{mcall-i960-old: -meabi } \ |
edf1b3f3 | 582 | %{mcall-linux: -mno-eabi } \ |
457ef797 ME |
583 | %{mcall-netbsd: -mno-eabi } \ |
584 | %{mcall-openbsd: -mno-eabi }}} \ | |
38c1f2d7 | 585 | %{msdata: -msdata=default} \ |
d540a32c | 586 | %{mno-sdata: -msdata=none} \ |
62045234 AM |
587 | %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}}" \ |
588 | GNU_USER_TARGET_CC1_SPEC | |
c81bebd7 | 589 | |
9ebbca7d | 590 | /* Default starting address if specified. */ |
c81bebd7 | 591 | #define LINK_START_SPEC "\ |
4977bab6 ZW |
592 | %{mads : %(link_start_ads) ; \ |
593 | myellowknife : %(link_start_yellowknife) ; \ | |
594 | mmvme : %(link_start_mvme) ; \ | |
595 | msim : %(link_start_sim) ; \ | |
4977bab6 ZW |
596 | mcall-freebsd: %(link_start_freebsd) ; \ |
597 | mcall-linux : %(link_start_linux) ; \ | |
4977bab6 | 598 | mcall-netbsd : %(link_start_netbsd) ; \ |
457ef797 | 599 | mcall-openbsd: %(link_start_openbsd) ; \ |
4977bab6 | 600 | : %(link_start_default) }" |
c81bebd7 | 601 | |
9da71b16 | 602 | #define LINK_START_DEFAULT_SPEC "" |
efbab234 | 603 | #define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC |
c81bebd7 | 604 | |
9ebbca7d GK |
605 | #undef LINK_SPEC |
606 | #define LINK_SPEC "\ | |
f3597919 | 607 | %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \ |
b89b1e9d | 608 | %{R*} \ |
fba29a8c | 609 | %(link_shlib) \ |
c6c34cb4 | 610 | %{!T*: %(link_start) } \ |
efbab234 | 611 | %{!static: %{!mbss-plt: %(link_secure_plt)}} \ |
fba29a8c MM |
612 | %(link_os)" |
613 | ||
fba29a8c MM |
614 | /* Shared libraries are not default. */ |
615 | #define LINK_SHLIB_SPEC "\ | |
fba29a8c MM |
616 | %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \ |
617 | %{static: } \ | |
3e03217e JM |
618 | %{shared:-G -dy -z text } \ |
619 | %{symbolic:-Bsymbolic -G -dy -z text }" | |
fba29a8c | 620 | |
9ebbca7d | 621 | /* Any specific OS flags. */ |
fba29a8c | 622 | #define LINK_OS_SPEC "\ |
4977bab6 ZW |
623 | %{mads : %(link_os_ads) ; \ |
624 | myellowknife : %(link_os_yellowknife) ; \ | |
625 | mmvme : %(link_os_mvme) ; \ | |
626 | msim : %(link_os_sim) ; \ | |
4977bab6 ZW |
627 | mcall-freebsd: %(link_os_freebsd) ; \ |
628 | mcall-linux : %(link_os_linux) ; \ | |
4977bab6 | 629 | mcall-netbsd : %(link_os_netbsd) ; \ |
457ef797 | 630 | mcall-openbsd: %(link_os_openbsd) ; \ |
4977bab6 | 631 | : %(link_os_default) }" |
c81bebd7 | 632 | |
fba29a8c | 633 | #define LINK_OS_DEFAULT_SPEC "" |
afec0ea9 | 634 | |
9ebbca7d GK |
635 | /* Override rs6000.h definition. */ |
636 | #undef CPP_SPEC | |
9739c90c | 637 | #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \ |
4977bab6 ZW |
638 | %{mads : %(cpp_os_ads) ; \ |
639 | myellowknife : %(cpp_os_yellowknife) ; \ | |
640 | mmvme : %(cpp_os_mvme) ; \ | |
641 | msim : %(cpp_os_sim) ; \ | |
4977bab6 ZW |
642 | mcall-freebsd: %(cpp_os_freebsd) ; \ |
643 | mcall-linux : %(cpp_os_linux) ; \ | |
4977bab6 | 644 | mcall-netbsd : %(cpp_os_netbsd) ; \ |
457ef797 | 645 | mcall-openbsd: %(cpp_os_openbsd) ; \ |
4977bab6 | 646 | : %(cpp_os_default) }" |
c81bebd7 | 647 | |
9ebbca7d | 648 | #define CPP_OS_DEFAULT_SPEC "" |
c81bebd7 | 649 | |
9ebbca7d | 650 | #undef STARTFILE_SPEC |
c81bebd7 | 651 | #define STARTFILE_SPEC "\ |
4977bab6 ZW |
652 | %{mads : %(startfile_ads) ; \ |
653 | myellowknife : %(startfile_yellowknife) ; \ | |
654 | mmvme : %(startfile_mvme) ; \ | |
655 | msim : %(startfile_sim) ; \ | |
4977bab6 ZW |
656 | mcall-freebsd: %(startfile_freebsd) ; \ |
657 | mcall-linux : %(startfile_linux) ; \ | |
4977bab6 | 658 | mcall-netbsd : %(startfile_netbsd) ; \ |
457ef797 | 659 | mcall-openbsd: %(startfile_openbsd) ; \ |
4977bab6 | 660 | : %(startfile_default) }" |
c81bebd7 | 661 | |
860532df | 662 | #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s" |
c81bebd7 MM |
663 | |
664 | #undef LIB_SPEC | |
665 | #define LIB_SPEC "\ | |
4977bab6 ZW |
666 | %{mads : %(lib_ads) ; \ |
667 | myellowknife : %(lib_yellowknife) ; \ | |
668 | mmvme : %(lib_mvme) ; \ | |
669 | msim : %(lib_sim) ; \ | |
4977bab6 ZW |
670 | mcall-freebsd: %(lib_freebsd) ; \ |
671 | mcall-linux : %(lib_linux) ; \ | |
4977bab6 | 672 | mcall-netbsd : %(lib_netbsd) ; \ |
457ef797 | 673 | mcall-openbsd: %(lib_openbsd) ; \ |
4977bab6 | 674 | : %(lib_default) }" |
c81bebd7 | 675 | |
860532df | 676 | #define LIB_DEFAULT_SPEC "-lc" |
9da71b16 | 677 | |
c81bebd7 | 678 | #undef ENDFILE_SPEC |
a1ffecd9 | 679 | #define ENDFILE_SPEC "\ |
18724e30 NF |
680 | %{mads : %(endfile_ads) ; \ |
681 | myellowknife : %(endfile_yellowknife) ; \ | |
682 | mmvme : %(endfile_mvme) ; \ | |
683 | msim : %(endfile_sim) ; \ | |
18724e30 NF |
684 | mcall-freebsd: %(endfile_freebsd) ; \ |
685 | mcall-linux : %(endfile_linux) ; \ | |
18724e30 NF |
686 | mcall-netbsd : %(endfile_netbsd) ; \ |
687 | mcall-openbsd: %(endfile_openbsd) ; \ | |
4977bab6 | 688 | : %(crtsavres_default) %(endfile_default) }" |
a1ffecd9 | 689 | |
18724e30 | 690 | #define CRTSAVRES_DEFAULT_SPEC "" |
c81bebd7 | 691 | |
860532df | 692 | #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s" |
c81bebd7 | 693 | |
e9a25f70 | 694 | /* Motorola ADS support. */ |
e9a25f70 | 695 | #define LIB_ADS_SPEC "--start-group -lads -lc --end-group" |
e9a25f70 | 696 | |
362c63a5 | 697 | #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" |
e9a25f70 | 698 | |
362c63a5 | 699 | #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s" |
e9a25f70 | 700 | |
e9a25f70 | 701 | #define LINK_START_ADS_SPEC "-T ads.ld%s" |
e9a25f70 | 702 | |
e9a25f70 | 703 | #define LINK_OS_ADS_SPEC "" |
e9a25f70 | 704 | |
e9a25f70 | 705 | #define CPP_OS_ADS_SPEC "" |
e9a25f70 JL |
706 | |
707 | /* Motorola Yellowknife support. */ | |
e9a25f70 | 708 | #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group" |
e9a25f70 | 709 | |
362c63a5 | 710 | #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" |
e9a25f70 | 711 | |
362c63a5 | 712 | #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s" |
e9a25f70 | 713 | |
e9a25f70 | 714 | #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s" |
e9a25f70 | 715 | |
e9a25f70 | 716 | #define LINK_OS_YELLOWKNIFE_SPEC "" |
e9a25f70 | 717 | |
e9a25f70 | 718 | #define CPP_OS_YELLOWKNIFE_SPEC "" |
e9a25f70 | 719 | |
c81bebd7 | 720 | /* Motorola MVME support. */ |
e9a25f70 | 721 | #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group" |
c81bebd7 | 722 | |
362c63a5 | 723 | #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" |
c81bebd7 | 724 | |
362c63a5 | 725 | #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s" |
c81bebd7 | 726 | |
362c63a5 | 727 | #define LINK_START_MVME_SPEC "-Ttext 0x40000" |
c81bebd7 | 728 | |
fba29a8c | 729 | #define LINK_OS_MVME_SPEC "" |
fba29a8c | 730 | |
c81bebd7 | 731 | #define CPP_OS_MVME_SPEC "" |
c81bebd7 MM |
732 | |
733 | /* PowerPC simulator based on netbsd system calls support. */ | |
e9a25f70 | 734 | #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group" |
c81bebd7 | 735 | |
362c63a5 | 736 | #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s" |
c81bebd7 | 737 | |
362c63a5 | 738 | #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s" |
c81bebd7 | 739 | |
362c63a5 | 740 | #define LINK_START_SIM_SPEC "" |
c81bebd7 | 741 | |
362c63a5 | 742 | #define LINK_OS_SIM_SPEC "-m elf32ppcsim" |
fba29a8c | 743 | |
c81bebd7 | 744 | #define CPP_OS_SIM_SPEC "" |
c81bebd7 | 745 | |
b91da81f DB |
746 | /* FreeBSD support. */ |
747 | ||
748 | #define CPP_OS_FREEBSD_SPEC "\ | |
4e2e315f | 749 | -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \ |
b91da81f DB |
750 | -Acpu=powerpc -Amachine=powerpc" |
751 | ||
752 | #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC | |
753 | #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC | |
754 | #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC | |
755 | #define LINK_START_FREEBSD_SPEC "" | |
756 | ||
757 | #define LINK_OS_FREEBSD_SPEC "\ | |
d8a07487 | 758 | %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \ |
2de2f846 DB |
759 | %{v:-V} \ |
760 | %{assert*} %{R*} %{rpath*} %{defsym*} \ | |
761 | %{shared:-Bshareable %{h*} %{soname*}} \ | |
762 | %{!shared: \ | |
763 | %{!static: \ | |
764 | %{rdynamic: -export-dynamic} \ | |
e59dabd2 | 765 | -dynamic-linker %(fbsd_dynamic_linker) } \ |
2de2f846 DB |
766 | %{static:-Bstatic}} \ |
767 | %{symbolic:-Bsymbolic}" | |
b91da81f | 768 | |
956d6950 | 769 | /* GNU/Linux support. */ |
62045234 AM |
770 | #define LIB_LINUX_SPEC \ |
771 | "%{mnewlib: --start-group -llinux -lc --end-group; \ | |
772 | :" GNU_USER_TARGET_LIB_SPEC "}" | |
31269570 | 773 | |
62045234 AM |
774 | #define STARTFILE_LINUX_SPEC GNU_USER_TARGET_STARTFILE_SPEC |
775 | ||
776 | #define ENDFILE_LINUX_SPEC GNU_USER_TARGET_ENDFILE_SPEC | |
c81bebd7 | 777 | |
362c63a5 | 778 | #define LINK_START_LINUX_SPEC "" |
c81bebd7 | 779 | |
7e8efecb GR |
780 | #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","") |
781 | ||
7bd85ce0 | 782 | #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" |
426a04b8 | 783 | #undef MUSL_DYNAMIC_LINKER |
7e8efecb GR |
784 | #define MUSL_DYNAMIC_LINKER \ |
785 | "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" | |
7bd85ce0 | 786 | |
59faa32e AM |
787 | #ifndef GNU_USER_DYNAMIC_LINKER |
788 | #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER | |
789 | #endif | |
790 | ||
362c63a5 GK |
791 | #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ |
792 | %{rdynamic:-export-dynamic} \ | |
107fd1c1 | 793 | -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}" |
fba29a8c | 794 | |
426a04b8 | 795 | #define CPP_OS_LINUX_SPEC "%{pthread:-D_REENTRANT}" |
c81bebd7 | 796 | |
edf1b3f3 AC |
797 | /* NetBSD support. */ |
798 | #define LIB_NETBSD_SPEC "\ | |
5f02b9db | 799 | -lc" |
edf1b3f3 AC |
800 | |
801 | #define STARTFILE_NETBSD_SPEC "\ | |
802 | ncrti.o%s crt0.o%s \ | |
803 | %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" | |
804 | ||
805 | #define ENDFILE_NETBSD_SPEC "\ | |
806 | %{!shared:crtend.o%s} %{shared:crtendS.o%s} \ | |
807 | ncrtn.o%s" | |
808 | ||
809 | #define LINK_START_NETBSD_SPEC "\ | |
810 | " | |
811 | ||
812 | #define LINK_OS_NETBSD_SPEC "\ | |
813 | %{!shared: %{!static: \ | |
814 | %{rdynamic:-export-dynamic} \ | |
e59dabd2 | 815 | -dynamic-linker /usr/libexec/ld.elf_so}}" |
edf1b3f3 AC |
816 | |
817 | #define CPP_OS_NETBSD_SPEC "\ | |
4e2e315f | 818 | -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__" |
edf1b3f3 | 819 | |
457ef797 ME |
820 | /* OpenBSD support. */ |
821 | #ifndef LIB_OPENBSD_SPEC | |
822 | #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" | |
823 | #endif | |
824 | ||
825 | #ifndef STARTFILE_OPENBSD_SPEC | |
826 | #define STARTFILE_OPENBSD_SPEC "\ | |
827 | %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \ | |
828 | %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" | |
829 | #endif | |
830 | ||
831 | #ifndef ENDFILE_OPENBSD_SPEC | |
832 | #define ENDFILE_OPENBSD_SPEC "\ | |
833 | %{!shared:crtend.o%s} %{shared:crtendS.o%s}" | |
834 | #endif | |
835 | ||
836 | #ifndef LINK_START_OPENBSD_SPEC | |
837 | #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074" | |
838 | #endif | |
839 | ||
840 | #ifndef LINK_OS_OPENBSD_SPEC | |
841 | #define LINK_OS_OPENBSD_SPEC "" | |
842 | #endif | |
843 | ||
844 | #ifndef CPP_OS_OPENBSD_SPEC | |
845 | #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" | |
846 | #endif | |
847 | ||
c81bebd7 | 848 | /* Define any extra SPECS that the compiler needs to generate. */ |
9ebbca7d | 849 | /* Override rs6000.h definition. */ |
c81bebd7 | 850 | #undef SUBTARGET_EXTRA_SPECS |
9ebbca7d | 851 | #define SUBTARGET_EXTRA_SPECS \ |
c4ad648e | 852 | { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \ |
e9a25f70 JL |
853 | { "lib_ads", LIB_ADS_SPEC }, \ |
854 | { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
855 | { "lib_mvme", LIB_MVME_SPEC }, \ |
856 | { "lib_sim", LIB_SIM_SPEC }, \ | |
b91da81f | 857 | { "lib_freebsd", LIB_FREEBSD_SPEC }, \ |
c81bebd7 | 858 | { "lib_linux", LIB_LINUX_SPEC }, \ |
edf1b3f3 | 859 | { "lib_netbsd", LIB_NETBSD_SPEC }, \ |
457ef797 | 860 | { "lib_openbsd", LIB_OPENBSD_SPEC }, \ |
c81bebd7 | 861 | { "lib_default", LIB_DEFAULT_SPEC }, \ |
e9a25f70 JL |
862 | { "startfile_ads", STARTFILE_ADS_SPEC }, \ |
863 | { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
864 | { "startfile_mvme", STARTFILE_MVME_SPEC }, \ |
865 | { "startfile_sim", STARTFILE_SIM_SPEC }, \ | |
b91da81f | 866 | { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \ |
c81bebd7 | 867 | { "startfile_linux", STARTFILE_LINUX_SPEC }, \ |
edf1b3f3 | 868 | { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \ |
457ef797 | 869 | { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \ |
c81bebd7 | 870 | { "startfile_default", STARTFILE_DEFAULT_SPEC }, \ |
e9a25f70 JL |
871 | { "endfile_ads", ENDFILE_ADS_SPEC }, \ |
872 | { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
873 | { "endfile_mvme", ENDFILE_MVME_SPEC }, \ |
874 | { "endfile_sim", ENDFILE_SIM_SPEC }, \ | |
b91da81f | 875 | { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \ |
c81bebd7 | 876 | { "endfile_linux", ENDFILE_LINUX_SPEC }, \ |
edf1b3f3 | 877 | { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \ |
457ef797 | 878 | { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \ |
c81bebd7 | 879 | { "endfile_default", ENDFILE_DEFAULT_SPEC }, \ |
fba29a8c | 880 | { "link_shlib", LINK_SHLIB_SPEC }, \ |
83cd7147 | 881 | { "link_start", LINK_START_SPEC }, \ |
e9a25f70 JL |
882 | { "link_start_ads", LINK_START_ADS_SPEC }, \ |
883 | { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
884 | { "link_start_mvme", LINK_START_MVME_SPEC }, \ |
885 | { "link_start_sim", LINK_START_SIM_SPEC }, \ | |
b91da81f | 886 | { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \ |
c81bebd7 | 887 | { "link_start_linux", LINK_START_LINUX_SPEC }, \ |
edf1b3f3 | 888 | { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \ |
457ef797 | 889 | { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \ |
c81bebd7 | 890 | { "link_start_default", LINK_START_DEFAULT_SPEC }, \ |
fba29a8c | 891 | { "link_os", LINK_OS_SPEC }, \ |
e9a25f70 JL |
892 | { "link_os_ads", LINK_OS_ADS_SPEC }, \ |
893 | { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \ | |
fba29a8c MM |
894 | { "link_os_mvme", LINK_OS_MVME_SPEC }, \ |
895 | { "link_os_sim", LINK_OS_SIM_SPEC }, \ | |
b91da81f | 896 | { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ |
fba29a8c | 897 | { "link_os_linux", LINK_OS_LINUX_SPEC }, \ |
edf1b3f3 | 898 | { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ |
457ef797 | 899 | { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ |
fba29a8c | 900 | { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ |
7f970b70 | 901 | { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ |
efbab234 | 902 | { "link_secure_plt", LINK_SECURE_PLT_SPEC }, \ |
e9a25f70 JL |
903 | { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ |
904 | { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ | |
c81bebd7 MM |
905 | { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ |
906 | { "cpp_os_sim", CPP_OS_SIM_SPEC }, \ | |
b91da81f | 907 | { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \ |
c81bebd7 | 908 | { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \ |
edf1b3f3 | 909 | { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \ |
457ef797 | 910 | { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \ |
9739c90c | 911 | { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \ |
2de2f846 | 912 | { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \ |
9739c90c JJ |
913 | SUBSUBTARGET_EXTRA_SPECS |
914 | ||
915 | #define SUBSUBTARGET_EXTRA_SPECS | |
b6c9286a MM |
916 | |
917 | /* Define this macro as a C expression for the initializer of an | |
918 | array of string to tell the driver program which options are | |
919 | defaults for this target and thus do not need to be handled | |
920 | specially when using `MULTILIB_OPTIONS'. | |
921 | ||
922 | Do not define this macro if `MULTILIB_OPTIONS' is not defined in | |
923 | the target makefile fragment or if none of the options listed in | |
924 | `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */ | |
925 | ||
3807773b | 926 | #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" } |
38c1f2d7 MM |
927 | |
928 | /* Define this macro if the code for function profiling should come | |
929 | before the function prologue. Normally, the profiling code comes | |
930 | after. */ | |
931 | #define PROFILE_BEFORE_PROLOGUE 1 | |
932 | ||
933 | /* Function name to call to do profiling. */ | |
38c1f2d7 | 934 | #define RS6000_MCOUNT "_mcount" |
e0f7170a | 935 | |
e44713f7 GK |
936 | /* Select a format to encode pointers in exception handling data. CODE |
937 | is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is | |
938 | true if the symbol may be affected by dynamic relocations. */ | |
6a67e81b AM |
939 | #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ |
940 | (flag_pic \ | |
941 | ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ | |
942 | | DW_EH_PE_sdata4) \ | |
e44713f7 | 943 | : DW_EH_PE_absptr) |
50c30603 | 944 | |
362b68a8 | 945 | #define DOUBLE_INT_ASM_OP "\t.quad\t" |
301d03af RS |
946 | |
947 | /* Generate entries in .fixup for relocatable addresses. */ | |
9f91e6cc | 948 | #define RELOCATABLE_NEEDS_FIXUP 1 |
78f5898b | 949 | |
617718f7 AM |
950 | #define TARGET_ASM_FILE_END rs6000_elf_file_end |
951 | ||
957fee09 PB |
952 | #undef TARGET_ASAN_SHADOW_OFFSET |
953 | #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset | |
954 | ||
78f5898b AH |
955 | /* This target uses the sysv4.opt file. */ |
956 | #define TARGET_USES_SYSV4_OPT 1 | |
a1cd969e | 957 | |
7e8efecb GR |
958 | /* Include order changes for musl, same as in generic linux.h. */ |
959 | #if DEFAULT_LIBC == LIBC_MUSL | |
960 | #define INCLUDE_DEFAULTS_MUSL_GPP \ | |
961 | { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ | |
962 | GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ | |
963 | { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ | |
964 | GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ | |
965 | { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ | |
966 | GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, | |
967 | ||
968 | #ifdef LOCAL_INCLUDE_DIR | |
969 | #define INCLUDE_DEFAULTS_MUSL_LOCAL \ | |
970 | { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ | |
971 | { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, | |
972 | #else | |
973 | #define INCLUDE_DEFAULTS_MUSL_LOCAL | |
974 | #endif | |
975 | ||
976 | #ifdef PREFIX_INCLUDE_DIR | |
977 | #define INCLUDE_DEFAULTS_MUSL_PREFIX \ | |
978 | { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, | |
979 | #else | |
980 | #define INCLUDE_DEFAULTS_MUSL_PREFIX | |
981 | #endif | |
982 | ||
983 | #ifdef CROSS_INCLUDE_DIR | |
984 | #define INCLUDE_DEFAULTS_MUSL_CROSS \ | |
985 | { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, | |
986 | #else | |
987 | #define INCLUDE_DEFAULTS_MUSL_CROSS | |
988 | #endif | |
989 | ||
990 | #ifdef TOOL_INCLUDE_DIR | |
991 | #define INCLUDE_DEFAULTS_MUSL_TOOL \ | |
992 | { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, | |
993 | #else | |
994 | #define INCLUDE_DEFAULTS_MUSL_TOOL | |
995 | #endif | |
996 | ||
997 | #ifdef NATIVE_SYSTEM_HEADER_DIR | |
998 | #define INCLUDE_DEFAULTS_MUSL_NATIVE \ | |
999 | { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ | |
1000 | { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, | |
1001 | #else | |
1002 | #define INCLUDE_DEFAULTS_MUSL_NATIVE | |
1003 | #endif | |
1004 | ||
1005 | #if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) | |
1006 | # undef INCLUDE_DEFAULTS_MUSL_LOCAL | |
1007 | # define INCLUDE_DEFAULTS_MUSL_LOCAL | |
1008 | # undef INCLUDE_DEFAULTS_MUSL_NATIVE | |
1009 | # define INCLUDE_DEFAULTS_MUSL_NATIVE | |
1010 | #else | |
1011 | # undef INCLUDE_DEFAULTS_MUSL_CROSS | |
1012 | # define INCLUDE_DEFAULTS_MUSL_CROSS | |
1013 | #endif | |
1014 | ||
1015 | #undef INCLUDE_DEFAULTS | |
1016 | #define INCLUDE_DEFAULTS \ | |
1017 | { \ | |
1018 | INCLUDE_DEFAULTS_MUSL_GPP \ | |
1019 | INCLUDE_DEFAULTS_MUSL_LOCAL \ | |
1020 | INCLUDE_DEFAULTS_MUSL_PREFIX \ | |
1021 | INCLUDE_DEFAULTS_MUSL_CROSS \ | |
1022 | INCLUDE_DEFAULTS_MUSL_TOOL \ | |
1023 | INCLUDE_DEFAULTS_MUSL_NATIVE \ | |
1024 | { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ | |
1025 | { 0, 0, 0, 0, 0, 0 } \ | |
1026 | } | |
1027 | #endif |