* varasm.c (bss_initializer_p): Remove static.
[official-gcc.git] / gcc / config / rs6000 / sysv4.h
blob8459a8dd4a8493f865e21caf8069e4dca38d0172
1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995-2012 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GCC.
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.
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.
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.
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/>. */
26 /* Header files should be C++ aware in general. */
27 #undef NO_IMPLICIT_EXTERN_C
28 #define NO_IMPLICIT_EXTERN_C
30 /* Yes! We are ELF. */
31 #define TARGET_OBJECT_FORMAT OBJECT_ELF
33 /* Default ABI to compile code for. */
34 #define DEFAULT_ABI rs6000_current_abi
36 /* Default ABI to use. */
37 #define RS6000_ABI_NAME "sysv"
39 /* Override rs6000.h definition. */
40 #undef ASM_DEFAULT_SPEC
41 #define ASM_DEFAULT_SPEC "-mppc"
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_AIX)
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
58 #ifdef HAVE_AS_REL16
59 #undef TARGET_SECURE_PLT
60 #define TARGET_SECURE_PLT secure_plt
61 #endif
63 #define SDATA_DEFAULT_SIZE 8
65 /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
66 get control in TARGET_OPTION_OVERRIDE. */
68 #define SUBTARGET_OVERRIDE_OPTIONS \
69 do { \
70 if (!global_options_set.x_g_switch_value) \
71 g_switch_value = SDATA_DEFAULT_SIZE; \
73 if (rs6000_abi_name == NULL) \
74 rs6000_abi_name = RS6000_ABI_NAME; \
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")) \
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; \
110 else \
112 rs6000_current_abi = ABI_V4; \
113 error ("bad value for -mcall-%s", rs6000_abi_name); \
116 if (rs6000_sdata_name) \
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); \
131 else if (DEFAULT_ABI == ABI_V4) \
133 rs6000_sdata = SDATA_DATA; \
134 rs6000_sdata_name = "data"; \
136 else \
138 rs6000_sdata = SDATA_NONE; \
139 rs6000_sdata_name = "none"; \
142 if (TARGET_RELOCATABLE && \
143 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
145 rs6000_sdata = SDATA_DATA; \
146 error ("-mrelocatable and -msdata=%s are incompatible", \
147 rs6000_sdata_name); \
150 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
151 && (rs6000_sdata == SDATA_EABI \
152 || rs6000_sdata == SDATA_SYSV)) \
154 rs6000_sdata = SDATA_DATA; \
155 error ("-f%s and -msdata=%s are incompatible", \
156 (flag_pic > 1) ? "PIC" : "pic", \
157 rs6000_sdata_name); \
160 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
161 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
163 rs6000_sdata = SDATA_NONE; \
164 error ("-msdata=%s and -mcall-%s are incompatible", \
165 rs6000_sdata_name, rs6000_abi_name); \
168 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
170 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
172 rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \
173 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
176 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
178 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
179 error ("-mrelocatable and -mcall-%s are incompatible", \
180 rs6000_abi_name); \
183 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
185 flag_pic = 0; \
186 error ("-fPIC and -mcall-%s are incompatible", \
187 rs6000_abi_name); \
190 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
192 rs6000_isa_flags &= ~OPTION_MASK_LITTLE_ENDIAN; \
193 error ("-mcall-aixdesc must be big endian"); \
196 if (TARGET_SECURE_PLT != secure_plt) \
198 error ("-msecure-plt not supported by your assembler"); \
201 /* Treat -fPIC the same as -mrelocatable. */ \
202 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
204 rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \
205 TARGET_NO_FP_IN_TOC = 1; \
208 else if (TARGET_RELOCATABLE) \
209 if (!flag_pic) \
210 flag_pic = 2; \
211 } while (0)
213 #ifndef RS6000_BI_ARCH
214 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
215 do { \
216 if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT) \
217 error ("-m%s not supported in this configuration", \
218 (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32"); \
219 } while (0)
220 #endif
222 /* Override rs6000.h definition. */
223 #undef TARGET_DEFAULT
224 #define TARGET_DEFAULT 0
226 /* Override rs6000.h definition. */
227 #undef PROCESSOR_DEFAULT
228 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
230 #define FIXED_R2 1
231 /* System V.4 uses register 13 as a pointer to the small data area,
232 so it is not available to the normal user. */
233 #define FIXED_R13 1
235 /* Override default big endianism definitions in rs6000.h. */
236 #undef BYTES_BIG_ENDIAN
237 #undef WORDS_BIG_ENDIAN
238 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
239 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
241 /* Put jump tables in read-only memory, rather than in .text. */
242 #define JUMP_TABLES_IN_TEXT_SECTION 0
244 /* Prefix and suffix to use to saving floating point. */
245 #define SAVE_FP_PREFIX "_savefpr_"
246 #define SAVE_FP_SUFFIX ""
248 /* Prefix and suffix to use to restoring floating point. */
249 #define RESTORE_FP_PREFIX "_restfpr_"
250 #define RESTORE_FP_SUFFIX ""
252 /* Type used for size_t, as a string used in a declaration. */
253 #undef SIZE_TYPE
254 #define SIZE_TYPE "unsigned int"
256 /* Type used for ptrdiff_t, as a string used in a declaration. */
257 #define PTRDIFF_TYPE "int"
259 #undef WCHAR_TYPE
260 #define WCHAR_TYPE "long int"
262 #undef WCHAR_TYPE_SIZE
263 #define WCHAR_TYPE_SIZE 32
265 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
266 /* Override elfos.h definition. */
267 #undef PCC_BITFIELD_TYPE_MATTERS
268 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
270 #undef BITFIELD_NBYTES_LIMITED
271 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
273 /* Define this macro to be the value 1 if instructions will fail to
274 work if given data not on the nominal alignment. If instructions
275 will merely go slower in that case, define this macro as 0. */
276 #undef STRICT_ALIGNMENT
277 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
279 /* Define this macro if you wish to preserve a certain alignment for
280 the stack pointer, greater than what the hardware enforces. The
281 definition is a C expression for the desired alignment (measured
282 in bits). This macro must evaluate to a value equal to or larger
283 than STACK_BOUNDARY.
284 For the SYSV ABI and variants the alignment of the stack pointer
285 is usually controlled manually in rs6000.c. However, to maintain
286 alignment across alloca () in all circumstances,
287 PREFERRED_STACK_BOUNDARY needs to be set as well.
288 This has the additional advantage of allowing a bigger maximum
289 alignment of user objects on the stack. */
291 #undef PREFERRED_STACK_BOUNDARY
292 #define PREFERRED_STACK_BOUNDARY 128
294 /* Real stack boundary as mandated by the appropriate ABI. */
295 #define ABI_STACK_BOUNDARY \
296 ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128)
298 /* An expression for the alignment of a structure field FIELD if the
299 alignment computed in the usual way is COMPUTED. */
300 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
301 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
302 ? 128 : COMPUTED)
304 #undef BIGGEST_FIELD_ALIGNMENT
306 /* Use ELF style section commands. */
308 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
310 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
312 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
314 /* Override elfos.h definition. */
315 #undef INIT_SECTION_ASM_OP
316 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
318 /* Override elfos.h definition. */
319 #undef FINI_SECTION_ASM_OP
320 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
322 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
324 /* Put PC relative got entries in .got2. */
325 #define MINIMAL_TOC_SECTION_ASM_OP \
326 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
327 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
329 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
330 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
331 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
333 /* Override default elf definitions. */
334 #define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
335 #undef TARGET_ASM_RELOC_RW_MASK
336 #define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
337 #undef TARGET_ASM_SELECT_RTX_SECTION
338 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
340 /* Return nonzero if this entry is to be written into the constant pool
341 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
342 containing one of them. If -mfp-in-toc (the default), we also do
343 this for floating-point constants. We actually can only do this
344 if the FP formats of the target and host machines are the same, but
345 we can't check that since not every file that uses these target macros
346 includes real.h.
348 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
349 allow floating point constants in the TOC if -mrelocatable. */
351 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
352 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
353 (TARGET_TOC \
354 && (GET_CODE (X) == SYMBOL_REF \
355 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
356 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
357 || GET_CODE (X) == LABEL_REF \
358 || (GET_CODE (X) == CONST_INT \
359 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
360 || (!TARGET_NO_FP_IN_TOC \
361 && !TARGET_RELOCATABLE \
362 && GET_CODE (X) == CONST_DOUBLE \
363 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
364 && BITS_PER_WORD == HOST_BITS_PER_INT)))
366 /* These macros generate the special .type and .size directives which
367 are used to set the corresponding fields of the linker symbol table
368 entries in an ELF object file under SVR4. These macros also output
369 the starting labels for the relevant functions/objects. */
371 /* Write the extra assembler code needed to declare a function properly.
372 Some svr4 assemblers need to also have something extra said about the
373 function's return value. We allow for that here. */
375 /* Override elfos.h definition. */
376 #undef ASM_DECLARE_FUNCTION_NAME
377 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
378 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
380 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
381 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
383 #define LOCAL_LABEL_PREFIX "."
384 #define USER_LABEL_PREFIX ""
386 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
387 asm_fprintf (FILE, "%L%s", PREFIX)
389 /* Globalizing directive for a label. */
390 #define GLOBAL_ASM_OP "\t.globl "
392 /* This says how to output assembler code to declare an
393 uninitialized internal linkage data object. Under SVR4,
394 the linker seems to want the alignment of data objects
395 to depend on their types. We do exactly that here. */
397 #define LOCAL_ASM_OP "\t.local\t"
399 #define LCOMM_ASM_OP "\t.lcomm\t"
401 /* Describe how to emit uninitialized local items. */
402 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
403 do { \
404 if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \
406 switch_to_section (sbss_section); \
407 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
408 ASM_OUTPUT_LABEL (FILE, NAME); \
409 ASM_OUTPUT_SKIP (FILE, SIZE); \
410 if (!flag_inhibit_size_directive && (SIZE) > 0) \
411 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
413 else \
415 fprintf (FILE, "%s", LCOMM_ASM_OP); \
416 assemble_name ((FILE), (NAME)); \
417 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
418 (SIZE), (ALIGN) / BITS_PER_UNIT); \
420 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
421 } while (0)
423 /* Describe how to emit uninitialized external linkage items. */
424 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
425 do { \
426 ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \
427 } while (0)
429 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
430 /* To support -falign-* switches we need to use .p2align so
431 that alignment directives in code sections will be padded
432 with no-op instructions, rather than zeroes. */
433 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
434 if ((LOG) != 0) \
436 if ((MAX_SKIP) == 0) \
437 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
438 else \
439 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
441 #endif
443 /* This is how to output code to push a register on the stack.
444 It need not be very fast code.
446 On the rs6000, we must keep the backchain up to date. In order
447 to simplify things, always allocate 16 bytes for a push (System V
448 wants to keep stack aligned to a 16 byte boundary). */
450 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
451 do { \
452 if (DEFAULT_ABI == ABI_V4) \
453 asm_fprintf (FILE, \
454 "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n", \
455 reg_names[1], reg_names[1], reg_names[REGNO], \
456 reg_names[1]); \
457 } while (0)
459 /* This is how to output an insn to pop a register from the stack.
460 It need not be very fast code. */
462 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
463 do { \
464 if (DEFAULT_ABI == ABI_V4) \
465 asm_fprintf (FILE, \
466 "\tlwz %s,12(%s)\n\taddic %s,%s,16\n", \
467 reg_names[REGNO], reg_names[1], reg_names[1], \
468 reg_names[1]); \
469 } while (0)
471 extern int fixuplabelno;
473 /* Handle constructors specially for -mrelocatable. */
474 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
475 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
477 /* This is the end of what might become sysv4.h. */
479 /* Use DWARF 2 debugging information by default. */
480 #undef PREFERRED_DEBUGGING_TYPE
481 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
483 /* Historically we have also supported stabs debugging. */
484 #define DBX_DEBUGGING_INFO 1
486 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
487 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
489 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
491 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
492 assemble_name (FILE, NAME)
494 /* We have to output the stabs for the function name *first*, before
495 outputting its label. */
497 #define DBX_FUNCTION_FIRST
499 /* This is the end of what might become sysv4dbx.h. */
501 #define TARGET_OS_SYSV_CPP_BUILTINS() \
502 do \
504 if (rs6000_isa_flags_explicit \
505 & OPTION_MASK_RELOCATABLE) \
506 builtin_define ("_RELOCATABLE"); \
508 while (0)
510 #ifndef TARGET_OS_CPP_BUILTINS
511 #define TARGET_OS_CPP_BUILTINS() \
512 do \
514 builtin_define_std ("PPC"); \
515 builtin_define_std ("unix"); \
516 builtin_define ("__svr4__"); \
517 builtin_assert ("system=unix"); \
518 builtin_assert ("system=svr4"); \
519 builtin_assert ("cpu=powerpc"); \
520 builtin_assert ("machine=powerpc"); \
521 TARGET_OS_SYSV_CPP_BUILTINS (); \
523 while (0)
524 #endif
526 #undef ASM_SPEC
527 #define ASM_SPEC "%(asm_cpu) \
528 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
529 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
530 %{memb|msdata=eabi: -memb} \
531 %{mlittle|mlittle-endian:-mlittle; \
532 mbig|mbig-endian :-mbig; \
533 mcall-aixdesc | \
534 mcall-freebsd | \
535 mcall-netbsd | \
536 mcall-openbsd | \
537 mcall-linux :-mbig; \
538 mcall-i960-old :-mlittle}"
540 #define CC1_ENDIAN_BIG_SPEC ""
542 #define CC1_ENDIAN_LITTLE_SPEC "\
543 %{!mstrict-align: %{!mno-strict-align: \
544 %{!mcall-i960-old: \
545 -mstrict-align \
549 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
551 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
552 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
553 #endif
555 /* Pass -G xxx to the compiler and set correct endian mode. */
556 #define CC1_SPEC "%{G*} %(cc1_cpu) \
557 %{mlittle|mlittle-endian: %(cc1_endian_little); \
558 mbig |mbig-endian : %(cc1_endian_big); \
559 mcall-aixdesc | \
560 mcall-freebsd | \
561 mcall-netbsd | \
562 mcall-openbsd | \
563 mcall-linux : -mbig %(cc1_endian_big); \
564 mcall-i960-old : -mlittle %(cc1_endian_little); \
565 : %(cc1_endian_default)} \
566 %{meabi: %{!mcall-*: -mcall-sysv }} \
567 %{!meabi: %{!mno-eabi: \
568 %{mrelocatable: -meabi } \
569 %{mcall-freebsd: -mno-eabi } \
570 %{mcall-i960-old: -meabi } \
571 %{mcall-linux: -mno-eabi } \
572 %{mcall-netbsd: -mno-eabi } \
573 %{mcall-openbsd: -mno-eabi }}} \
574 %{msdata: -msdata=default} \
575 %{mno-sdata: -msdata=none} \
576 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
577 %{profile: -p}"
579 /* Default starting address if specified. */
580 #define LINK_START_SPEC "\
581 %{mads : %(link_start_ads) ; \
582 myellowknife : %(link_start_yellowknife) ; \
583 mmvme : %(link_start_mvme) ; \
584 msim : %(link_start_sim) ; \
585 mcall-freebsd: %(link_start_freebsd) ; \
586 mcall-linux : %(link_start_linux) ; \
587 mcall-netbsd : %(link_start_netbsd) ; \
588 mcall-openbsd: %(link_start_openbsd) ; \
589 : %(link_start_default) }"
591 #define LINK_START_DEFAULT_SPEC ""
593 #undef LINK_SPEC
594 #define LINK_SPEC "\
595 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
596 %{R*} \
597 %(link_shlib) \
598 %{!T*: %(link_start) } \
599 %(link_target) \
600 %(link_os)"
602 /* Shared libraries are not default. */
603 #define LINK_SHLIB_SPEC "\
604 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
605 %{static: } \
606 %{shared:-G -dy -z text } \
607 %{symbolic:-Bsymbolic -G -dy -z text }"
609 /* Override the default target of the linker. */
610 #define LINK_TARGET_SPEC "\
611 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
612 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
613 %{mcall-i960-old: --oformat elf32-powerpcle} \
614 }}}}"
616 /* Any specific OS flags. */
617 #define LINK_OS_SPEC "\
618 %{mads : %(link_os_ads) ; \
619 myellowknife : %(link_os_yellowknife) ; \
620 mmvme : %(link_os_mvme) ; \
621 msim : %(link_os_sim) ; \
622 mcall-freebsd: %(link_os_freebsd) ; \
623 mcall-linux : %(link_os_linux) ; \
624 mcall-netbsd : %(link_os_netbsd) ; \
625 mcall-openbsd: %(link_os_openbsd) ; \
626 : %(link_os_default) }"
628 #define LINK_OS_DEFAULT_SPEC ""
630 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
631 %<msingle-float %<mdouble-float}"
633 /* Override rs6000.h definition. */
634 #undef CPP_SPEC
635 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
636 %{mads : %(cpp_os_ads) ; \
637 myellowknife : %(cpp_os_yellowknife) ; \
638 mmvme : %(cpp_os_mvme) ; \
639 msim : %(cpp_os_sim) ; \
640 mcall-freebsd: %(cpp_os_freebsd) ; \
641 mcall-linux : %(cpp_os_linux) ; \
642 mcall-netbsd : %(cpp_os_netbsd) ; \
643 mcall-openbsd: %(cpp_os_openbsd) ; \
644 : %(cpp_os_default) }"
646 #define CPP_OS_DEFAULT_SPEC ""
648 #undef STARTFILE_SPEC
649 #define STARTFILE_SPEC "\
650 %{mads : %(startfile_ads) ; \
651 myellowknife : %(startfile_yellowknife) ; \
652 mmvme : %(startfile_mvme) ; \
653 msim : %(startfile_sim) ; \
654 mcall-freebsd: %(startfile_freebsd) ; \
655 mcall-linux : %(startfile_linux) ; \
656 mcall-netbsd : %(startfile_netbsd) ; \
657 mcall-openbsd: %(startfile_openbsd) ; \
658 : %(startfile_default) }"
660 #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
662 #undef LIB_SPEC
663 #define LIB_SPEC "\
664 %{mads : %(lib_ads) ; \
665 myellowknife : %(lib_yellowknife) ; \
666 mmvme : %(lib_mvme) ; \
667 msim : %(lib_sim) ; \
668 mcall-freebsd: %(lib_freebsd) ; \
669 mcall-linux : %(lib_linux) ; \
670 mcall-netbsd : %(lib_netbsd) ; \
671 mcall-openbsd: %(lib_openbsd) ; \
672 : %(lib_default) }"
674 #define LIB_DEFAULT_SPEC "-lc"
676 #undef ENDFILE_SPEC
677 #define ENDFILE_SPEC "\
678 %{mads : %(endfile_ads) ; \
679 myellowknife : %(endfile_yellowknife) ; \
680 mmvme : %(endfile_mvme) ; \
681 msim : %(endfile_sim) ; \
682 mcall-freebsd: %(endfile_freebsd) ; \
683 mcall-linux : %(endfile_linux) ; \
684 mcall-netbsd : %(endfile_netbsd) ; \
685 mcall-openbsd: %(endfile_openbsd) ; \
686 : %(crtsavres_default) %(endfile_default) }"
688 #define CRTSAVRES_DEFAULT_SPEC ""
690 #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
692 /* Motorola ADS support. */
693 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
695 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
697 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
699 #define LINK_START_ADS_SPEC "-T ads.ld%s"
701 #define LINK_OS_ADS_SPEC ""
703 #define CPP_OS_ADS_SPEC ""
705 /* Motorola Yellowknife support. */
706 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
708 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
710 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
712 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
714 #define LINK_OS_YELLOWKNIFE_SPEC ""
716 #define CPP_OS_YELLOWKNIFE_SPEC ""
718 /* Motorola MVME support. */
719 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
721 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
723 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
725 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
727 #define LINK_OS_MVME_SPEC ""
729 #define CPP_OS_MVME_SPEC ""
731 /* PowerPC simulator based on netbsd system calls support. */
732 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
734 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
736 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
738 #define LINK_START_SIM_SPEC ""
740 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
742 #define CPP_OS_SIM_SPEC ""
744 /* FreeBSD support. */
746 #define CPP_OS_FREEBSD_SPEC "\
747 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
748 -Acpu=powerpc -Amachine=powerpc"
750 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
751 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
752 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
753 #define LINK_START_FREEBSD_SPEC ""
755 #define LINK_OS_FREEBSD_SPEC "\
756 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
757 %{v:-V} \
758 %{assert*} %{R*} %{rpath*} %{defsym*} \
759 %{shared:-Bshareable %{h*} %{soname*}} \
760 %{!shared: \
761 %{!static: \
762 %{rdynamic: -export-dynamic} \
763 -dynamic-linker %(fbsd_dynamic_linker) } \
764 %{static:-Bstatic}} \
765 %{symbolic:-Bsymbolic}"
767 /* GNU/Linux support. */
768 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
769 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
770 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
772 #ifdef HAVE_LD_PIE
773 #define STARTFILE_LINUX_SPEC "\
774 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
775 %{mnewlib:ecrti.o%s;:crti.o%s} \
776 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
777 #else
778 #define STARTFILE_LINUX_SPEC "\
779 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
780 %{mnewlib:ecrti.o%s;:crti.o%s} \
781 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
782 #endif
784 #define ENDFILE_LINUX_SPEC "\
785 %{shared|pie:crtendS.o%s;:crtend.o%s} \
786 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
788 #define LINK_START_LINUX_SPEC ""
790 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
791 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
792 #if DEFAULT_LIBC == LIBC_UCLIBC
793 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
794 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
795 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
796 #else
797 #error "Unsupported DEFAULT_LIBC"
798 #endif
799 #define GNU_USER_DYNAMIC_LINKER \
800 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
802 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
803 %{rdynamic:-export-dynamic} \
804 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
806 #if defined(HAVE_LD_EH_FRAME_HDR)
807 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
808 #endif
810 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
811 %{!undef: \
812 %{!ansi: \
813 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
814 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
815 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
817 /* NetBSD support. */
818 #define LIB_NETBSD_SPEC "\
819 -lc"
821 #define STARTFILE_NETBSD_SPEC "\
822 ncrti.o%s crt0.o%s \
823 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
825 #define ENDFILE_NETBSD_SPEC "\
826 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
827 ncrtn.o%s"
829 #define LINK_START_NETBSD_SPEC "\
832 #define LINK_OS_NETBSD_SPEC "\
833 %{!shared: %{!static: \
834 %{rdynamic:-export-dynamic} \
835 -dynamic-linker /usr/libexec/ld.elf_so}}"
837 #define CPP_OS_NETBSD_SPEC "\
838 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
840 /* OpenBSD support. */
841 #ifndef LIB_OPENBSD_SPEC
842 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
843 #endif
845 #ifndef STARTFILE_OPENBSD_SPEC
846 #define STARTFILE_OPENBSD_SPEC "\
847 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
848 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
849 #endif
851 #ifndef ENDFILE_OPENBSD_SPEC
852 #define ENDFILE_OPENBSD_SPEC "\
853 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
854 #endif
856 #ifndef LINK_START_OPENBSD_SPEC
857 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
858 #endif
860 #ifndef LINK_OS_OPENBSD_SPEC
861 #define LINK_OS_OPENBSD_SPEC ""
862 #endif
864 #ifndef CPP_OS_OPENBSD_SPEC
865 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
866 #endif
868 /* Define any extra SPECS that the compiler needs to generate. */
869 /* Override rs6000.h definition. */
870 #undef SUBTARGET_EXTRA_SPECS
871 #define SUBTARGET_EXTRA_SPECS \
872 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
873 { "lib_ads", LIB_ADS_SPEC }, \
874 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
875 { "lib_mvme", LIB_MVME_SPEC }, \
876 { "lib_sim", LIB_SIM_SPEC }, \
877 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
878 { "lib_linux", LIB_LINUX_SPEC }, \
879 { "lib_netbsd", LIB_NETBSD_SPEC }, \
880 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
881 { "lib_default", LIB_DEFAULT_SPEC }, \
882 { "startfile_ads", STARTFILE_ADS_SPEC }, \
883 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
884 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
885 { "startfile_sim", STARTFILE_SIM_SPEC }, \
886 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
887 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
888 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
889 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
890 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
891 { "endfile_ads", ENDFILE_ADS_SPEC }, \
892 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
893 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
894 { "endfile_sim", ENDFILE_SIM_SPEC }, \
895 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
896 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
897 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
898 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
899 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
900 { "link_shlib", LINK_SHLIB_SPEC }, \
901 { "link_target", LINK_TARGET_SPEC }, \
902 { "link_start", LINK_START_SPEC }, \
903 { "link_start_ads", LINK_START_ADS_SPEC }, \
904 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
905 { "link_start_mvme", LINK_START_MVME_SPEC }, \
906 { "link_start_sim", LINK_START_SIM_SPEC }, \
907 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
908 { "link_start_linux", LINK_START_LINUX_SPEC }, \
909 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
910 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
911 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
912 { "link_os", LINK_OS_SPEC }, \
913 { "link_os_ads", LINK_OS_ADS_SPEC }, \
914 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
915 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
916 { "link_os_sim", LINK_OS_SIM_SPEC }, \
917 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
918 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
919 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
920 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
921 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
922 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
923 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
924 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
925 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
926 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
927 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
928 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
929 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
930 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
931 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
932 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
933 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
934 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
935 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
936 SUBSUBTARGET_EXTRA_SPECS
938 #define SUBSUBTARGET_EXTRA_SPECS
940 /* Define this macro as a C expression for the initializer of an
941 array of string to tell the driver program which options are
942 defaults for this target and thus do not need to be handled
943 specially when using `MULTILIB_OPTIONS'.
945 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
946 the target makefile fragment or if none of the options listed in
947 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
949 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
951 /* Define this macro if the code for function profiling should come
952 before the function prologue. Normally, the profiling code comes
953 after. */
954 #define PROFILE_BEFORE_PROLOGUE 1
956 /* Function name to call to do profiling. */
957 #define RS6000_MCOUNT "_mcount"
959 /* Select a format to encode pointers in exception handling data. CODE
960 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
961 true if the symbol may be affected by dynamic relocations. */
962 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
963 ((flag_pic || TARGET_RELOCATABLE) \
964 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
965 : DW_EH_PE_absptr)
967 #define DOUBLE_INT_ASM_OP "\t.quad\t"
969 /* Generate entries in .fixup for relocatable addresses. */
970 #define RELOCATABLE_NEEDS_FIXUP 1
972 #define TARGET_ASM_FILE_END rs6000_elf_file_end
974 #undef TARGET_ASAN_SHADOW_OFFSET
975 #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
977 /* This target uses the sysv4.opt file. */
978 #define TARGET_USES_SYSV4_OPT 1
980 #undef DBX_REGISTER_NUMBER