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