]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/sysv4.h
config.gcc (powerpc*-*-linux*): Include gnu-user.h in tm_file.
[thirdparty/gcc.git] / gcc / config / rs6000 / sysv4.h
1 /* Target definitions for GNU compiler for PowerPC running System V.4
2 Copyright (C) 1995-2014 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 (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \
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-i960-old:" LITTLE_OPT ";" \
526 ":" DEFAULT_OPT "}"
527
528 #define DEFAULT_ASM_ENDIAN " -mbig"
529
530 #undef ASM_SPEC
531 #define ASM_SPEC "%(asm_cpu) \
532 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
533 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
534 %{memb|msdata=eabi: -memb}" \
535 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
536
537 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
538 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
539 #endif
540
541 /* Pass -G xxx to the compiler. */
542 #undef CC1_SPEC
543 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
544 "%{meabi: %{!mcall-*: -mcall-sysv }} \
545 %{!meabi: %{!mno-eabi: \
546 %{mrelocatable: -meabi } \
547 %{mcall-freebsd: -mno-eabi } \
548 %{mcall-i960-old: -meabi } \
549 %{mcall-linux: -mno-eabi } \
550 %{mcall-netbsd: -mno-eabi } \
551 %{mcall-openbsd: -mno-eabi }}} \
552 %{msdata: -msdata=default} \
553 %{mno-sdata: -msdata=none} \
554 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
555 %{profile: -p}"
556
557 /* Default starting address if specified. */
558 #define LINK_START_SPEC "\
559 %{mads : %(link_start_ads) ; \
560 myellowknife : %(link_start_yellowknife) ; \
561 mmvme : %(link_start_mvme) ; \
562 msim : %(link_start_sim) ; \
563 mcall-freebsd: %(link_start_freebsd) ; \
564 mcall-linux : %(link_start_linux) ; \
565 mcall-netbsd : %(link_start_netbsd) ; \
566 mcall-openbsd: %(link_start_openbsd) ; \
567 : %(link_start_default) }"
568
569 #define LINK_START_DEFAULT_SPEC ""
570
571 #undef LINK_SPEC
572 #define LINK_SPEC "\
573 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
574 %{R*} \
575 %(link_shlib) \
576 %{!T*: %(link_start) } \
577 %(link_target) \
578 %(link_os)"
579
580 /* Shared libraries are not default. */
581 #define LINK_SHLIB_SPEC "\
582 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
583 %{static: } \
584 %{shared:-G -dy -z text } \
585 %{symbolic:-Bsymbolic -G -dy -z text }"
586
587 /* Override the default target of the linker. */
588 #define LINK_TARGET_SPEC \
589 ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
590
591 /* Any specific OS flags. */
592 #define LINK_OS_SPEC "\
593 %{mads : %(link_os_ads) ; \
594 myellowknife : %(link_os_yellowknife) ; \
595 mmvme : %(link_os_mvme) ; \
596 msim : %(link_os_sim) ; \
597 mcall-freebsd: %(link_os_freebsd) ; \
598 mcall-linux : %(link_os_linux) ; \
599 mcall-netbsd : %(link_os_netbsd) ; \
600 mcall-openbsd: %(link_os_openbsd) ; \
601 : %(link_os_default) }"
602
603 #define LINK_OS_DEFAULT_SPEC ""
604
605 #define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
606 %<msingle-float %<mdouble-float}"
607
608 /* Override rs6000.h definition. */
609 #undef CPP_SPEC
610 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
611 %{mads : %(cpp_os_ads) ; \
612 myellowknife : %(cpp_os_yellowknife) ; \
613 mmvme : %(cpp_os_mvme) ; \
614 msim : %(cpp_os_sim) ; \
615 mcall-freebsd: %(cpp_os_freebsd) ; \
616 mcall-linux : %(cpp_os_linux) ; \
617 mcall-netbsd : %(cpp_os_netbsd) ; \
618 mcall-openbsd: %(cpp_os_openbsd) ; \
619 : %(cpp_os_default) }"
620
621 #define CPP_OS_DEFAULT_SPEC ""
622
623 #undef STARTFILE_SPEC
624 #define STARTFILE_SPEC "\
625 %{mads : %(startfile_ads) ; \
626 myellowknife : %(startfile_yellowknife) ; \
627 mmvme : %(startfile_mvme) ; \
628 msim : %(startfile_sim) ; \
629 mcall-freebsd: %(startfile_freebsd) ; \
630 mcall-linux : %(startfile_linux) ; \
631 mcall-netbsd : %(startfile_netbsd) ; \
632 mcall-openbsd: %(startfile_openbsd) ; \
633 : %(startfile_default) }"
634
635 #define STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
636
637 #undef LIB_SPEC
638 #define LIB_SPEC "\
639 %{mads : %(lib_ads) ; \
640 myellowknife : %(lib_yellowknife) ; \
641 mmvme : %(lib_mvme) ; \
642 msim : %(lib_sim) ; \
643 mcall-freebsd: %(lib_freebsd) ; \
644 mcall-linux : %(lib_linux) ; \
645 mcall-netbsd : %(lib_netbsd) ; \
646 mcall-openbsd: %(lib_openbsd) ; \
647 : %(lib_default) }"
648
649 #define LIB_DEFAULT_SPEC "-lc"
650
651 #undef ENDFILE_SPEC
652 #define ENDFILE_SPEC "\
653 %{mads : %(endfile_ads) ; \
654 myellowknife : %(endfile_yellowknife) ; \
655 mmvme : %(endfile_mvme) ; \
656 msim : %(endfile_sim) ; \
657 mcall-freebsd: %(endfile_freebsd) ; \
658 mcall-linux : %(endfile_linux) ; \
659 mcall-netbsd : %(endfile_netbsd) ; \
660 mcall-openbsd: %(endfile_openbsd) ; \
661 : %(crtsavres_default) %(endfile_default) }"
662
663 #define CRTSAVRES_DEFAULT_SPEC ""
664
665 #define ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
666
667 /* Motorola ADS support. */
668 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
669
670 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
671
672 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
673
674 #define LINK_START_ADS_SPEC "-T ads.ld%s"
675
676 #define LINK_OS_ADS_SPEC ""
677
678 #define CPP_OS_ADS_SPEC ""
679
680 /* Motorola Yellowknife support. */
681 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
682
683 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
684
685 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
686
687 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
688
689 #define LINK_OS_YELLOWKNIFE_SPEC ""
690
691 #define CPP_OS_YELLOWKNIFE_SPEC ""
692
693 /* Motorola MVME support. */
694 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
695
696 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
697
698 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
699
700 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
701
702 #define LINK_OS_MVME_SPEC ""
703
704 #define CPP_OS_MVME_SPEC ""
705
706 /* PowerPC simulator based on netbsd system calls support. */
707 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
708
709 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
710
711 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
712
713 #define LINK_START_SIM_SPEC ""
714
715 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
716
717 #define CPP_OS_SIM_SPEC ""
718
719 /* FreeBSD support. */
720
721 #define CPP_OS_FREEBSD_SPEC "\
722 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
723 -Acpu=powerpc -Amachine=powerpc"
724
725 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
726 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
727 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
728 #define LINK_START_FREEBSD_SPEC ""
729
730 #define LINK_OS_FREEBSD_SPEC "\
731 %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
732 %{v:-V} \
733 %{assert*} %{R*} %{rpath*} %{defsym*} \
734 %{shared:-Bshareable %{h*} %{soname*}} \
735 %{!shared: \
736 %{!static: \
737 %{rdynamic: -export-dynamic} \
738 -dynamic-linker %(fbsd_dynamic_linker) } \
739 %{static:-Bstatic}} \
740 %{symbolic:-Bsymbolic}"
741
742 /* GNU/Linux support. */
743 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
744 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
745 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
746
747 #ifdef HAVE_LD_PIE
748 #define STARTFILE_LINUX_SPEC "\
749 %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
750 %{mnewlib:ecrti.o%s;:crti.o%s} \
751 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
752 #else
753 #define STARTFILE_LINUX_SPEC "\
754 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
755 %{mnewlib:ecrti.o%s;:crti.o%s} \
756 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
757 #endif
758
759 #define ENDFILE_LINUX_SPEC "\
760 %{shared|pie:crtendS.o%s;:crtend.o%s} \
761 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
762
763 #define LINK_START_LINUX_SPEC ""
764
765 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
766 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
767 #if DEFAULT_LIBC == LIBC_UCLIBC
768 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
769 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
770 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
771 #else
772 #error "Unsupported DEFAULT_LIBC"
773 #endif
774 #define GNU_USER_DYNAMIC_LINKER \
775 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
776
777 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
778 %{rdynamic:-export-dynamic} \
779 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
780
781 #if defined(HAVE_LD_EH_FRAME_HDR)
782 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
783 #endif
784
785 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
786 %{!undef: \
787 %{!ansi: \
788 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
789 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
790 -Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
791
792 /* NetBSD support. */
793 #define LIB_NETBSD_SPEC "\
794 -lc"
795
796 #define STARTFILE_NETBSD_SPEC "\
797 ncrti.o%s crt0.o%s \
798 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
799
800 #define ENDFILE_NETBSD_SPEC "\
801 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
802 ncrtn.o%s"
803
804 #define LINK_START_NETBSD_SPEC "\
805 "
806
807 #define LINK_OS_NETBSD_SPEC "\
808 %{!shared: %{!static: \
809 %{rdynamic:-export-dynamic} \
810 -dynamic-linker /usr/libexec/ld.elf_so}}"
811
812 #define CPP_OS_NETBSD_SPEC "\
813 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
814
815 /* OpenBSD support. */
816 #ifndef LIB_OPENBSD_SPEC
817 #define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
818 #endif
819
820 #ifndef STARTFILE_OPENBSD_SPEC
821 #define STARTFILE_OPENBSD_SPEC "\
822 %{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
823 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
824 #endif
825
826 #ifndef ENDFILE_OPENBSD_SPEC
827 #define ENDFILE_OPENBSD_SPEC "\
828 %{!shared:crtend.o%s} %{shared:crtendS.o%s}"
829 #endif
830
831 #ifndef LINK_START_OPENBSD_SPEC
832 #define LINK_START_OPENBSD_SPEC "-Ttext 0x400074"
833 #endif
834
835 #ifndef LINK_OS_OPENBSD_SPEC
836 #define LINK_OS_OPENBSD_SPEC ""
837 #endif
838
839 #ifndef CPP_OS_OPENBSD_SPEC
840 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
841 #endif
842
843 /* Define any extra SPECS that the compiler needs to generate. */
844 /* Override rs6000.h definition. */
845 #undef SUBTARGET_EXTRA_SPECS
846 #define SUBTARGET_EXTRA_SPECS \
847 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
848 { "lib_ads", LIB_ADS_SPEC }, \
849 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
850 { "lib_mvme", LIB_MVME_SPEC }, \
851 { "lib_sim", LIB_SIM_SPEC }, \
852 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
853 { "lib_linux", LIB_LINUX_SPEC }, \
854 { "lib_netbsd", LIB_NETBSD_SPEC }, \
855 { "lib_openbsd", LIB_OPENBSD_SPEC }, \
856 { "lib_default", LIB_DEFAULT_SPEC }, \
857 { "startfile_ads", STARTFILE_ADS_SPEC }, \
858 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
859 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
860 { "startfile_sim", STARTFILE_SIM_SPEC }, \
861 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
862 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
863 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
864 { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
865 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
866 { "endfile_ads", ENDFILE_ADS_SPEC }, \
867 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
868 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
869 { "endfile_sim", ENDFILE_SIM_SPEC }, \
870 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
871 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
872 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
873 { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
874 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
875 { "link_shlib", LINK_SHLIB_SPEC }, \
876 { "link_target", LINK_TARGET_SPEC }, \
877 { "link_start", LINK_START_SPEC }, \
878 { "link_start_ads", LINK_START_ADS_SPEC }, \
879 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
880 { "link_start_mvme", LINK_START_MVME_SPEC }, \
881 { "link_start_sim", LINK_START_SIM_SPEC }, \
882 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
883 { "link_start_linux", LINK_START_LINUX_SPEC }, \
884 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
885 { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
886 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
887 { "link_os", LINK_OS_SPEC }, \
888 { "link_os_ads", LINK_OS_ADS_SPEC }, \
889 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
890 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
891 { "link_os_sim", LINK_OS_SIM_SPEC }, \
892 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
893 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
894 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
895 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
896 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
897 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
898 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
899 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
900 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
901 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
902 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
903 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
904 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
905 { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
906 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
907 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \
908 SUBSUBTARGET_EXTRA_SPECS
909
910 #define SUBSUBTARGET_EXTRA_SPECS
911
912 /* Define this macro as a C expression for the initializer of an
913 array of string to tell the driver program which options are
914 defaults for this target and thus do not need to be handled
915 specially when using `MULTILIB_OPTIONS'.
916
917 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
918 the target makefile fragment or if none of the options listed in
919 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
920
921 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
922
923 /* Define this macro if the code for function profiling should come
924 before the function prologue. Normally, the profiling code comes
925 after. */
926 #define PROFILE_BEFORE_PROLOGUE 1
927
928 /* Function name to call to do profiling. */
929 #define RS6000_MCOUNT "_mcount"
930
931 /* Select a format to encode pointers in exception handling data. CODE
932 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
933 true if the symbol may be affected by dynamic relocations. */
934 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
935 ((flag_pic || TARGET_RELOCATABLE) \
936 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
937 : DW_EH_PE_absptr)
938
939 #define DOUBLE_INT_ASM_OP "\t.quad\t"
940
941 /* Generate entries in .fixup for relocatable addresses. */
942 #define RELOCATABLE_NEEDS_FIXUP 1
943
944 #define TARGET_ASM_FILE_END rs6000_elf_file_end
945
946 #undef TARGET_ASAN_SHADOW_OFFSET
947 #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
948
949 /* This target uses the sysv4.opt file. */
950 #define TARGET_USES_SYSV4_OPT 1
951
952 #undef DBX_REGISTER_NUMBER