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