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