]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/sysv4.h
rs6000.c (rs6000_option_override_internal): Replace "DEFAULT_ABI != ABI_AIX" test...
[thirdparty/gcc.git] / gcc / config / rs6000 / sysv4.h
1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995-2013 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
4
5 This file is part of GCC.
6
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
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
11
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.
16
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
24 <http://www.gnu.org/licenses/>. */
25
26 /* Header files should be C++ aware in general. */
27 #undef NO_IMPLICIT_EXTERN_C
28 #define NO_IMPLICIT_EXTERN_C
29
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
43 #define TARGET_TOC ((rs6000_isa_flags & OPTION_MASK_64BIT) \
44 || ((rs6000_isa_flags \
45 & (OPTION_MASK_RELOCATABLE \
46 | OPTION_MASK_MINIMAL_TOC)) \
47 && flag_pic > 1) \
48 || DEFAULT_ABI != ABI_V4)
49
50 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
51 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
52 #define TARGET_PROTOTYPE target_prototype
53 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
54 #define TARGET_NO_TOC (! TARGET_TOC)
55 #define TARGET_NO_EABI (! TARGET_EABI)
56 #define TARGET_REGNAMES rs6000_regnames
57
58 #ifdef HAVE_AS_REL16
59 #undef TARGET_SECURE_PLT
60 #define TARGET_SECURE_PLT secure_plt
61 #endif
62
63 #define SDATA_DEFAULT_SIZE 8
64
65 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
66 get control in TARGET_OPTION_OVERRIDE. */
67
68 #define SUBTARGET_OVERRIDE_OPTIONS \
69 do { \
70 if (!global_options_set.x_g_switch_value) \
71 g_switch_value = SDATA_DEFAULT_SIZE; \
72 \
73 if (rs6000_abi_name == NULL) \
74 rs6000_abi_name = RS6000_ABI_NAME; \
75 \
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; \
81 rs6000_isa_flags &= ~ OPTION_MASK_EABI; \
82 } \
83 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
84 || !strcmp (rs6000_abi_name, "eabi")) \
85 { \
86 rs6000_current_abi = ABI_V4; \
87 rs6000_isa_flags |= OPTION_MASK_EABI; \
88 } \
89 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
90 rs6000_current_abi = ABI_AIX; \
91 else if (!strcmp (rs6000_abi_name, "freebsd") \
92 || !strcmp (rs6000_abi_name, "linux")) \
93 { \
94 if (TARGET_64BIT) \
95 rs6000_current_abi = ABI_AIX; \
96 else \
97 rs6000_current_abi = ABI_V4; \
98 } \
99 else if (!strcmp (rs6000_abi_name, "netbsd")) \
100 rs6000_current_abi = ABI_V4; \
101 else if (!strcmp (rs6000_abi_name, "openbsd")) \
102 rs6000_current_abi = ABI_V4; \
103 else if (!strcmp (rs6000_abi_name, "i960-old")) \
104 { \
105 rs6000_current_abi = ABI_V4; \
106 rs6000_isa_flags |= (OPTION_MASK_LITTLE_ENDIAN | OPTION_MASK_EABI); \
107 rs6000_isa_flags &= ~OPTION_MASK_STRICT_ALIGN; \
108 TARGET_NO_BITFIELD_WORD = 1; \
109 } \
110 else \
111 { \
112 rs6000_current_abi = ABI_V4; \
113 error ("bad value for -mcall-%s", rs6000_abi_name); \
114 } \
115 \
116 if (rs6000_sdata_name) \
117 { \
118 if (!strcmp (rs6000_sdata_name, "none")) \
119 rs6000_sdata = SDATA_NONE; \
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 \
129 error ("bad value for -msdata=%s", rs6000_sdata_name); \
130 } \
131 else if (DEFAULT_ABI == ABI_V4) \
132 { \
133 rs6000_sdata = SDATA_DATA; \
134 rs6000_sdata_name = "data"; \
135 } \
136 else \
137 { \
138 rs6000_sdata = SDATA_NONE; \
139 rs6000_sdata_name = "none"; \
140 } \
141 \
142 if (TARGET_RELOCATABLE && \
143 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
144 { \
145 rs6000_sdata = SDATA_DATA; \
146 error ("-mrelocatable and -msdata=%s are incompatible", \
147 rs6000_sdata_name); \
148 } \
149 \
150 else if (flag_pic && DEFAULT_ABI == ABI_V4 \
151 && (rs6000_sdata == SDATA_EABI \
152 || rs6000_sdata == SDATA_SYSV)) \
153 { \
154 rs6000_sdata = SDATA_DATA; \
155 error ("-f%s and -msdata=%s are incompatible", \
156 (flag_pic > 1) ? "PIC" : "pic", \
157 rs6000_sdata_name); \
158 } \
159 \
160 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
161 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
162 { \
163 rs6000_sdata = SDATA_NONE; \
164 error ("-msdata=%s and -mcall-%s are incompatible", \
165 rs6000_sdata_name, rs6000_abi_name); \
166 } \
167 \
168 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
169 \
170 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
171 { \
172 rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \
173 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
174 } \
175 \
176 if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \
177 { \
178 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
179 error ("-mrelocatable and -mcall-%s are incompatible", \
180 rs6000_abi_name); \
181 } \
182 \
183 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \
184 { \
185 flag_pic = 0; \
186 error ("-fPIC and -mcall-%s are incompatible", \
187 rs6000_abi_name); \
188 } \
189 \
190 if (TARGET_SECURE_PLT != secure_plt) \
191 { \
192 error ("-msecure-plt not supported by your assembler"); \
193 } \
194 \
195 /* Treat -fPIC the same as -mrelocatable. */ \
196 if (flag_pic > 1 && DEFAULT_ABI == ABI_V4) \
197 { \
198 rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \
199 TARGET_NO_FP_IN_TOC = 1; \
200 } \
201 \
202 else if (TARGET_RELOCATABLE) \
203 if (!flag_pic) \
204 flag_pic = 2; \
205 } while (0)
206
207 #ifndef RS6000_BI_ARCH
208 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
209 do { \
210 if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT) \
211 error ("-m%s not supported in this configuration", \
212 (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32"); \
213 } while (0)
214 #endif
215
216 /* Override rs6000.h definition. */
217 #undef TARGET_DEFAULT
218 #define TARGET_DEFAULT 0
219
220 /* Override rs6000.h definition. */
221 #undef PROCESSOR_DEFAULT
222 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
223
224 #define FIXED_R2 1
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. */
227 #define FIXED_R13 1
228
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)
234
235 /* Put jump tables in read-only memory, rather than in .text. */
236 #define JUMP_TABLES_IN_TEXT_SECTION 0
237
238 /* Prefix and suffix to use to saving floating point. */
239 #define SAVE_FP_PREFIX "_savefpr_"
240 #define SAVE_FP_SUFFIX ""
241
242 /* Prefix and suffix to use to restoring floating point. */
243 #define RESTORE_FP_PREFIX "_restfpr_"
244 #define RESTORE_FP_SUFFIX ""
245
246 /* Type used for size_t, as a string used in a declaration. */
247 #undef SIZE_TYPE
248 #define SIZE_TYPE "unsigned int"
249
250 /* Type used for ptrdiff_t, as a string used in a declaration. */
251 #define PTRDIFF_TYPE "int"
252
253 #undef WCHAR_TYPE
254 #define WCHAR_TYPE "long int"
255
256 #undef WCHAR_TYPE_SIZE
257 #define WCHAR_TYPE_SIZE 32
258
259 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
260 /* Override elfos.h definition. */
261 #undef PCC_BITFIELD_TYPE_MATTERS
262 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
263
264 #undef BITFIELD_NBYTES_LIMITED
265 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
266
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
269 will merely go slower in that case, define this macro as 0. */
270 #undef STRICT_ALIGNMENT
271 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
272
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
288 /* Real stack boundary as mandated by the appropriate ABI. */
289 #define ABI_STACK_BOUNDARY \
290 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
291
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) \
295 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
296 ? 128 : COMPUTED)
297
298 #undef BIGGEST_FIELD_ALIGNMENT
299
300 /* Use ELF style section commands. */
301
302 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
303
304 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
305
306 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
307
308 /* Override elfos.h definition. */
309 #undef INIT_SECTION_ASM_OP
310 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
311
312 /* Override elfos.h definition. */
313 #undef FINI_SECTION_ASM_OP
314 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
315
316 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
317
318 /* Put PC relative got entries in .got2. */
319 #define MINIMAL_TOC_SECTION_ASM_OP \
320 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI == ABI_V4) \
321 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
322
323 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
324 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
325 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
326
327 /* Override default elf definitions. */
328 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
329 #undef TARGET_ASM_RELOC_RW_MASK
330 #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
331 #undef TARGET_ASM_SELECT_RTX_SECTION
332 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
333
334 /* Return nonzero if this entry is to be written into the constant pool
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
339 we can't check that since not every file that uses these target macros
340 includes real.h.
341
342 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
343 allow floating point constants in the TOC if -mrelocatable. */
344
345 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
346 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
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 \
352 || (GET_CODE (X) == CONST_INT \
353 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
354 || (!TARGET_NO_FP_IN_TOC \
355 && !TARGET_RELOCATABLE \
356 && GET_CODE (X) == CONST_DOUBLE \
357 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
358 && BITS_PER_WORD == HOST_BITS_PER_INT)))
359
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
369 /* Override elfos.h definition. */
370 #undef ASM_DECLARE_FUNCTION_NAME
371 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
372 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
373
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 ""
379
380 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
381 asm_fprintf (FILE, "%L%s", PREFIX)
382
383 /* Globalizing directive for a label. */
384 #define GLOBAL_ASM_OP "\t.globl "
385
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
391 #define LOCAL_ASM_OP "\t.local\t"
392
393 #define LCOMM_ASM_OP "\t.lcomm\t"
394
395 /* Describe how to emit uninitialized local items. */
396 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
397 do { \
398 if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \
399 { \
400 switch_to_section (sbss_section); \
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) \
405 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
406 } \
407 else \
408 { \
409 fprintf (FILE, "%s", LCOMM_ASM_OP); \
410 assemble_name ((FILE), (NAME)); \
411 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
412 (SIZE), (ALIGN) / BITS_PER_UNIT); \
413 } \
414 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
415 } while (0)
416
417 /* Describe how to emit uninitialized external linkage items. */
418 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
419 do { \
420 ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \
421 } while (0)
422
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
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, \
448 "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n", \
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, \
460 "\tlwz %s,12(%s)\n\taddic %s,%s,16\n", \
461 reg_names[REGNO], reg_names[1], reg_names[1], \
462 reg_names[1]); \
463 } while (0)
464
465 extern int fixuplabelno;
466
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
471 /* This is the end of what might become sysv4.h. */
472
473 /* Use DWARF 2 debugging information by default. */
474 #undef PREFERRED_DEBUGGING_TYPE
475 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
476
477 /* Historically we have also supported stabs debugging. */
478 #define DBX_DEBUGGING_INFO 1
479
480 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
481 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
482
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
488 /* We have to output the stabs for the function name *first*, before
489 outputting its label. */
490
491 #define DBX_FUNCTION_FIRST
492
493 /* This is the end of what might become sysv4dbx.h. */
494 \f
495 #define TARGET_OS_SYSV_CPP_BUILTINS() \
496 do \
497 { \
498 if (rs6000_isa_flags_explicit \
499 & OPTION_MASK_RELOCATABLE) \
500 builtin_define ("_RELOCATABLE"); \
501 } \
502 while (0)
503
504 #ifndef TARGET_OS_CPP_BUILTINS
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 } \
517 while (0)
518 #endif
519
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 ";" \
525 "mcall-aixdesc|mcall-freebsd|mcall-netbsd|" \
526 "mcall-openbsd|mcall-linux:" BIG_OPT ";" \
527 "mcall-i960-old:" LITTLE_OPT ";" \
528 ":" DEFAULT_OPT "}"
529
530 #define DEFAULT_ASM_ENDIAN " -mbig"
531
532 #undef ASM_SPEC
533 #define ASM_SPEC "%(asm_cpu) \
534 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
535 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
536 %{memb|msdata=eabi: -memb}" \
537 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
538
539 #define CC1_ENDIAN_BIG_SPEC ""
540
541 #define CC1_ENDIAN_LITTLE_SPEC "\
542 %{!mstrict-align: %{!mno-strict-align: \
543 %{!mcall-i960-old: \
544 -mstrict-align \
545 } \
546 }}"
547
548 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
549
550 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
551 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
552 #endif
553
554 /* Pass -G xxx to the compiler and set correct endian mode. */
555 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
556 ENDIAN_SELECT(" %(cc1_endian_big)", " %(cc1_endian_little)", \
557 " %(cc1_endian_default)") \
558 "%{meabi: %{!mcall-*: -mcall-sysv }} \
559 %{!meabi: %{!mno-eabi: \
560 %{mrelocatable: -meabi } \
561 %{mcall-freebsd: -mno-eabi } \
562 %{mcall-i960-old: -meabi } \
563 %{mcall-linux: -mno-eabi } \
564 %{mcall-netbsd: -mno-eabi } \
565 %{mcall-openbsd: -mno-eabi }}} \
566 %{msdata: -msdata=default} \
567 %{mno-sdata: -msdata=none} \
568 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
569 %{profile: -p}"
570
571 /* Default starting address if specified. */
572 #define LINK_START_SPEC "\
573 %{mads : %(link_start_ads) ; \
574 myellowknife : %(link_start_yellowknife) ; \
575 mmvme : %(link_start_mvme) ; \
576 msim : %(link_start_sim) ; \
577 mcall-freebsd: %(link_start_freebsd) ; \
578 mcall-linux : %(link_start_linux) ; \
579 mcall-netbsd : %(link_start_netbsd) ; \
580 mcall-openbsd: %(link_start_openbsd) ; \
581 : %(link_start_default) }"
582
583 #define LINK_START_DEFAULT_SPEC ""
584
585 #undef LINK_SPEC
586 #define LINK_SPEC "\
587 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
588 %{R*} \
589 %(link_shlib) \
590 %{!T*: %(link_start) } \
591 %(link_target) \
592 %(link_os)"
593
594 /* Shared libraries are not default. */
595 #define LINK_SHLIB_SPEC "\
596 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
597 %{static: } \
598 %{shared:-G -dy -z text } \
599 %{symbolic:-Bsymbolic -G -dy -z text }"
600
601 /* Override the default target of the linker. */
602 #define LINK_TARGET_SPEC \
603 ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
604
605 /* Any specific OS flags. */
606 #define LINK_OS_SPEC "\
607 %{mads : %(link_os_ads) ; \
608 myellowknife : %(link_os_yellowknife) ; \
609 mmvme : %(link_os_mvme) ; \
610 msim : %(link_os_sim) ; \
611 mcall-freebsd: %(link_os_freebsd) ; \
612 mcall-linux : %(link_os_linux) ; \
613 mcall-netbsd : %(link_os_netbsd) ; \
614 mcall-openbsd: %(link_os_openbsd) ; \
615 : %(link_os_default) }"
616
617 #define LINK_OS_DEFAULT_SPEC ""
618
619 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
620 %<msingle-float %<mdouble-float}"
621
622 /* Override rs6000.h definition. */
623 #undef CPP_SPEC
624 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
625 %{mads : %(cpp_os_ads) ; \
626 myellowknife : %(cpp_os_yellowknife) ; \
627 mmvme : %(cpp_os_mvme) ; \
628 msim : %(cpp_os_sim) ; \
629 mcall-freebsd: %(cpp_os_freebsd) ; \
630 mcall-linux : %(cpp_os_linux) ; \
631 mcall-netbsd : %(cpp_os_netbsd) ; \
632 mcall-openbsd: %(cpp_os_openbsd) ; \
633 : %(cpp_os_default) }"
634
635 #define CPP_OS_DEFAULT_SPEC ""
636
637 #undef STARTFILE_SPEC
638 #define STARTFILE_SPEC "\
639 %{mads : %(startfile_ads) ; \
640 myellowknife : %(startfile_yellowknife) ; \
641 mmvme : %(startfile_mvme) ; \
642 msim : %(startfile_sim) ; \
643 mcall-freebsd: %(startfile_freebsd) ; \
644 mcall-linux : %(startfile_linux) ; \
645 mcall-netbsd : %(startfile_netbsd) ; \
646 mcall-openbsd: %(startfile_openbsd) ; \
647 : %(startfile_default) }"
648
649 #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
650
651 #undef LIB_SPEC
652 #define LIB_SPEC "\
653 %{mads : %(lib_ads) ; \
654 myellowknife : %(lib_yellowknife) ; \
655 mmvme : %(lib_mvme) ; \
656 msim : %(lib_sim) ; \
657 mcall-freebsd: %(lib_freebsd) ; \
658 mcall-linux : %(lib_linux) ; \
659 mcall-netbsd : %(lib_netbsd) ; \
660 mcall-openbsd: %(lib_openbsd) ; \
661 : %(lib_default) }"
662
663 #define LIB_DEFAULT_SPEC "-lc"
664
665 #undef ENDFILE_SPEC
666 #define ENDFILE_SPEC "\
667 %{mads : %(endfile_ads) ; \
668 myellowknife : %(endfile_yellowknife) ; \
669 mmvme : %(endfile_mvme) ; \
670 msim : %(endfile_sim) ; \
671 mcall-freebsd: %(endfile_freebsd) ; \
672 mcall-linux : %(endfile_linux) ; \
673 mcall-netbsd : %(endfile_netbsd) ; \
674 mcall-openbsd: %(endfile_openbsd) ; \
675 : %(crtsavres_default) %(endfile_default) }"
676
677 #define CRTSAVRES_DEFAULT_SPEC ""
678
679 #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
680
681 /* Motorola ADS support. */
682 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
683
684 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
685
686 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
687
688 #define LINK_START_ADS_SPEC "-T ads.ld%s"
689
690 #define LINK_OS_ADS_SPEC ""
691
692 #define CPP_OS_ADS_SPEC ""
693
694 /* Motorola Yellowknife support. */
695 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
696
697 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
698
699 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
700
701 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
702
703 #define LINK_OS_YELLOWKNIFE_SPEC ""
704
705 #define CPP_OS_YELLOWKNIFE_SPEC ""
706
707 /* Motorola MVME support. */
708 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
709
710 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
711
712 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
713
714 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
715
716 #define LINK_OS_MVME_SPEC ""
717
718 #define CPP_OS_MVME_SPEC ""
719
720 /* PowerPC simulator based on netbsd system calls support. */
721 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
722
723 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
724
725 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
726
727 #define LINK_START_SIM_SPEC ""
728
729 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
730
731 #define CPP_OS_SIM_SPEC ""
732
733 /* FreeBSD support. */
734
735 #define CPP_OS_FREEBSD_SPEC "\
736 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
737 -Acpu=powerpc -Amachine=powerpc"
738
739 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
740 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
741 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
742 #define LINK_START_FREEBSD_SPEC ""
743
744 #define LINK_OS_FREEBSD_SPEC "\
745 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
746 %{v:-V} \
747 %{assert*} %{R*} %{rpath*} %{defsym*} \
748 %{shared:-Bshareable %{h*} %{soname*}} \
749 %{!shared: \
750 %{!static: \
751 %{rdynamic: -export-dynamic} \
752 -dynamic-linker %(fbsd_dynamic_linker) } \
753 %{static:-Bstatic}} \
754 %{symbolic:-Bsymbolic}"
755
756 /* GNU/Linux support. */
757 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
758 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
759 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
760
761 #ifdef HAVE_LD_PIE
762 #define STARTFILE_LINUX_SPEC "\
763 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
764 %{mnewlib:ecrti.o%s;:crti.o%s} \
765 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
766 #else
767 #define STARTFILE_LINUX_SPEC "\
768 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
769 %{mnewlib:ecrti.o%s;:crti.o%s} \
770 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
771 #endif
772
773 #define ENDFILE_LINUX_SPEC "\
774 %{shared|pie:crtendS.o%s;:crtend.o%s} \
775 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
776
777 #define LINK_START_LINUX_SPEC ""
778
779 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
780 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
781 #if DEFAULT_LIBC == LIBC_UCLIBC
782 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
783 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
784 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
785 #else
786 #error "Unsupported DEFAULT_LIBC"
787 #endif
788 #define GNU_USER_DYNAMIC_LINKER \
789 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
790
791 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
792 %{rdynamic:-export-dynamic} \
793 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
794
795 #if defined(HAVE_LD_EH_FRAME_HDR)
796 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
797 #endif
798
799 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
800 %{!undef: \
801 %{!ansi: \
802 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
803 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
804 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
805
806 /* NetBSD support. */
807 #define LIB_NETBSD_SPEC "\
808 -lc"
809
810 #define STARTFILE_NETBSD_SPEC "\
811 ncrti.o%s crt0.o%s \
812 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
813
814 #define ENDFILE_NETBSD_SPEC "\
815 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
816 ncrtn.o%s"
817
818 #define LINK_START_NETBSD_SPEC "\
819 "
820
821 #define LINK_OS_NETBSD_SPEC "\
822 %{!shared: %{!static: \
823 %{rdynamic:-export-dynamic} \
824 -dynamic-linker /usr/libexec/ld.elf_so}}"
825
826 #define CPP_OS_NETBSD_SPEC "\
827 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
828
829 /* OpenBSD support. */
830 #ifndef LIB_OPENBSD_SPEC
831 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
832 #endif
833
834 #ifndef STARTFILE_OPENBSD_SPEC
835 #define STARTFILE_OPENBSD_SPEC "\
836 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
837 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
838 #endif
839
840 #ifndef ENDFILE_OPENBSD_SPEC
841 #define ENDFILE_OPENBSD_SPEC "\
842 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
843 #endif
844
845 #ifndef LINK_START_OPENBSD_SPEC
846 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
847 #endif
848
849 #ifndef LINK_OS_OPENBSD_SPEC
850 #define LINK_OS_OPENBSD_SPEC ""
851 #endif
852
853 #ifndef CPP_OS_OPENBSD_SPEC
854 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
855 #endif
856
857 /* Define any extra SPECS that the compiler needs to generate. */
858 /* Override rs6000.h definition. */
859 #undef SUBTARGET_EXTRA_SPECS
860 #define SUBTARGET_EXTRA_SPECS \
861 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
862 { "lib_ads", LIB_ADS_SPEC }, \
863 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
864 { "lib_mvme", LIB_MVME_SPEC }, \
865 { "lib_sim", LIB_SIM_SPEC }, \
866 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
867 { "lib_linux", LIB_LINUX_SPEC }, \
868 { "lib_netbsd", LIB_NETBSD_SPEC }, \
869 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
870 { "lib_default", LIB_DEFAULT_SPEC }, \
871 { "startfile_ads", STARTFILE_ADS_SPEC }, \
872 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
873 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
874 { "startfile_sim", STARTFILE_SIM_SPEC }, \
875 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
876 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
877 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
878 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
879 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
880 { "endfile_ads", ENDFILE_ADS_SPEC }, \
881 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
882 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
883 { "endfile_sim", ENDFILE_SIM_SPEC }, \
884 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
885 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
886 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
887 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
888 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
889 { "link_shlib", LINK_SHLIB_SPEC }, \
890 { "link_target", LINK_TARGET_SPEC }, \
891 { "link_start", LINK_START_SPEC }, \
892 { "link_start_ads", LINK_START_ADS_SPEC }, \
893 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
894 { "link_start_mvme", LINK_START_MVME_SPEC }, \
895 { "link_start_sim", LINK_START_SIM_SPEC }, \
896 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
897 { "link_start_linux", LINK_START_LINUX_SPEC }, \
898 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
899 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
900 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
901 { "link_os", LINK_OS_SPEC }, \
902 { "link_os_ads", LINK_OS_ADS_SPEC }, \
903 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
904 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
905 { "link_os_sim", LINK_OS_SIM_SPEC }, \
906 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
907 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
908 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
909 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
910 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
911 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
912 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
913 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
914 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
915 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
916 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
917 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
918 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
919 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
920 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
921 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
922 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
923 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
924 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
925 SUBSUBTARGET_EXTRA_SPECS
926
927 #define SUBSUBTARGET_EXTRA_SPECS
928
929 /* Define this macro as a C expression for the initializer of an
930 array of string to tell the driver program which options are
931 defaults for this target and thus do not need to be handled
932 specially when using `MULTILIB_OPTIONS'.
933
934 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
935 the target makefile fragment or if none of the options listed in
936 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
937
938 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
939
940 /* Define this macro if the code for function profiling should come
941 before the function prologue. Normally, the profiling code comes
942 after. */
943 #define PROFILE_BEFORE_PROLOGUE 1
944
945 /* Function name to call to do profiling. */
946 #define RS6000_MCOUNT "_mcount"
947
948 /* Select a format to encode pointers in exception handling data. CODE
949 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
950 true if the symbol may be affected by dynamic relocations. */
951 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
952 ((flag_pic || TARGET_RELOCATABLE) \
953 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
954 : DW_EH_PE_absptr)
955
956 #define DOUBLE_INT_ASM_OP "\t.quad\t"
957
958 /* Generate entries in .fixup for relocatable addresses. */
959 #define RELOCATABLE_NEEDS_FIXUP 1
960
961 #define TARGET_ASM_FILE_END rs6000_elf_file_end
962
963 #undef TARGET_ASAN_SHADOW_OFFSET
964 #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
965
966 /* This target uses the sysv4.opt file. */
967 #define TARGET_USES_SYSV4_OPT 1
968
969 #undef DBX_REGISTER_NUMBER