]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/sysv4.h
* config/rs6000/sysv4.h (LIB_LINUX_SPEC): Give -lpthread before -lc.
[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 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published
10 by the Free Software Foundation; either version 2, or (at your
11 option) any later version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the
20 Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA. */
22
23 /* Header files should be C++ aware in general. */
24 #define NO_IMPLICIT_EXTERN_C
25
26 /* Yes! We are ELF. */
27 #define TARGET_OBJECT_FORMAT OBJECT_ELF
28
29 /* Default ABI to compile code for. */
30 #define DEFAULT_ABI rs6000_current_abi
31
32 /* Default ABI to use. */
33 #define RS6000_ABI_NAME "sysv"
34
35 /* Override rs6000.h definition. */
36 #undef ASM_DEFAULT_SPEC
37 #define ASM_DEFAULT_SPEC "-mppc"
38
39 /* Small data support types. */
40 enum rs6000_sdata_type {
41 SDATA_NONE, /* No small data support. */
42 SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */
43 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */
44 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */
45 };
46
47 extern enum rs6000_sdata_type rs6000_sdata;
48
49 /* V.4/eabi switches. */
50 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0. */
51 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
52 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative. */
53 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec. */
54 #define MASK_LITTLE_ENDIAN 0x04000000 /* Target is little endian. */
55 #define MASK_REGNAMES 0x02000000 /* Use alternate register names. */
56 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args. */
57 #define MASK_NO_BITFIELD_WORD 0x00800000 /* Bitfields cannot cross word boundaries */
58
59 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
60 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
61 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
62 #define TARGET_EABI (target_flags & MASK_EABI)
63 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
64 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
65 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
66 #define TARGET_NO_BITFIELD_WORD (target_flags & MASK_NO_BITFIELD_WORD)
67 #define TARGET_TOC ((target_flags & MASK_64BIT) \
68 || ((target_flags & (MASK_RELOCATABLE \
69 | MASK_MINIMAL_TOC)) \
70 && flag_pic > 1) \
71 || DEFAULT_ABI == ABI_AIX)
72
73 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
74 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
75 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
76 #define TARGET_NO_TOC (! TARGET_TOC)
77 #define TARGET_NO_EABI (! TARGET_EABI)
78
79 /* Strings provided by SUBTARGET_OPTIONS */
80 extern const char *rs6000_abi_name;
81 extern const char *rs6000_sdata_name;
82 extern const char *rs6000_tls_size_string; /* For -mtls-size= */
83
84 /* Override rs6000.h definition. */
85 #undef SUBTARGET_OPTIONS
86 #define SUBTARGET_OPTIONS \
87 { "call-", &rs6000_abi_name, N_("Select ABI calling convention"), 0}, \
88 { "sdata=", &rs6000_sdata_name, N_("Select method for sdata handling"), 0}, \
89 { "tls-size=", &rs6000_tls_size_string, \
90 N_("Specify bit size of immediate TLS offsets"), 0 }
91
92 #define SDATA_DEFAULT_SIZE 8
93
94 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
95 the same as -mminimal-toc. */
96 /* Override rs6000.h definition. */
97 #undef SUBTARGET_SWITCHES
98 #define SUBTARGET_SWITCHES \
99 { "bit-align", -MASK_NO_BITFIELD_TYPE, \
100 N_("Align to the base type of the bit-field") }, \
101 { "no-bit-align", MASK_NO_BITFIELD_TYPE, \
102 N_("Don't align to the base type of the bit-field") }, \
103 { "strict-align", MASK_STRICT_ALIGN, \
104 N_("Don't assume that unaligned accesses are handled by the system") }, \
105 { "no-strict-align", -MASK_STRICT_ALIGN, \
106 N_("Assume that unaligned accesses are handled by the system") }, \
107 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
108 N_("Produce code relocatable at runtime") }, \
109 { "no-relocatable", -MASK_RELOCATABLE, \
110 N_("Don't produce code relocatable at runtime") }, \
111 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC, \
112 N_("Produce code relocatable at runtime") }, \
113 { "no-relocatable-lib", -MASK_RELOCATABLE, \
114 N_("Don't produce code relocatable at runtime") }, \
115 { "little-endian", MASK_LITTLE_ENDIAN, \
116 N_("Produce little endian code") }, \
117 { "little", MASK_LITTLE_ENDIAN, \
118 N_("Produce little endian code") }, \
119 { "big-endian", -MASK_LITTLE_ENDIAN, \
120 N_("Produce big endian code") }, \
121 { "big", -MASK_LITTLE_ENDIAN, \
122 N_("Produce big endian code") }, \
123 { "no-toc", 0, N_("no description yet") }, \
124 { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
125 { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \
126 { "prototype", MASK_PROTOTYPE, N_("no description yet") }, \
127 { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \
128 { "no-traceback", 0, N_("no description yet") }, \
129 { "eabi", MASK_EABI, N_("Use EABI") }, \
130 { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \
131 { "bit-word", -MASK_NO_BITFIELD_WORD, "" }, \
132 { "no-bit-word", MASK_NO_BITFIELD_WORD, \
133 N_("Do not allow bit-fields to cross word boundaries") }, \
134 { "regnames", MASK_REGNAMES, \
135 N_("Use alternate register names") }, \
136 { "no-regnames", -MASK_REGNAMES, \
137 N_("Don't use alternate register names") }, \
138 { "sdata", 0, N_("no description yet") }, \
139 { "no-sdata", 0, N_("no description yet") }, \
140 { "sim", 0, \
141 N_("Link with libsim.a, libc.a and sim-crt0.o") }, \
142 { "ads", 0, \
143 N_("Link with libads.a, libc.a and crt0.o") }, \
144 { "yellowknife", 0, \
145 N_("Link with libyk.a, libc.a and crt0.o") }, \
146 { "mvme", 0, \
147 N_("Link with libmvme.a, libc.a and crt0.o") }, \
148 { "emb", 0, \
149 N_("Set the PPC_EMB bit in the ELF flags header") }, \
150 { "windiss", 0, N_("Use the WindISS simulator") }, \
151 { "shlib", 0, N_("no description yet") }, \
152 { "64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC, \
153 N_("Generate 64-bit code") }, \
154 { "32", - (MASK_64BIT | MASK_POWERPC64), \
155 N_("Generate 32-bit code") }, \
156 EXTRA_SUBTARGET_SWITCHES \
157 { "newlib", 0, N_("no description yet") },
158
159 /* This is meant to be redefined in the host dependent files. */
160 #define EXTRA_SUBTARGET_SWITCHES
161
162 /* Sometimes certain combinations of command options do not make sense
163 on a particular target machine. You can define a macro
164 `OVERRIDE_OPTIONS' to take account of this. This macro, if
165 defined, is executed once just after all the command options have
166 been parsed.
167
168 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
169 get control. */
170
171 #define SUBTARGET_OVERRIDE_OPTIONS \
172 do { \
173 if (!g_switch_set) \
174 g_switch_value = SDATA_DEFAULT_SIZE; \
175 \
176 if (rs6000_abi_name == NULL) \
177 rs6000_abi_name = RS6000_ABI_NAME; \
178 \
179 if (!strcmp (rs6000_abi_name, "sysv")) \
180 rs6000_current_abi = ABI_V4; \
181 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
182 { \
183 rs6000_current_abi = ABI_V4; \
184 target_flags &= ~ MASK_EABI; \
185 } \
186 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
187 || !strcmp (rs6000_abi_name, "eabi")) \
188 { \
189 rs6000_current_abi = ABI_V4; \
190 target_flags |= MASK_EABI; \
191 } \
192 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
193 rs6000_current_abi = ABI_AIX; \
194 else if (!strcmp (rs6000_abi_name, "freebsd")) \
195 rs6000_current_abi = ABI_V4; \
196 else if (!strcmp (rs6000_abi_name, "linux")) \
197 rs6000_current_abi = ABI_V4; \
198 else if (!strcmp (rs6000_abi_name, "gnu")) \
199 rs6000_current_abi = ABI_V4; \
200 else if (!strcmp (rs6000_abi_name, "netbsd")) \
201 rs6000_current_abi = ABI_V4; \
202 else if (!strcmp (rs6000_abi_name, "i960-old")) \
203 { \
204 rs6000_current_abi = ABI_V4; \
205 target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \
206 | MASK_NO_BITFIELD_WORD); \
207 target_flags &= ~MASK_STRICT_ALIGN; \
208 } \
209 else \
210 { \
211 rs6000_current_abi = ABI_V4; \
212 error ("bad value for -mcall-%s", rs6000_abi_name); \
213 } \
214 \
215 if (rs6000_sdata_name) \
216 { \
217 if (!strcmp (rs6000_sdata_name, "none")) \
218 rs6000_sdata = SDATA_NONE; \
219 else if (!strcmp (rs6000_sdata_name, "data")) \
220 rs6000_sdata = SDATA_DATA; \
221 else if (!strcmp (rs6000_sdata_name, "default")) \
222 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
223 else if (!strcmp (rs6000_sdata_name, "sysv")) \
224 rs6000_sdata = SDATA_SYSV; \
225 else if (!strcmp (rs6000_sdata_name, "eabi")) \
226 rs6000_sdata = SDATA_EABI; \
227 else \
228 error ("bad value for -msdata=%s", rs6000_sdata_name); \
229 } \
230 else if (DEFAULT_ABI == ABI_V4) \
231 { \
232 rs6000_sdata = SDATA_DATA; \
233 rs6000_sdata_name = "data"; \
234 } \
235 else \
236 { \
237 rs6000_sdata = SDATA_NONE; \
238 rs6000_sdata_name = "none"; \
239 } \
240 \
241 if (TARGET_RELOCATABLE && \
242 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
243 { \
244 rs6000_sdata = SDATA_DATA; \
245 error ("-mrelocatable and -msdata=%s are incompatible", \
246 rs6000_sdata_name); \
247 } \
248 \
249 else if (flag_pic && DEFAULT_ABI != ABI_AIX \
250 && (rs6000_sdata == SDATA_EABI \
251 || rs6000_sdata == SDATA_SYSV)) \
252 { \
253 rs6000_sdata = SDATA_DATA; \
254 error ("-f%s and -msdata=%s are incompatible", \
255 (flag_pic > 1) ? "PIC" : "pic", \
256 rs6000_sdata_name); \
257 } \
258 \
259 if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
260 || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
261 { \
262 rs6000_sdata = SDATA_NONE; \
263 error ("-msdata=%s and -mcall-%s are incompatible", \
264 rs6000_sdata_name, rs6000_abi_name); \
265 } \
266 \
267 targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
268 \
269 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
270 { \
271 target_flags |= MASK_MINIMAL_TOC; \
272 error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
273 } \
274 \
275 if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
276 { \
277 target_flags &= ~MASK_RELOCATABLE; \
278 error ("-mrelocatable and -mcall-%s are incompatible", \
279 rs6000_abi_name); \
280 } \
281 \
282 if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
283 { \
284 flag_pic = 0; \
285 error ("-fPIC and -mcall-%s are incompatible", \
286 rs6000_abi_name); \
287 } \
288 \
289 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
290 { \
291 target_flags &= ~MASK_LITTLE_ENDIAN; \
292 error ("-mcall-aixdesc must be big endian"); \
293 } \
294 \
295 /* Treat -fPIC the same as -mrelocatable. */ \
296 if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
297 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
298 \
299 else if (TARGET_RELOCATABLE) \
300 flag_pic = 2; \
301 } while (0)
302
303 #ifndef RS6000_BI_ARCH
304 # define SUBSUBTARGET_OVERRIDE_OPTIONS \
305 do { \
306 if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
307 error ("-m%s not supported in this configuration", \
308 (target_flags & MASK_64BIT) ? "64" : "32"); \
309 } while (0)
310 #endif
311
312 /* Override rs6000.h definition. */
313 #undef TARGET_DEFAULT
314 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
315
316 /* Override rs6000.h definition. */
317 #undef PROCESSOR_DEFAULT
318 #define PROCESSOR_DEFAULT PROCESSOR_PPC750
319
320 #define FIXED_R2 1
321 /* System V.4 uses register 13 as a pointer to the small data area,
322 so it is not available to the normal user. */
323 #define FIXED_R13 1
324
325 /* Size of the V.4 varargs area if needed. */
326 /* Override rs6000.h definition. */
327 #undef RS6000_VARARGS_AREA
328 #define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
329
330 /* Override default big endianism definitions in rs6000.h. */
331 #undef BYTES_BIG_ENDIAN
332 #undef WORDS_BIG_ENDIAN
333 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
334 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
335
336 /* Define this to set the endianness to use in libgcc2.c, which can
337 not depend on target_flags. */
338 #if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
339 #define LIBGCC2_WORDS_BIG_ENDIAN 1
340 #else
341 #define LIBGCC2_WORDS_BIG_ENDIAN 0
342 #endif
343
344 /* Define cutoff for using external functions to save floating point.
345 Currently on V.4, always use inline stores. */
346 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
347
348 /* Put jump tables in read-only memory, rather than in .text. */
349 #define JUMP_TABLES_IN_TEXT_SECTION 0
350
351 /* Prefix and suffix to use to saving floating point. */
352 #define SAVE_FP_PREFIX "_savefpr_"
353 #define SAVE_FP_SUFFIX "_l"
354
355 /* Prefix and suffix to use to restoring floating point. */
356 #define RESTORE_FP_PREFIX "_restfpr_"
357 #define RESTORE_FP_SUFFIX "_l"
358
359 /* Type used for ptrdiff_t, as a string used in a declaration. */
360 #define PTRDIFF_TYPE "int"
361
362 /* Type used for wchar_t, as a string used in a declaration. */
363 /* Override svr4.h definition. */
364 #undef WCHAR_TYPE
365 #define WCHAR_TYPE "long int"
366
367 /* Width of wchar_t in bits. */
368 /* Override svr4.h definition. */
369 #undef WCHAR_TYPE_SIZE
370 #define WCHAR_TYPE_SIZE 32
371
372 /* Make int foo : 8 not cause structures to be aligned to an int boundary. */
373 /* Override elfos.h definition. */
374 #undef PCC_BITFIELD_TYPE_MATTERS
375 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
376
377 #undef BITFIELD_NBYTES_LIMITED
378 #define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD)
379
380 /* Define this macro to be the value 1 if instructions will fail to
381 work if given data not on the nominal alignment. If instructions
382 will merely go slower in that case, define this macro as 0. */
383 #undef STRICT_ALIGNMENT
384 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
385
386 /* Alignment in bits of the stack boundary. Note, in order to allow building
387 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
388 versions, just use 64 as the stack boundary. */
389 #undef STACK_BOUNDARY
390 #define STACK_BOUNDARY (TARGET_ALTIVEC_ABI ? 128 : 64)
391
392 /* Real stack boundary as mandated by the appropriate ABI. */
393 #define ABI_STACK_BOUNDARY ((TARGET_EABI && !TARGET_ALTIVEC_ABI) ? 64 : 128)
394
395 /* An expression for the alignment of a structure field FIELD if the
396 alignment computed in the usual way is COMPUTED. */
397 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
398 ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
399 ? 128 : COMPUTED)
400
401 /* Define this macro as an expression for the alignment of a type
402 (given by TYPE as a tree node) if the alignment computed in the
403 usual way is COMPUTED and the alignment explicitly specified was
404 SPECIFIED. */
405 #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
406 ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) \
407 ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \
408 : MAX (COMPUTED, SPECIFIED))
409
410 #undef BIGGEST_FIELD_ALIGNMENT
411
412 /* Use ELF style section commands. */
413
414 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
415
416 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
417
418 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
419
420 /* Override elfos.h definition. */
421 #undef INIT_SECTION_ASM_OP
422 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
423
424 /* Override elfos.h definition. */
425 #undef FINI_SECTION_ASM_OP
426 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
427
428 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
429
430 /* Put PC relative got entries in .got2. */
431 #define MINIMAL_TOC_SECTION_ASM_OP \
432 (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
433 ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
434
435 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
436 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
437 #define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
438
439 /* Besides the usual ELF sections, we need a toc section. */
440 /* Override elfos.h definition. */
441 #undef EXTRA_SECTIONS
442 #define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
443
444 /* Override elfos.h definition. */
445 #undef EXTRA_SECTION_FUNCTIONS
446 #define EXTRA_SECTION_FUNCTIONS \
447 TOC_SECTION_FUNCTION \
448 SDATA_SECTION_FUNCTION \
449 SDATA2_SECTION_FUNCTION \
450 SBSS_SECTION_FUNCTION \
451 INIT_SECTION_FUNCTION \
452 FINI_SECTION_FUNCTION
453
454 #define TOC_SECTION_FUNCTION \
455 void \
456 toc_section () \
457 { \
458 if (in_section != in_toc) \
459 { \
460 in_section = in_toc; \
461 if (DEFAULT_ABI == ABI_AIX \
462 && TARGET_MINIMAL_TOC \
463 && !TARGET_RELOCATABLE) \
464 { \
465 if (! toc_initialized) \
466 { \
467 toc_initialized = 1; \
468 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
469 (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \
470 fprintf (asm_out_file, "\t.tc "); \
471 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
472 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
473 fprintf (asm_out_file, "\n"); \
474 \
475 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
476 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
477 fprintf (asm_out_file, " = .+32768\n"); \
478 } \
479 else \
480 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
481 } \
482 else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE) \
483 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
484 else \
485 { \
486 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
487 if (! toc_initialized) \
488 { \
489 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
490 fprintf (asm_out_file, " = .+32768\n"); \
491 toc_initialized = 1; \
492 } \
493 } \
494 } \
495 } \
496 \
497 extern int in_toc_section (void); \
498 int in_toc_section () \
499 { \
500 return in_section == in_toc; \
501 }
502
503 #define SDATA_SECTION_FUNCTION \
504 void \
505 sdata_section () \
506 { \
507 if (in_section != in_sdata) \
508 { \
509 in_section = in_sdata; \
510 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
511 } \
512 }
513
514 #define SDATA2_SECTION_FUNCTION \
515 void \
516 sdata2_section () \
517 { \
518 if (in_section != in_sdata2) \
519 { \
520 in_section = in_sdata2; \
521 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
522 } \
523 }
524
525 #define SBSS_SECTION_FUNCTION \
526 void \
527 sbss_section () \
528 { \
529 if (in_section != in_sbss) \
530 { \
531 in_section = in_sbss; \
532 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
533 } \
534 }
535
536 #define INIT_SECTION_FUNCTION \
537 void \
538 init_section () \
539 { \
540 if (in_section != in_init) \
541 { \
542 in_section = in_init; \
543 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
544 } \
545 }
546
547 #define FINI_SECTION_FUNCTION \
548 void \
549 fini_section () \
550 { \
551 if (in_section != in_fini) \
552 { \
553 in_section = in_fini; \
554 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
555 } \
556 }
557
558 /* Override default elf definitions. */
559 #undef TARGET_ASM_SELECT_RTX_SECTION
560 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
561 #undef TARGET_ASM_SELECT_SECTION
562 #define TARGET_ASM_SELECT_SECTION rs6000_elf_select_section
563 #define TARGET_ASM_UNIQUE_SECTION rs6000_elf_unique_section
564
565 /* Return nonzero if this entry is to be written into the constant pool
566 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
567 containing one of them. If -mfp-in-toc (the default), we also do
568 this for floating-point constants. We actually can only do this
569 if the FP formats of the target and host machines are the same, but
570 we can't check that since not every file that uses
571 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
572
573 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
574 allow floating point constants in the TOC if -mrelocatable. */
575
576 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
577 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
578 (TARGET_TOC \
579 && (GET_CODE (X) == SYMBOL_REF \
580 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
581 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
582 || GET_CODE (X) == LABEL_REF \
583 || (GET_CODE (X) == CONST_INT \
584 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
585 || (!TARGET_NO_FP_IN_TOC \
586 && !TARGET_RELOCATABLE \
587 && GET_CODE (X) == CONST_DOUBLE \
588 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
589 && BITS_PER_WORD == HOST_BITS_PER_INT)))
590
591 /* These macros generate the special .type and .size directives which
592 are used to set the corresponding fields of the linker symbol table
593 entries in an ELF object file under SVR4. These macros also output
594 the starting labels for the relevant functions/objects. */
595
596 /* Write the extra assembler code needed to declare a function properly.
597 Some svr4 assemblers need to also have something extra said about the
598 function's return value. We allow for that here. */
599
600 extern int rs6000_pic_labelno;
601
602 /* Override elfos.h definition. */
603 #undef ASM_DECLARE_FUNCTION_NAME
604 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
605 rs6000_elf_declare_function_name ((FILE), (NAME), (DECL))
606
607 /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore
608 flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
609
610 #define LOCAL_LABEL_PREFIX "."
611 #define USER_LABEL_PREFIX ""
612
613 /* svr4.h overrides (*targetm.asm_out.internal_label). */
614
615 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
616 asm_fprintf (FILE, "%L%s", PREFIX)
617
618 /* Globalizing directive for a label. */
619 #define GLOBAL_ASM_OP "\t.globl "
620
621 /* This says how to output assembler code to declare an
622 uninitialized internal linkage data object. Under SVR4,
623 the linker seems to want the alignment of data objects
624 to depend on their types. We do exactly that here. */
625
626 #define LOCAL_ASM_OP "\t.local\t"
627
628 #define LCOMM_ASM_OP "\t.lcomm\t"
629
630 /* Override elfos.h definition. */
631 #undef ASM_OUTPUT_ALIGNED_LOCAL
632 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
633 do { \
634 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
635 && (SIZE) <= g_switch_value) \
636 { \
637 sbss_section (); \
638 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
639 ASM_OUTPUT_LABEL (FILE, NAME); \
640 ASM_OUTPUT_SKIP (FILE, SIZE); \
641 if (!flag_inhibit_size_directive && (SIZE) > 0) \
642 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
643 } \
644 else \
645 { \
646 fprintf (FILE, "%s", LCOMM_ASM_OP); \
647 assemble_name ((FILE), (NAME)); \
648 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
649 (SIZE), (ALIGN) / BITS_PER_UNIT); \
650 } \
651 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
652 } while (0)
653
654 /* Describe how to emit uninitialized external linkage items. */
655 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
656 do { \
657 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
658 } while (0)
659
660 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
661 /* To support -falign-* switches we need to use .p2align so
662 that alignment directives in code sections will be padded
663 with no-op instructions, rather than zeroes. */
664 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
665 if ((LOG) != 0) \
666 { \
667 if ((MAX_SKIP) == 0) \
668 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
669 else \
670 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
671 }
672 #endif
673
674 /* This is how to output code to push a register on the stack.
675 It need not be very fast code.
676
677 On the rs6000, we must keep the backchain up to date. In order
678 to simplify things, always allocate 16 bytes for a push (System V
679 wants to keep stack aligned to a 16 byte boundary). */
680
681 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
682 do { \
683 if (DEFAULT_ABI == ABI_V4) \
684 asm_fprintf (FILE, \
685 "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
686 reg_names[1], reg_names[1], reg_names[REGNO], \
687 reg_names[1]); \
688 } while (0)
689
690 /* This is how to output an insn to pop a register from the stack.
691 It need not be very fast code. */
692
693 #define ASM_OUTPUT_REG_POP(FILE, REGNO) \
694 do { \
695 if (DEFAULT_ABI == ABI_V4) \
696 asm_fprintf (FILE, \
697 "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
698 reg_names[REGNO], reg_names[1], reg_names[1], \
699 reg_names[1]); \
700 } while (0)
701
702 /* Switch Recognition by gcc.c. Add -G xx support. */
703
704 /* Override svr4.h definition. */
705 #undef SWITCH_TAKES_ARG
706 #define SWITCH_TAKES_ARG(CHAR) \
707 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
708 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
709 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
710 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
711 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
712
713 extern int fixuplabelno;
714
715 /* Handle constructors specially for -mrelocatable. */
716 #define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor
717 #define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor
718
719 /* This is the end of what might become sysv4.h. */
720
721 /* Use DWARF 2 debugging information by default. */
722 #undef PREFERRED_DEBUGGING_TYPE
723 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
724
725 /* Historically we have also supported stabs debugging. */
726 #define DBX_DEBUGGING_INFO 1
727
728 #define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info
729 #define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p
730 #define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags
731
732 /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */
733
734 #define RS6000_OUTPUT_BASENAME(FILE, NAME) \
735 assemble_name (FILE, NAME)
736
737 /* We have to output the stabs for the function name *first*, before
738 outputting its label. */
739
740 #define DBX_FUNCTION_FIRST
741
742 /* This is the end of what might become sysv4dbx.h. */
743
744 #ifndef TARGET_VERSION
745 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
746 #endif
747 \f
748 #define TARGET_OS_SYSV_CPP_BUILTINS() \
749 do \
750 { \
751 if (flag_pic == 1) \
752 { \
753 builtin_define ("__pic__=1"); \
754 builtin_define ("__PIC__=1"); \
755 } \
756 else if (flag_pic == 2) \
757 { \
758 builtin_define ("__pic__=2"); \
759 builtin_define ("__PIC__=2"); \
760 } \
761 if (target_flags_explicit \
762 & MASK_RELOCATABLE) \
763 builtin_define ("_RELOCATABLE"); \
764 } \
765 while (0)
766
767 #ifndef TARGET_OS_CPP_BUILTINS
768 #define TARGET_OS_CPP_BUILTINS() \
769 do \
770 { \
771 builtin_define_std ("PPC"); \
772 builtin_define_std ("unix"); \
773 builtin_define ("__svr4__"); \
774 builtin_assert ("system=unix"); \
775 builtin_assert ("system=svr4"); \
776 builtin_assert ("cpu=powerpc"); \
777 builtin_assert ("machine=powerpc"); \
778 TARGET_OS_SYSV_CPP_BUILTINS (); \
779 } \
780 while (0)
781 #endif
782
783 /* Pass various options to the assembler. */
784 /* Override svr4.h definition. */
785 #undef ASM_SPEC
786 #define ASM_SPEC "%(asm_cpu) \
787 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
788 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
789 %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
790 %{memb|msdata|msdata=eabi: -memb} \
791 %{mlittle|mlittle-endian:-mlittle; \
792 mbig|mbig-endian :-mbig; \
793 mcall-aixdesc | \
794 mcall-freebsd | \
795 mcall-netbsd | \
796 mcall-linux | \
797 mcall-gnu :-mbig; \
798 mcall-i960-old :-mlittle}"
799
800 #define CC1_ENDIAN_BIG_SPEC ""
801
802 #define CC1_ENDIAN_LITTLE_SPEC "\
803 %{!mstrict-align: %{!mno-strict-align: \
804 %{!mcall-i960-old: \
805 -mstrict-align \
806 } \
807 }}"
808
809 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
810
811 /* Pass -G xxx to the compiler and set correct endian mode. */
812 #define CC1_SPEC "%{G*} \
813 %{mlittle|mlittle-endian: %(cc1_endian_little); \
814 mbig |mbig-endian : %(cc1_endian_big); \
815 mcall-aixdesc | \
816 mcall-freebsd | \
817 mcall-netbsd | \
818 mcall-linux | \
819 mcall-gnu : -mbig %(cc1_endian_big); \
820 mcall-i960-old : -mlittle %(cc1_endian_little); \
821 : %(cc1_endian_default)} \
822 %{mno-sdata: -msdata=none } \
823 %{meabi: %{!mcall-*: -mcall-sysv }} \
824 %{!meabi: %{!mno-eabi: \
825 %{mrelocatable: -meabi } \
826 %{mcall-freebsd: -mno-eabi } \
827 %{mcall-i960-old: -meabi } \
828 %{mcall-linux: -mno-eabi } \
829 %{mcall-gnu: -mno-eabi } \
830 %{mcall-netbsd: -mno-eabi }}} \
831 %{msdata: -msdata=default} \
832 %{mno-sdata: -msdata=none} \
833 %{profile: -p}"
834
835 /* Don't put -Y P,<path> for cross compilers. */
836 #ifndef CROSS_COMPILE
837 #define LINK_PATH_SPEC "\
838 %{!R*:%{L*:-R %*}} \
839 %{!nostdlib: %{!YP,*: \
840 %{compat-bsd: \
841 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
842 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
843 %{!R*: %{!L*: -R /usr/ucblib}} \
844 %{!compat-bsd: \
845 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
846 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
847
848 #else
849 #define LINK_PATH_SPEC ""
850 #endif
851
852 /* Default starting address if specified. */
853 #define LINK_START_SPEC "\
854 %{mads : %(link_start_ads) ; \
855 myellowknife : %(link_start_yellowknife) ; \
856 mmvme : %(link_start_mvme) ; \
857 msim : %(link_start_sim) ; \
858 mwindiss : %(link_start_windiss) ; \
859 mcall-freebsd: %(link_start_freebsd) ; \
860 mcall-linux : %(link_start_linux) ; \
861 mcall-gnu : %(link_start_gnu) ; \
862 mcall-netbsd : %(link_start_netbsd) ; \
863 : %(link_start_default) }"
864
865 #define LINK_START_DEFAULT_SPEC ""
866
867 /* Override svr4.h definition. */
868 #undef LINK_SPEC
869 #define LINK_SPEC "\
870 %{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
871 %{YP,*} %{R*} \
872 %{Qy:} %{!Qn:-Qy} \
873 %(link_shlib) \
874 %{!Wl,-T*: %{!T*: %(link_start) }} \
875 %(link_target) \
876 %(link_os)"
877
878 /* For now, turn off shared libraries by default. */
879 #ifndef SHARED_LIB_SUPPORT
880 #define NO_SHARED_LIB_SUPPORT
881 #endif
882
883 #ifndef NO_SHARED_LIB_SUPPORT
884 /* Shared libraries are default. */
885 #define LINK_SHLIB_SPEC "\
886 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
887 %{mshlib: } \
888 %{static:-dn -Bstatic} \
889 %{shared:-G -dy -z text} \
890 %{symbolic:-Bsymbolic -G -dy -z text}"
891
892 #else
893 /* Shared libraries are not default. */
894 #define LINK_SHLIB_SPEC "\
895 %{mshlib: %(link_path) } \
896 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
897 %{static: } \
898 %{shared:-G -dy -z text %(link_path) } \
899 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
900 #endif
901
902 /* Override the default target of the linker. */
903 #define LINK_TARGET_SPEC "\
904 %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
905 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
906 %{mcall-i960-old: --oformat elf32-powerpcle} \
907 }}}}"
908
909 /* Any specific OS flags. */
910 #define LINK_OS_SPEC "\
911 %{mads : %(link_os_ads) ; \
912 myellowknife : %(link_os_yellowknife) ; \
913 mmvme : %(link_os_mvme) ; \
914 msim : %(link_os_sim) ; \
915 mwindiss : %(link_os_windiss) ; \
916 mcall-freebsd: %(link_os_freebsd) ; \
917 mcall-linux : %(link_os_linux) ; \
918 mcall-gnu : %(link_os_gnu) ; \
919 mcall-netbsd : %(link_os_netbsd) ; \
920 : %(link_os_default) }"
921
922 #define LINK_OS_DEFAULT_SPEC ""
923
924 /* Override rs6000.h definition. */
925 #undef CPP_SPEC
926 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
927 %{mads : %(cpp_os_ads) ; \
928 myellowknife : %(cpp_os_yellowknife) ; \
929 mmvme : %(cpp_os_mvme) ; \
930 msim : %(cpp_os_sim) ; \
931 mwindiss : %(cpp_os_windiss) ; \
932 mcall-freebsd: %(cpp_os_freebsd) ; \
933 mcall-linux : %(cpp_os_linux) ; \
934 mcall-gnu : %(cpp_os_gnu) ; \
935 mcall-netbsd : %(cpp_os_netbsd) ; \
936 : %(cpp_os_default) }"
937
938 #define CPP_OS_DEFAULT_SPEC ""
939
940 /* Override svr4.h definition. */
941 #undef STARTFILE_SPEC
942 #define STARTFILE_SPEC "\
943 %{mads : %(startfile_ads) ; \
944 myellowknife : %(startfile_yellowknife) ; \
945 mmvme : %(startfile_mvme) ; \
946 msim : %(startfile_sim) ; \
947 mwindiss : %(startfile_windiss) ; \
948 mcall-freebsd: %(startfile_freebsd) ; \
949 mcall-linux : %(startfile_linux) ; \
950 mcall-gnu : %(startfile_gnu) ; \
951 mcall-netbsd : %(startfile_netbsd) ; \
952 : %(startfile_default) }"
953
954 #define STARTFILE_DEFAULT_SPEC ""
955
956 /* Override svr4.h definition. */
957 #undef LIB_SPEC
958 #define LIB_SPEC "\
959 %{mads : %(lib_ads) ; \
960 myellowknife : %(lib_yellowknife) ; \
961 mmvme : %(lib_mvme) ; \
962 msim : %(lib_sim) ; \
963 mwindiss : %(lib_windiss) ; \
964 mcall-freebsd: %(lib_freebsd) ; \
965 mcall-linux : %(lib_linux) ; \
966 mcall-gnu : %(lib_gnu) ; \
967 mcall-netbsd : %(lib_netbsd) ; \
968 : %(lib_default) }"
969
970 #define LIB_DEFAULT_SPEC ""
971
972 /* Override svr4.h definition. */
973 #undef ENDFILE_SPEC
974 #define ENDFILE_SPEC "\
975 %{mads : crtsavres.o%s %(endfile_ads) ; \
976 myellowknife : crtsavres.o%s %(endfile_yellowknife) ; \
977 mmvme : crtsavres.o%s %(endfile_mvme) ; \
978 msim : crtsavres.o%s %(endfile_sim) ; \
979 mwindiss : %(endfile_windiss) ; \
980 mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \
981 mcall-linux : crtsavres.o%s %(endfile_linux) ; \
982 mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \
983 mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \
984 : %(crtsavres_default) %(endfile_default) }"
985
986 #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
987
988 #define ENDFILE_DEFAULT_SPEC ""
989
990 /* Motorola ADS support. */
991 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
992
993 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
994
995 #define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s"
996
997 #define LINK_START_ADS_SPEC "-T ads.ld%s"
998
999 #define LINK_OS_ADS_SPEC ""
1000
1001 #define CPP_OS_ADS_SPEC ""
1002
1003 /* Motorola Yellowknife support. */
1004 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1005
1006 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1007
1008 #define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s"
1009
1010 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1011
1012 #define LINK_OS_YELLOWKNIFE_SPEC ""
1013
1014 #define CPP_OS_YELLOWKNIFE_SPEC ""
1015
1016 /* Motorola MVME support. */
1017 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1018
1019 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s"
1020
1021 #define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s"
1022
1023 #define LINK_START_MVME_SPEC "-Ttext 0x40000"
1024
1025 #define LINK_OS_MVME_SPEC ""
1026
1027 #define CPP_OS_MVME_SPEC ""
1028
1029 /* PowerPC simulator based on netbsd system calls support. */
1030 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1031
1032 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s"
1033
1034 #define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s"
1035
1036 #define LINK_START_SIM_SPEC ""
1037
1038 #define LINK_OS_SIM_SPEC "-m elf32ppcsim"
1039
1040 #define CPP_OS_SIM_SPEC ""
1041
1042 /* FreeBSD support. */
1043
1044 #define CPP_OS_FREEBSD_SPEC "\
1045 -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
1046 -Acpu=powerpc -Amachine=powerpc"
1047
1048 #define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC
1049 #define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC
1050 #define LIB_FREEBSD_SPEC FBSD_LIB_SPEC
1051 #define LINK_START_FREEBSD_SPEC ""
1052
1053 #define LINK_OS_FREEBSD_SPEC "\
1054 %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
1055 %{Wl,*:%*} \
1056 %{v:-V} \
1057 %{assert*} %{R*} %{rpath*} %{defsym*} \
1058 %{shared:-Bshareable %{h*} %{soname*}} \
1059 %{!shared: \
1060 %{!static: \
1061 %{rdynamic: -export-dynamic} \
1062 %{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
1063 %{static:-Bstatic}} \
1064 %{symbolic:-Bsymbolic}"
1065
1066 /* GNU/Linux support. */
1067 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
1068 %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
1069 %{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
1070
1071 #ifdef HAVE_LD_PIE
1072 #define STARTFILE_LINUX_SPEC "\
1073 %{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
1074 %{mnewlib:ecrti.o%s;:crti.o%s} \
1075 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1076 #else
1077 #define STARTFILE_LINUX_SPEC "\
1078 %{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}} \
1079 %{mnewlib:ecrti.o%s;:crti.o%s} \
1080 %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
1081 #endif
1082
1083 #define ENDFILE_LINUX_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1084 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1085
1086 #define LINK_START_LINUX_SPEC ""
1087
1088 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1089 %{rdynamic:-export-dynamic} \
1090 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1091
1092 #if defined(HAVE_LD_EH_FRAME_HDR)
1093 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1094 #endif
1095
1096 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
1097 %{!undef: \
1098 %{!ansi: \
1099 %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
1100 %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
1101 -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1102
1103 /* GNU/Hurd support. */
1104 #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
1105 %{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
1106 %{profile:-lc_p} %{!profile:-lc}}}"
1107
1108 #define STARTFILE_GNU_SPEC "\
1109 %{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
1110 %{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
1111 %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
1112 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1113
1114 #define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1115 %{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
1116
1117 #define LINK_START_GNU_SPEC ""
1118
1119 #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
1120 %{rdynamic:-export-dynamic} \
1121 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
1122
1123 #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
1124 %{!undef: \
1125 %{!ansi: -Dunix -D__unix}} \
1126 -Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
1127
1128 /* NetBSD support. */
1129 #define LIB_NETBSD_SPEC "\
1130 %{profile:-lgmon -lc_p} %{!profile:-lc}"
1131
1132 #define STARTFILE_NETBSD_SPEC "\
1133 ncrti.o%s crt0.o%s \
1134 %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1135
1136 #define ENDFILE_NETBSD_SPEC "\
1137 %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
1138 ncrtn.o%s"
1139
1140 #define LINK_START_NETBSD_SPEC "\
1141 "
1142
1143 #define LINK_OS_NETBSD_SPEC "\
1144 %{!shared: %{!static: \
1145 %{rdynamic:-export-dynamic} \
1146 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
1147
1148 #define CPP_OS_NETBSD_SPEC "\
1149 -D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__"
1150
1151 /* WindISS support. */
1152
1153 #define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
1154
1155 #define CPP_OS_WINDISS_SPEC "\
1156 -D__rtasim \
1157 -D__EABI__ \
1158 -D__ppc \
1159 %{!msoft-float: -D__hardfp} \
1160 "
1161
1162 #define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
1163
1164 #define ENDFILE_WINDISS_SPEC "crtend.o%s"
1165
1166 #define LINK_START_WINDISS_SPEC ""
1167
1168 #define LINK_OS_WINDISS_SPEC ""
1169
1170 /* Define any extra SPECS that the compiler needs to generate. */
1171 /* Override rs6000.h definition. */
1172 #undef SUBTARGET_EXTRA_SPECS
1173 #define SUBTARGET_EXTRA_SPECS \
1174 { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \
1175 { "lib_ads", LIB_ADS_SPEC }, \
1176 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1177 { "lib_mvme", LIB_MVME_SPEC }, \
1178 { "lib_sim", LIB_SIM_SPEC }, \
1179 { "lib_freebsd", LIB_FREEBSD_SPEC }, \
1180 { "lib_gnu", LIB_GNU_SPEC }, \
1181 { "lib_linux", LIB_LINUX_SPEC }, \
1182 { "lib_netbsd", LIB_NETBSD_SPEC }, \
1183 { "lib_windiss", LIB_WINDISS_SPEC }, \
1184 { "lib_default", LIB_DEFAULT_SPEC }, \
1185 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1186 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1187 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1188 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1189 { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
1190 { "startfile_gnu", STARTFILE_GNU_SPEC }, \
1191 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1192 { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
1193 { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \
1194 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1195 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1196 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1197 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1198 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1199 { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
1200 { "endfile_gnu", ENDFILE_GNU_SPEC }, \
1201 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1202 { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
1203 { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \
1204 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1205 { "link_path", LINK_PATH_SPEC }, \
1206 { "link_shlib", LINK_SHLIB_SPEC }, \
1207 { "link_target", LINK_TARGET_SPEC }, \
1208 { "link_start", LINK_START_SPEC }, \
1209 { "link_start_ads", LINK_START_ADS_SPEC }, \
1210 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1211 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1212 { "link_start_sim", LINK_START_SIM_SPEC }, \
1213 { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
1214 { "link_start_gnu", LINK_START_GNU_SPEC }, \
1215 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1216 { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
1217 { "link_start_windiss", LINK_START_WINDISS_SPEC }, \
1218 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1219 { "link_os", LINK_OS_SPEC }, \
1220 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1221 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1222 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1223 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1224 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
1225 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1226 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
1227 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
1228 { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
1229 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1230 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1231 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1232 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1233 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1234 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1235 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1236 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1237 { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
1238 { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
1239 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1240 { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
1241 { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \
1242 { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \
1243 SUBSUBTARGET_EXTRA_SPECS
1244
1245 #define SUBSUBTARGET_EXTRA_SPECS
1246
1247 /* Define this macro as a C expression for the initializer of an
1248 array of string to tell the driver program which options are
1249 defaults for this target and thus do not need to be handled
1250 specially when using `MULTILIB_OPTIONS'.
1251
1252 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1253 the target makefile fragment or if none of the options listed in
1254 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1255
1256 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1257
1258 /* Define this macro if the code for function profiling should come
1259 before the function prologue. Normally, the profiling code comes
1260 after. */
1261 #define PROFILE_BEFORE_PROLOGUE 1
1262
1263 /* Function name to call to do profiling. */
1264 #define RS6000_MCOUNT "_mcount"
1265
1266 /* Define this macro (to a value of 1) if you want to support the
1267 Win32 style pragmas #pragma pack(push,<n>)' and #pragma
1268 pack(pop)'. The pack(push,<n>) pragma specifies the maximum
1269 alignment (in bytes) of fields within a structure, in much the
1270 same way as the __aligned__' and __packed__' __attribute__'s
1271 do. A pack value of zero resets the behavior to the default.
1272 Successive invocations of this pragma cause the previous values to
1273 be stacked, so that invocations of #pragma pack(pop)' will return
1274 to the previous value. */
1275
1276 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
1277
1278 /* Define library calls for quad FP operations. These are all part of the
1279 PowerPC 32bit ABI. */
1280 #define ADDTF3_LIBCALL "_q_add"
1281 #define DIVTF3_LIBCALL "_q_div"
1282 #define EXTENDDFTF2_LIBCALL "_q_dtoq"
1283 #define EQTF2_LIBCALL "_q_feq"
1284 #define GETF2_LIBCALL "_q_fge"
1285 #define GTTF2_LIBCALL "_q_fgt"
1286 #define LETF2_LIBCALL "_q_fle"
1287 #define LTTF2_LIBCALL "_q_flt"
1288 #define NETF2_LIBCALL "_q_fne"
1289 #define FLOATSITF2_LIBCALL "_q_itoq"
1290 #define MULTF3_LIBCALL "_q_mul"
1291 #define NEGTF2_LIBCALL "_q_neg"
1292 #define TRUNCTFDF2_LIBCALL "_q_qtod"
1293 #define FIX_TRUNCTFSI2_LIBCALL "_q_qtoi"
1294 #define TRUNCTFSF2_LIBCALL "_q_qtos"
1295 #define FIXUNS_TRUNCTFSI2_LIBCALL "_q_qtou"
1296 #define SQRTTF_LIBCALL "_q_sqrt"
1297 #define EXTENDSFTF2_LIBCALL "_q_stoq"
1298 #define SUBTF3_LIBCALL "_q_sub"
1299 #define FLOATUNSSITF2_LIBCALL "_q_utoq"
1300
1301 #define INIT_TARGET_OPTABS \
1302 do { \
1303 if (TARGET_HARD_FLOAT) \
1304 { \
1305 add_optab->handlers[(int) TFmode].libfunc \
1306 = init_one_libfunc (ADDTF3_LIBCALL); \
1307 sub_optab->handlers[(int) TFmode].libfunc \
1308 = init_one_libfunc (SUBTF3_LIBCALL); \
1309 neg_optab->handlers[(int) TFmode].libfunc \
1310 = init_one_libfunc (NEGTF2_LIBCALL); \
1311 smul_optab->handlers[(int) TFmode].libfunc \
1312 = init_one_libfunc (MULTF3_LIBCALL); \
1313 sdiv_optab->handlers[(int) TFmode].libfunc \
1314 = init_one_libfunc (DIVTF3_LIBCALL); \
1315 eqtf2_libfunc = init_one_libfunc (EQTF2_LIBCALL); \
1316 netf2_libfunc = init_one_libfunc (NETF2_LIBCALL); \
1317 gttf2_libfunc = init_one_libfunc (GTTF2_LIBCALL); \
1318 getf2_libfunc = init_one_libfunc (GETF2_LIBCALL); \
1319 lttf2_libfunc = init_one_libfunc (LTTF2_LIBCALL); \
1320 letf2_libfunc = init_one_libfunc (LETF2_LIBCALL); \
1321 trunctfsf2_libfunc = init_one_libfunc (TRUNCTFSF2_LIBCALL); \
1322 trunctfdf2_libfunc = init_one_libfunc (TRUNCTFDF2_LIBCALL); \
1323 extendsftf2_libfunc = init_one_libfunc (EXTENDSFTF2_LIBCALL); \
1324 extenddftf2_libfunc = init_one_libfunc (EXTENDDFTF2_LIBCALL); \
1325 floatsitf_libfunc = init_one_libfunc (FLOATSITF2_LIBCALL); \
1326 fixtfsi_libfunc = init_one_libfunc (FIX_TRUNCTFSI2_LIBCALL); \
1327 fixunstfsi_libfunc \
1328 = init_one_libfunc (FIXUNS_TRUNCTFSI2_LIBCALL); \
1329 if (TARGET_PPC_GPOPT || TARGET_POWER2) \
1330 sqrt_optab->handlers[(int) TFmode].libfunc \
1331 = init_one_libfunc (SQRTTF_LIBCALL); \
1332 } \
1333 } while (0)
1334
1335 /* Select a format to encode pointers in exception handling data. CODE
1336 is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
1337 true if the symbol may be affected by dynamic relocations. */
1338 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
1339 ((flag_pic || TARGET_RELOCATABLE) \
1340 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
1341 : DW_EH_PE_absptr)
1342
1343 #define TARGET_ASM_EXCEPTION_SECTION readonly_data_section
1344
1345 #define DOUBLE_INT_ASM_OP "\t.quad\t"
1346
1347 /* Generate entries in .fixup for relocatable addresses. */
1348 #define RELOCATABLE_NEEDS_FIXUP
This page took 0.105597 seconds and 5 git commands to generate.