a6dc42ba7ca0e5245af1ddb32b1c2dbbc7f0d62c
[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 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Small data support types */
23 enum rs6000_sdata_type {
24 SDATA_NONE, /* no small data support */
25 SDATA_DATA, /* just put data in .sbss/.sdata, don't use relocs */
26 SDATA_SYSV, /* Use r13 to point to .sdata/.sbss */
27 SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2 */
28 };
29
30 extern enum rs6000_sdata_type rs6000_sdata;
31
32 /* V.4/eabi switches */
33 #define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
34 #define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
35 #define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative */
36 #define MASK_EABI 0x08000000 /* Adhere to eabi, not System V spec */
37 #define MASK_LITTLE_ENDIAN 0x04000000 /* target is little endian */
38 #define MASK_REGNAMES 0x02000000 /* use alternate register names. */
39 #define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args */
40
41 #define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
42 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
43 #define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
44 #define TARGET_EABI (target_flags & MASK_EABI)
45 #define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
46 #define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
47 #define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
48 #define TARGET_TOC ((target_flags & MASK_64BIT) \
49 || ((target_flags & (MASK_RELOCATABLE \
50 | MASK_MINIMAL_TOC)) \
51 && flag_pic > 1) \
52 || DEFAULT_ABI == ABI_AIX \
53 || DEFAULT_ABI == ABI_NT)
54
55 #define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
56 #define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
57 #define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
58 #define TARGET_NO_TOC (! TARGET_TOC)
59 #define TARGET_NO_EABI (! TARGET_EABI)
60
61 /* Pseudo target to indicate whether the object format is ELF
62 (to get around not having conditional compilation in the md file) */
63 #define TARGET_ELF 1
64
65 /* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
66 the same as -mminimal-toc. */
67 #undef SUBTARGET_SWITCHES
68 #define SUBTARGET_SWITCHES \
69 { "bit-align", -MASK_NO_BITFIELD_TYPE }, \
70 { "no-bit-align", MASK_NO_BITFIELD_TYPE }, \
71 { "strict-align", MASK_STRICT_ALIGN }, \
72 { "no-strict-align", -MASK_STRICT_ALIGN }, \
73 { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
74 { "no-relocatable", -MASK_RELOCATABLE }, \
75 { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
76 { "no-relocatable-lib", -MASK_RELOCATABLE }, \
77 { "little-endian", MASK_LITTLE_ENDIAN }, \
78 { "little", MASK_LITTLE_ENDIAN }, \
79 { "big-endian", -MASK_LITTLE_ENDIAN }, \
80 { "big", -MASK_LITTLE_ENDIAN }, \
81 { "no-toc", 0 }, \
82 { "toc", MASK_MINIMAL_TOC }, \
83 { "full-toc", MASK_MINIMAL_TOC }, \
84 { "prototype", MASK_PROTOTYPE }, \
85 { "no-prototype", -MASK_PROTOTYPE }, \
86 { "no-traceback", 0 }, \
87 { "eabi", MASK_EABI }, \
88 { "no-eabi", -MASK_EABI }, \
89 { "regnames", MASK_REGNAMES }, \
90 { "no-regnames", -MASK_REGNAMES }, \
91 { "sdata", 0 }, \
92 { "no-sdata", 0 }, \
93 { "sim", 0 }, \
94 { "ads", 0 }, \
95 { "yellowknife", 0 }, \
96 { "mvme", 0 }, \
97 { "emb", 0 }, \
98 { "solaris-cclib", 0 }, \
99 { "shlib", 0 }, \
100 EXTRA_SUBTARGET_SWITCHES \
101 { "newlib", 0 },
102
103 /* This is meant to be redefined in the host dependent files */
104 #define EXTRA_SUBTARGET_SWITCHES
105
106 /* Default ABI to use */
107 #define RS6000_ABI_NAME "sysv"
108
109 /* Strings provided by SUBTARGET_OPTIONS */
110 extern char *rs6000_abi_name;
111 extern char *rs6000_sdata_name;
112
113 #define SUBTARGET_OPTIONS \
114 { "call-", &rs6000_abi_name}, \
115 { "sdata=", &rs6000_sdata_name}
116
117 /* Max # of bytes for variables to automatically be put into the .sdata
118 or .sdata2 sections. */
119 extern int g_switch_value; /* value of the -G xx switch */
120 extern int g_switch_set; /* whether -G xx was passed. */
121
122 #ifndef SDATA_DEFAULT_SIZE
123 #define SDATA_DEFAULT_SIZE 8
124 #endif
125
126 /* Sometimes certain combinations of command options do not make sense
127 on a particular target machine. You can define a macro
128 `OVERRIDE_OPTIONS' to take account of this. This macro, if
129 defined, is executed once just after all the command options have
130 been parsed.
131
132 The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
133 get control. */
134
135 #define SUBTARGET_OVERRIDE_OPTIONS \
136 do { \
137 if (!g_switch_set) \
138 g_switch_value = SDATA_DEFAULT_SIZE; \
139 \
140 if (!strcmp (rs6000_abi_name, "sysv")) \
141 rs6000_current_abi = ABI_V4; \
142 else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
143 { \
144 rs6000_current_abi = ABI_V4; \
145 target_flags &= ~ MASK_EABI; \
146 } \
147 else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
148 || !strcmp (rs6000_abi_name, "eabi")) \
149 { \
150 rs6000_current_abi = ABI_V4; \
151 target_flags |= MASK_EABI; \
152 } \
153 else if (!strcmp (rs6000_abi_name, "aix")) \
154 { \
155 rs6000_current_abi = ABI_AIX_NODESC; \
156 target_flags |= MASK_EABI; \
157 } \
158 else if (!strcmp (rs6000_abi_name, "aixdesc")) \
159 rs6000_current_abi = ABI_AIX; \
160 else if (!strcmp (rs6000_abi_name, "nt")) \
161 rs6000_current_abi = ABI_NT; \
162 else if (!strcmp (rs6000_abi_name, "linux")) \
163 rs6000_current_abi = ABI_V4; \
164 else if (!strcmp (rs6000_abi_name, "solaris")) \
165 rs6000_current_abi = ABI_SOLARIS; \
166 else \
167 { \
168 rs6000_current_abi = ABI_V4; \
169 error ("Bad value for -mcall-%s", rs6000_abi_name); \
170 } \
171 \
172 if (rs6000_sdata_name) \
173 { \
174 if (!strcmp (rs6000_sdata_name, "none")) \
175 rs6000_sdata = SDATA_NONE; \
176 else if (!strcmp (rs6000_sdata_name, "data")) \
177 rs6000_sdata = SDATA_DATA; \
178 else if (!strcmp (rs6000_sdata_name, "default")) \
179 rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
180 else if (!strcmp (rs6000_sdata_name, "sysv")) \
181 rs6000_sdata = SDATA_SYSV; \
182 else if (!strcmp (rs6000_sdata_name, "eabi")) \
183 rs6000_sdata = SDATA_EABI; \
184 else \
185 error ("Bad value for -msdata=%s", rs6000_sdata_name); \
186 } \
187 else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
188 { \
189 rs6000_sdata = SDATA_DATA; \
190 rs6000_sdata_name = "data"; \
191 } \
192 else \
193 { \
194 rs6000_sdata = SDATA_NONE; \
195 rs6000_sdata_name = "none"; \
196 } \
197 \
198 if (TARGET_RELOCATABLE && \
199 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
200 { \
201 rs6000_sdata = SDATA_DATA; \
202 error ("-mrelocatable and -msdata=%s are incompatible.", \
203 rs6000_sdata_name); \
204 } \
205 \
206 else if (flag_pic && \
207 (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
208 { \
209 rs6000_sdata = SDATA_DATA; \
210 error ("-f%s and -msdata=%s are incompatible.", \
211 (flag_pic > 1) ? "PIC" : "pic", \
212 rs6000_sdata_name); \
213 } \
214 \
215 if (rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4 \
216 && DEFAULT_ABI != ABI_SOLARIS) \
217 { \
218 rs6000_sdata = SDATA_NONE; \
219 error ("-msdata=%s and -mcall-%s are incompatible.", \
220 rs6000_sdata_name, rs6000_abi_name); \
221 } \
222 \
223 if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
224 { \
225 target_flags |= MASK_MINIMAL_TOC; \
226 error ("-mrelocatable and -mno-minimal-toc are incompatible."); \
227 } \
228 \
229 if (TARGET_RELOCATABLE && \
230 (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
231 { \
232 target_flags &= ~MASK_RELOCATABLE; \
233 error ("-mrelocatable and -mcall-%s are incompatible.", \
234 rs6000_abi_name); \
235 } \
236 \
237 if (flag_pic > 1 && \
238 (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
239 { \
240 flag_pic = 0; \
241 error ("-fPIC and -mcall-%s are incompatible.", \
242 rs6000_abi_name); \
243 } \
244 \
245 if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
246 { \
247 target_flags &= ~MASK_LITTLE_ENDIAN; \
248 error ("-mcall-aixdesc must be big endian"); \
249 } \
250 \
251 if (rs6000_current_abi == ABI_NT && TARGET_BIG_ENDIAN) \
252 { \
253 target_flags |= MASK_LITTLE_ENDIAN; \
254 error ("-mcall-nt must be little endian"); \
255 } \
256 \
257 /* Treat -fPIC the same as -mrelocatable */ \
258 if (flag_pic > 1) \
259 target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
260 \
261 else if (TARGET_RELOCATABLE) \
262 flag_pic = 2; \
263 \
264 } while (0)
265
266 /* Default ABI to compile code for */
267 #define DEFAULT_ABI rs6000_current_abi
268
269 #define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
270
271 #define ASM_DEFAULT_SPEC "-mppc"
272
273 #include "rs6000/rs6000.h"
274
275 #undef TARGET_DEFAULT
276 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
277
278 #undef PROCESSOR_DEFAULT
279 #define PROCESSOR_DEFAULT PROCESSOR_PPC601
280
281 /* System V.4 uses register 13 as a pointer to the small data area,
282 so it is not available to the normal user. */
283
284 #undef FIXED_R13
285 #define FIXED_R13 1
286
287 /* System V.4 passes the first 8 floating arguments in registers,
288 instead of the first 13 like AIX does. */
289 #undef FP_ARG_MAX_REG
290 #define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) \
291 ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
292
293 /* Size of the V.4 varargs area if needed */
294 #undef RS6000_VARARGS_AREA
295 #define RS6000_VARARGS_AREA ((rs6000_sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
296
297 /* Override default big endianism */
298 #undef BYTES_BIG_ENDIAN
299 #undef WORDS_BIG_ENDIAN
300 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
301 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
302
303 /* Define this to set the endianness to use in libgcc2.c, which can
304 not depend on target_flags. */
305 #if !defined(_LITTLE_ENDIAN) && !defined(__sun__)
306 #define LIBGCC2_WORDS_BIG_ENDIAN 1
307 #else
308 #define LIBGCC2_WORDS_BIG_ENDIAN 0
309 #endif
310
311 /* Size of the outgoing register save area */
312 #undef RS6000_REG_SAVE
313 #define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \
314 || DEFAULT_ABI == ABI_AIX_NODESC) \
315 ? (TARGET_64BIT ? 64 : 32) \
316 : 0)
317
318 /* Size of the fixed area on the stack. For AIX, use the standard 6 word
319 area, otherwise use 2 words to store back chain & LR. */
320 #undef RS6000_SAVE_AREA
321 #define RS6000_SAVE_AREA \
322 (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) ? 24 : 8) << (TARGET_64BIT ? 1 : 0))
323
324 /* Define cutoff for using external functions to save floating point.
325 Currently on V.4, always use inline stores */
326 #undef FP_SAVE_INLINE
327 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
328
329 /* Don't generate XCOFF debugging information. */
330
331 #undef XCOFF_DEBUGGING_INFO
332
333 /* Don't use the COFF object file format. */
334
335 #undef OBJECT_FORMAT_COFF
336
337 /* Don't bother to output .extern pseudo-ops. They are not needed by
338 ELF assemblers. */
339
340 #undef ASM_OUTPUT_EXTERNAL
341
342 /* Put jump tables in read-only memory, rather than in .text. */
343 #undef JUMP_TABLES_IN_TEXT_SECTION
344 #define JUMP_TABLES_IN_TEXT_SECTION 0
345
346 /* Disable AIX-ism that disables turning -B into -L if the argument specifies a
347 relative file name. This breaks setting GCC_EXEC_PREFIX to D:\path under
348 Windows. */
349 #undef RELATIVE_PREFIX_NOT_LINKDIR
350
351 /* Undefine some things which are defined by the generic svr4.h. */
352
353 #undef ASM_FILE_END
354 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
355 #undef READONLY_DATA_SECTION
356 #undef SELECT_SECTION
357 #undef ASM_DECLARE_FUNCTION_NAME
358 #undef ASM_OUTPUT_CONSTRUCTOR
359 #undef ASM_OUTPUT_DESTRUCTOR
360
361 /* Use the regular svr4 definitions. */
362
363 #include "svr4.h"
364
365 /* Prefix and suffix to use to saving floating point */
366 #undef SAVE_FP_PREFIX
367 #undef SAVE_FP_SUFFIX
368 #define SAVE_FP_PREFIX "_savefpr_"
369 #define SAVE_FP_SUFFIX "_l"
370
371 /* Prefix and suffix to use to restoring floating point */
372 #undef RESTORE_FP_PREFIX
373 #undef RESTORE_FP_SUFFIX
374 #define RESTORE_FP_PREFIX "_restfpr_"
375 #define RESTORE_FP_SUFFIX "_l"
376
377 /* Type used for ptrdiff_t, as a string used in a declaration. */
378 #undef PTRDIFF_TYPE
379 #define PTRDIFF_TYPE "int"
380
381 /* Type used for wchar_t, as a string used in a declaration. */
382 #undef WCHAR_TYPE
383 #define WCHAR_TYPE "long int"
384
385 /* Width of wchar_t in bits. */
386 #undef WCHAR_TYPE_SIZE
387 #define WCHAR_TYPE_SIZE 32
388
389 /* Make int foo : 8 not cause structures to be aligned to an int boundary */
390
391 #undef PCC_BITFIELD_TYPE_MATTERS
392 #define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
393
394 /* Define this macro to be the value 1 if instructions will fail to
395 work if given data not on the nominal alignment. If instructions
396 will merely go slower in that case, define this macro as 0. */
397 #undef STRICT_ALIGNMENT
398 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN)
399
400 /* Alignment in bits of the stack boundary. Note, in order to allow building
401 one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
402 versions, just use 64 as the stack boundary. */
403 #undef STACK_BOUNDARY
404 #define STACK_BOUNDARY 64
405
406 /* Real stack boundary as mandated by the appropriate ABI */
407 #define ABI_STACK_BOUNDARY ((TARGET_EABI) ? 64 : 128)
408
409 /* No data type wants to be aligned rounder than this. */
410 #undef BIGGEST_ALIGNMENT
411 #define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
412
413 #undef BIGGEST_FIELD_ALIGNMENT
414 #undef ADJUST_FIELD_ALIGN
415 #undef ROUND_TYPE_ALIGN
416
417 /* Use ELF style section commands. */
418
419 #undef TEXT_SECTION_ASM_OP
420 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
421
422 #undef DATA_SECTION_ASM_OP
423 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
424
425 #undef BSS_SECTION_ASM_OP
426 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
427
428 #undef INIT_SECTION_ASM_OP
429 #define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\""
430
431 #undef FINI_SECTION_ASM_OP
432 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\""
433
434 #define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\""
435
436 /* Put PC relative got entries in .got2 */
437 #define MINIMAL_TOC_SECTION_ASM_OP \
438 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
439
440 /* Put relocatable data in .data, not .rodata so initialized pointers can be updated */
441 #undef CONST_SECTION_ASM_OP
442 #define CONST_SECTION_ASM_OP \
443 ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".data\"\t# .rodata" : "\t.section\t\".rodata\"")
444
445
446 #define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
447 #define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
448 #define SBSS_SECTION_ASM_OP \
449 ((DEFAULT_ABI == ABI_SOLARIS) ? "\t.section\t\".sbss\",\"aw\"" : "\t.section\t\".sbss\",\"aw\",@nobits")
450
451
452 /* Besides the usual ELF sections, we need a toc section. */
453 #undef EXTRA_SECTIONS
454 #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
455
456 #undef EXTRA_SECTION_FUNCTIONS
457 #define EXTRA_SECTION_FUNCTIONS \
458 CONST_SECTION_FUNCTION \
459 CTORS_SECTION_FUNCTION \
460 DTORS_SECTION_FUNCTION \
461 TOC_SECTION_FUNCTION \
462 SDATA_SECTION_FUNCTION \
463 SDATA2_SECTION_FUNCTION \
464 SBSS_SECTION_FUNCTION \
465 INIT_SECTION_FUNCTION \
466 FINI_SECTION_FUNCTION
467
468 extern void toc_section (), sdata_section (), sdata2_section ();
469 extern void sbss_section ();
470
471 #define TOC_SECTION_FUNCTION \
472 void \
473 toc_section () \
474 { \
475 if (in_section != in_toc) \
476 { \
477 in_section = in_toc; \
478 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
479 && TARGET_MINIMAL_TOC \
480 && !TARGET_RELOCATABLE) \
481 { \
482 if (! toc_initialized) \
483 { \
484 toc_initialized = 1; \
485 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
486 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
487 fprintf (asm_out_file, "\t.tc "); \
488 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
489 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
490 fprintf (asm_out_file, "\n"); \
491 \
492 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
493 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
494 fprintf (asm_out_file, " = .+32768\n"); \
495 } \
496 else \
497 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
498 } \
499 else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
500 && !TARGET_RELOCATABLE) \
501 fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
502 else \
503 { \
504 fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
505 if (! toc_initialized) \
506 { \
507 ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
508 fprintf (asm_out_file, " = .+32768\n"); \
509 toc_initialized = 1; \
510 } \
511 } \
512 } \
513 }
514
515 #define SDATA_SECTION_FUNCTION \
516 void \
517 sdata_section () \
518 { \
519 if (in_section != in_sdata) \
520 { \
521 in_section = in_sdata; \
522 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
523 } \
524 }
525
526 #define SDATA2_SECTION_FUNCTION \
527 void \
528 sdata2_section () \
529 { \
530 if (in_section != in_sdata2) \
531 { \
532 in_section = in_sdata2; \
533 fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
534 } \
535 }
536
537 #define SBSS_SECTION_FUNCTION \
538 void \
539 sbss_section () \
540 { \
541 if (in_section != in_sbss) \
542 { \
543 in_section = in_sbss; \
544 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
545 } \
546 }
547
548 #define INIT_SECTION_FUNCTION \
549 void \
550 init_section () \
551 { \
552 if (in_section != in_init) \
553 { \
554 in_section = in_init; \
555 fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
556 } \
557 }
558
559 #define FINI_SECTION_FUNCTION \
560 void \
561 fini_section () \
562 { \
563 if (in_section != in_fini) \
564 { \
565 in_section = in_fini; \
566 fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
567 } \
568 }
569
570 /* A C statement or statements to switch to the appropriate section
571 for output of RTX in mode MODE. You can assume that RTX is some
572 kind of constant in RTL. The argument MODE is redundant except in
573 the case of a `const_int' rtx. Select the section by calling
574 `text_section' or one of the alternatives for other sections.
575
576 Do not define this macro if you put all constants in the read-only
577 data section. */
578
579 extern void rs6000_select_rtx_section (), rs6000_select_section ();
580
581 #undef SELECT_RTX_SECTION
582 #define SELECT_RTX_SECTION(MODE, X) rs6000_select_rtx_section (MODE, X)
583
584 /* A C statement or statements to switch to the appropriate
585 section for output of DECL. DECL is either a `VAR_DECL' node
586 or a constant of some sort. RELOC indicates whether forming
587 the initial value of DECL requires link-time relocations. */
588
589 #undef SELECT_SECTION
590 #define SELECT_SECTION(DECL,RELOC) rs6000_select_section (DECL, RELOC)
591
592 /* Return non-zero if this entry is to be written into the constant pool
593 in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
594 containing one of them. If -mfp-in-toc (the default), we also do
595 this for floating-point constants. We actually can only do this
596 if the FP formats of the target and host machines are the same, but
597 we can't check that since not every file that uses
598 GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
599
600 Unlike AIX, we don't key off of -mminimal-toc, but instead do not
601 allow floating point constants in the TOC if -mrelocatable. */
602
603 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
604 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
605 (TARGET_TOC \
606 && (GET_CODE (X) == SYMBOL_REF \
607 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
608 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
609 || GET_CODE (X) == LABEL_REF \
610 || (!TARGET_NO_FP_IN_TOC \
611 && !TARGET_RELOCATABLE \
612 && GET_CODE (X) == CONST_DOUBLE \
613 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
614 && BITS_PER_WORD == HOST_BITS_PER_INT)))
615
616 /* These macros generate the special .type and .size directives which
617 are used to set the corresponding fields of the linker symbol table
618 entries in an ELF object file under SVR4. These macros also output
619 the starting labels for the relevant functions/objects. */
620
621 /* Write the extra assembler code needed to declare a function properly.
622 Some svr4 assemblers need to also have something extra said about the
623 function's return value. We allow for that here. */
624
625 extern int rs6000_pic_labelno;
626
627 #undef ASM_DECLARE_FUNCTION_NAME
628 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
629 do { \
630 char *orig_name; \
631 char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
632 STRIP_NAME_ENCODING (orig_name, NAME); \
633 \
634 if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag)) \
635 { \
636 char buf[256], *buf_ptr; \
637 \
638 ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
639 \
640 ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
641 STRIP_NAME_ENCODING (buf_ptr, buf); \
642 fprintf (FILE, "\t%s %s-", init_ptr, buf_ptr); \
643 \
644 ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
645 fprintf (FILE, "%s\n", buf_ptr); \
646 } \
647 \
648 fprintf (FILE, "\t%s\t %s,", TYPE_ASM_OP, orig_name); \
649 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
650 putc ('\n', FILE); \
651 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
652 \
653 if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
654 { \
655 char *desc_name = orig_name; \
656 \
657 while (*desc_name == '.') \
658 desc_name++; \
659 \
660 if (TREE_PUBLIC (DECL)) \
661 fprintf (FILE, "\t.globl %s\n", desc_name); \
662 \
663 fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
664 fprintf (FILE, "%s:\n", desc_name); \
665 fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
666 fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
667 if (DEFAULT_ABI == ABI_AIX) \
668 fprintf (FILE, "\t%s 0\n", init_ptr); \
669 fprintf (FILE, "\t.previous\n"); \
670 } \
671 fprintf (FILE, "%s:\n", orig_name); \
672 } while (0)
673
674 /* How to renumber registers for dbx and gdb. */
675
676 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
677
678 /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
679
680 #undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX
681 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
682 fprintf (FILE, ".%s", PREFIX)
683
684 /* This is how to allocate empty space in some section. Use .space
685 instead of .zero because the Solaris PowerPC assembler doesn't
686 like it, and gas accepts either syntax. */
687
688 #undef SKIP_ASM_OP
689 #define SKIP_ASM_OP ".space"
690
691 /* This says how to output assembler code to declare an
692 uninitialized internal linkage data object. Under SVR4,
693 the linker seems to want the alignment of data objects
694 to depend on their types. We do exactly that here. */
695
696 #ifndef LOCAL_ASM_OP
697 #define LOCAL_ASM_OP ".local"
698 #endif
699
700 #ifndef LCOMM_ASM_OP
701 #define LCOMM_ASM_OP ".lcomm"
702 #endif
703
704 #undef ASM_OUTPUT_ALIGNED_LOCAL
705 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
706 do { \
707 if (rs6000_sdata != SDATA_NONE && (SIZE) > 0 \
708 && (SIZE) <= g_switch_value) \
709 { \
710 sbss_section (); \
711 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
712 ASM_OUTPUT_LABEL (FILE, NAME); \
713 ASM_OUTPUT_SKIP (FILE, SIZE); \
714 if (!flag_inhibit_size_directive && (SIZE) > 0) \
715 { \
716 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
717 assemble_name (FILE, NAME); \
718 fprintf (FILE, ",%d\n", SIZE); \
719 } \
720 } \
721 else \
722 { \
723 fprintf (FILE, "\t%s\t", LCOMM_ASM_OP); \
724 assemble_name ((FILE), (NAME)); \
725 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
726 } \
727 } while (0)
728
729 /* Describe how to emit uninitialized external linkage items */
730 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
731 do { \
732 ASM_GLOBALIZE_LABEL (FILE, NAME); \
733 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
734 } while (0)
735
736 /* Switch Recognition by gcc.c. Add -G xx support */
737
738 #undef SWITCH_TAKES_ARG
739 #define SWITCH_TAKES_ARG(CHAR) \
740 ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
741 || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
742 || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
743 || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
744 || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
745
746 /* Output .file. */
747 #undef ASM_FILE_START
748 #define ASM_FILE_START(FILE) \
749 do { \
750 output_file_directive ((FILE), main_input_filename); \
751 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
752 } while (0)
753
754
755 /* This is how to output an assembler line defining an `int' constant.
756 For -mrelocatable, we mark all addresses that need to be fixed up
757 in the .fixup section. */
758 #undef ASM_OUTPUT_INT
759 #define ASM_OUTPUT_INT(FILE,VALUE) \
760 do { \
761 static int recurse = 0; \
762 if ((TARGET_RELOCATABLE || flag_pic) \
763 && in_section != in_toc \
764 && in_section != in_text \
765 && in_section != in_ctors \
766 && in_section != in_dtors \
767 && !recurse \
768 && GET_CODE (VALUE) != CONST_INT \
769 && GET_CODE (VALUE) != CONST_DOUBLE \
770 && CONSTANT_P (VALUE)) \
771 { \
772 static int labelno = 0; \
773 char buf[256], *p; \
774 \
775 recurse = 1; \
776 ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", labelno++); \
777 STRIP_NAME_ENCODING (p, buf); \
778 fprintf (FILE, "%s:\n", p); \
779 fprintf (FILE, "\t.long ("); \
780 output_addr_const (FILE, (VALUE)); \
781 fprintf (FILE, ")@fixup\n"); \
782 fprintf (FILE, "\t.section\t\".fixup\",\"aw\"\n"); \
783 ASM_OUTPUT_ALIGN (FILE, 2); \
784 fprintf (FILE, "\t.long\t%s\n", p); \
785 fprintf (FILE, "\t.previous\n"); \
786 recurse = 0; \
787 } \
788 /* Remove initial .'s to turn a -mcall-aixdesc or -mcall-nt function \
789 address into the address of the descriptor, not the function \
790 itself. */ \
791 else if (GET_CODE (VALUE) == SYMBOL_REF \
792 && XSTR (VALUE, 0)[0] == '.' \
793 && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)) \
794 { \
795 char *name = XSTR (VALUE, 0); \
796 while (*name == '.') \
797 name++; \
798 \
799 fprintf (FILE, "\t.long %s\n", name); \
800 } \
801 else \
802 { \
803 fprintf (FILE, "\t.long "); \
804 output_addr_const (FILE, (VALUE)); \
805 fprintf (FILE, "\n"); \
806 } \
807 } while (0)
808
809 /* This is the end of what might become sysv4.h. */
810
811 /* Allow stabs and dwarf, for now, make stabs the default debugging type,
812 not dwarf since G++ doesn't support dwarf. */
813 #undef PREFERRED_DEBUGGING_TYPE
814 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
815
816 #define DBX_DEBUGGING_INFO
817 #define DWARF_DEBUGGING_INFO
818
819 /* If we are referencing a function that is static or is known to be
820 in this file, make the SYMBOL_REF special. We can use this to indicate
821 that we can branch to this function without emitting a no-op after the
822 call. For real AIX and NT calling sequences, we also replace the
823 function name with the real name (1 or 2 leading .'s), rather than
824 the function descriptor name. This saves a lot of overriding code
825 to readd the prefixes. */
826
827 #undef ENCODE_SECTION_INFO
828 #define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL)
829
830 extern void rs6000_encode_section_info ();
831
832 /* This macro gets just the user-specified name
833 out of the string in a SYMBOL_REF. Discard
834 a leading * or @. */
835 #undef STRIP_NAME_ENCODING
836 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
837 do { \
838 char *_name = SYMBOL_NAME; \
839 while (*_name == '*' || *_name == '@') \
840 _name++; \
841 (VAR) = _name; \
842 } while (0)
843
844 /* This is how to output a reference to a user-level label named NAME.
845 `assemble_name' uses this. */
846
847 #undef ASM_OUTPUT_LABELREF
848 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
849 do { \
850 char *_name = NAME; \
851 while (*_name == '*' || *_name == '@') \
852 _name++; \
853 fputs (_name, FILE); \
854 } while (0)
855
856 /*
857 * Switch into a generic section.
858 *
859 * We make the section read-only and executable for a function decl,
860 * read-only for a const data decl, and writable for a non-const data decl.
861 *
862 * If the section has already been defined, we must not
863 * emit the attributes here. The SVR4 assembler does not
864 * recognize section redefinitions.
865 * If DECL is NULL, no attributes are emitted.
866 *
867 * Note, Solaris as doesn't like @nobits, and gas can handle .sbss without
868 * needing @nobits.
869 */
870
871 #undef ASM_OUTPUT_SECTION_NAME
872 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
873 do { \
874 static struct section_info \
875 { \
876 struct section_info *next; \
877 char *name; \
878 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
879 } *sections; \
880 struct section_info *s; \
881 char *mode; \
882 enum sect_enum type; \
883 \
884 for (s = sections; s; s = s->next) \
885 if (!strcmp (NAME, s->name)) \
886 break; \
887 \
888 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
889 type = SECT_EXEC, mode = "ax"; \
890 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC) && !TARGET_RELOCATABLE && !flag_pic) \
891 type = SECT_RO, mode = "a"; \
892 else \
893 type = SECT_RW, mode = "aw"; \
894 \
895 if (s == 0) \
896 { \
897 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
898 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
899 strcpy (s->name, NAME); \
900 s->type = type; \
901 s->next = sections; \
902 sections = s; \
903 fprintf (FILE, "\t.section\t\"%s\",\"%s\"\n", NAME, mode); \
904 } \
905 else \
906 { \
907 if (DECL && s->type != type) \
908 error_with_decl (DECL, "%s causes a section type conflict"); \
909 \
910 fprintf (FILE, "\t.section\t\"%s\"\n", NAME); \
911 } \
912 } while (0)
913
914 #undef ASM_OUTPUT_CONSTRUCTOR
915 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
916 do { \
917 if (DEFAULT_ABI != ABI_SOLARIS) \
918 { \
919 ctors_section (); \
920 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
921 assemble_name (FILE, NAME); \
922 } \
923 else \
924 { \
925 init_section (); \
926 fputs ("\tbl ", FILE); \
927 assemble_name (FILE, NAME); \
928 } \
929 fputs ("\n", FILE); \
930 } while (0)
931
932 /* A C statement (sans semicolon) to output an element in the table of
933 global destructors. */
934 #undef ASM_OUTPUT_DESTRUCTOR
935 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
936 do { \
937 if (DEFAULT_ABI != ABI_SOLARIS) \
938 { \
939 dtors_section (); \
940 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
941 assemble_name (FILE, NAME); \
942 } \
943 else \
944 { \
945 fini_section (); \
946 fputs ("\tbl ", FILE); \
947 assemble_name (FILE, NAME); \
948 } \
949 fputs ("\n", FILE); \
950 } while (0)
951
952 /* But, to make this work, we have to output the stabs for the function
953 name *first*... */
954
955 #define DBX_FUNCTION_FIRST
956
957 /* This is the end of what might become sysv4dbx.h. */
958
959 #undef TARGET_VERSION
960 #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
961 \f
962 #undef CPP_PREDEFINES
963 #define CPP_PREDEFINES \
964 "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
965
966 /* Pass various options to the assembler */
967 #undef ASM_SPEC
968 #define ASM_SPEC "%(asm_cpu) \
969 %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
970 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
971 %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
972 %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
973 %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
974 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
975 %{mcall-solaris: -mlittle -msolaris} \
976 %{mcall-linux: -mbig} }}}}"
977
978 #ifndef CC1_ENDIAN_BIG_SPEC
979 #define CC1_ENDIAN_BIG_SPEC ""
980 #endif
981
982 #ifndef CC1_ENDIAN_LITTLE_SPEC
983 #define CC1_ENDIAN_LITTLE_SPEC "\
984 %{!mstrict-align: %{!mno-strict-align: \
985 -mstrict-align \
986 }}"
987 #endif
988
989 #ifndef CC1_ENDIAN_DEFAULT_SPEC
990 #define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big_spec)"
991 #endif
992
993 #undef CC1_SPEC
994 /* Pass -G xxx to the compiler and set correct endian mode */
995 #define CC1_SPEC "%{G*} \
996 %{mlittle: %(cc1_endian_little)} %{!mlittle: %{mlittle-endian: %(cc1_endian_little)}} \
997 %{mbig: %(cc1_endian_big)} %{!mbig: %{mbig-endian: %(cc1_endian_big)}} \
998 %{mcall-nt: -mlittle %{cc1_endian_little} } \
999 %{mcall-aixdesc: -mbig %{cc1_endian_big} } \
1000 %{mcall-solaris: -mlittle %{cc1_endian_little} } \
1001 %{mcall-linux: -mbig %{cc1_endian_big} } \
1002 %{!mcall-nt: %{!mcall-aixdesc: %{!mcall-solaris: %{!mcall-linux: \
1003 %(cc1_endian_default) \
1004 }}}} \
1005 %{mcall-solaris: -mregnames } \
1006 %{mno-sdata: -msdata=none } \
1007 %{meabi: %{!mcall-*: -mcall-sysv }} \
1008 %{!meabi: %{!mno-eabi: \
1009 %{mrelocatable: -meabi } \
1010 %{mcall-solaris: -mno-eabi } \
1011 %{mcall-linux: -mno-eabi }}} \
1012 %{msdata: -msdata=default} \
1013 %{mno-sdata: -msdata=none}"
1014
1015 /* Don't put -Y P,<path> for cross compilers */
1016 #undef LINK_PATH_SPEC
1017 #ifndef CROSS_COMPILE
1018 #define LINK_PATH_SPEC "\
1019 %{!R*:%{L*:-R %*}} \
1020 %{!nostdlib: %{!YP,*: \
1021 %{compat-bsd: \
1022 %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1023 %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
1024 %{!R*: %{!L*: -R /usr/ucblib}} \
1025 %{!compat-bsd: \
1026 %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
1027 %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
1028
1029 #else
1030 #define LINK_PATH_SPEC ""
1031 #endif
1032
1033 /* Default starting address if specified */
1034 #ifndef LINK_START_SPEC
1035 #define LINK_START_SPEC "\
1036 %{mads: %(link_start_ads) } \
1037 %{myellowknife: %(link_start_yellowknife) } \
1038 %{mmvme: %(link_start_mvme) } \
1039 %{msim: %(link_start_sim) } \
1040 %{mcall-linux: %(link_start_linux) } \
1041 %{mcall-solaris: %(link_start_solaris) } \
1042 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_start_default) }}}}}}"
1043 #endif
1044
1045 #ifndef LINK_START_DEFAULT_SPEC
1046 #define LINK_START_DEFAULT_SPEC ""
1047 #endif
1048
1049 #undef LINK_SPEC
1050 #define LINK_SPEC "\
1051 %{h*} %{v:-V} %{G*} \
1052 %{Wl,*:%*} %{YP,*} %{R*} \
1053 %{Qy:} %{!Qn:-Qy} \
1054 %(link_shlib) \
1055 %{!Ttext*: %(link_start) } \
1056 %(link_target) \
1057 %(link_os)"
1058
1059 /* For now, turn off shared libraries by default. */
1060 #ifndef SHARED_LIB_SUPPORT
1061 #define NO_SHARED_LIB_SUPPORT
1062 #endif
1063
1064 #undef LINK_SHLIB_SPEC
1065 #ifndef NO_SHARED_LIB_SUPPORT
1066 /* Shared libraries are default. */
1067 #define LINK_SHLIB_SPEC "\
1068 %{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
1069 %{mshlib: } \
1070 %{static:-dn -Bstatic} \
1071 %{shared:-G -dy -z text} \
1072 %{symbolic:-Bsymbolic -G -dy -z text}"
1073
1074 #else
1075 /* Shared libraries are not default. */
1076 #define LINK_SHLIB_SPEC "\
1077 %{mshlib: %(link_path) } \
1078 %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
1079 %{static: } \
1080 %{shared:-G -dy -z text %(link_path) } \
1081 %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }"
1082 #endif
1083
1084 /* Override the default target of the linker. */
1085 #undef LINK_TARGET_SPEC
1086 #define LINK_TARGET_SPEC "\
1087 %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
1088 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-solaris: -oformat elf32-powerpcle}}}}}"
1089
1090 /* Any specific OS flags */
1091 #ifndef LINK_OS_SPEC
1092 #define LINK_OS_SPEC "\
1093 %{mads: %(link_os_ads) } \
1094 %{myellowknife: %(link_os_yellowknife) } \
1095 %{mmvme: %(link_os_mvme) } \
1096 %{msim: %(link_os_sim) } \
1097 %{mcall-linux: %(link_os_linux) } \
1098 %{mcall-solaris: %(link_os_solaris) } \
1099 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_os_default) }}}}}}"
1100 #endif
1101
1102 #ifndef LINK_OS_DEFAULT_SPEC
1103 #define LINK_OS_DEFAULT_SPEC ""
1104 #endif
1105
1106 #undef CPP_SYSV_SPEC
1107 #define CPP_SYSV_SPEC \
1108 "%{mrelocatable*: -D_RELOCATABLE} \
1109 %{fpic: -D__PIC__=1 -D__pic__=1} \
1110 %{fPIC: -D__PIC__=2 -D__pic__=2} \
1111 %{mcall-sysv: -D_CALL_SYSV} %{mcall-nt: -D_CALL_NT} \
1112 %{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
1113 %{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %{!mcall-nt: %(cpp_sysv_default) }}}} \
1114 %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
1115
1116 #undef CPP_SYSV_DEFAULT_SPEC
1117 #define CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
1118
1119 #ifndef CPP_ENDIAN_BIG_SPEC
1120 #define CPP_ENDIAN_BIG_SPEC "-D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)"
1121 #endif
1122
1123 #ifndef CPP_ENDIAN_LITTLE_SPEC
1124 #define CPP_ENDIAN_LITTLE_SPEC "-D_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -Amachine(littleendian)"
1125 #endif
1126
1127 #ifndef CPP_ENDIAN_SOLARIS_SPEC
1128 #define CPP_ENDIAN_SOLARIS_SPEC "-D__LITTLE_ENDIAN__ -Amachine(littleendian)"
1129 #endif
1130
1131 /* For solaris, don't define _LITTLE_ENDIAN, it conflicts with a header file. */
1132 #undef CPP_ENDIAN_SPEC
1133 #define CPP_ENDIAN_SPEC \
1134 "%{mlittle: %(cpp_endian_little) } \
1135 %{mlittle-endian: %(cpp_endian_little) } \
1136 %{mbig: %(cpp_endian_big) } \
1137 %{mbig-endian: %(cpp_endian_big) } \
1138 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
1139 %{mcall-solaris: %(cpp_endian_solaris) } \
1140 %{mcall-nt: %(cpp_endian_little) } \
1141 %{mcall-linux: %(cpp_endian_big) } \
1142 %{mcall-aixdesc: %(cpp_endian_big) } \
1143 %{!mcall-solaris: %{!mcall-linux: %{!mcall-nt: %{!mcall-aixdesc: %(cpp_endian_default) }}}}}}}}"
1144
1145 #undef CPP_ENDIAN_DEFAULT_SPEC
1146 #define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
1147
1148 #undef CPP_SPEC
1149 #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
1150 %{mads: %(cpp_os_ads) } \
1151 %{myellowknife: %(cpp_os_yellowknife) } \
1152 %{mmvme: %(cpp_os_mvme) } \
1153 %{msim: %(cpp_os_sim) } \
1154 %{mcall-linux: %(cpp_os_linux) } \
1155 %{mcall-solaris: %(cpp_os_solaris) } \
1156 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}}}"
1157
1158 #ifndef CPP_OS_DEFAULT_SPEC
1159 #define CPP_OS_DEFAULT_SPEC ""
1160 #endif
1161
1162 #undef STARTFILE_SPEC
1163 #define STARTFILE_SPEC "\
1164 %{mads: %(startfile_ads) } \
1165 %{myellowknife: %(startfile_yellowknife) } \
1166 %{mmvme: %(startfile_mvme) } \
1167 %{msim: %(startfile_sim) } \
1168 %{mcall-linux: %(startfile_linux) } \
1169 %{mcall-solaris: %(startfile_solaris) } \
1170 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(startfile_default) }}}}}}"
1171
1172 #undef STARTFILE_DEFAULT_SPEC
1173 #define STARTFILE_DEFAULT_SPEC ""
1174
1175 #undef LIB_SPEC
1176 #define LIB_SPEC "\
1177 %{mads: %(lib_ads) } \
1178 %{myellowknife: %(lib_yellowknife) } \
1179 %{mmvme: %(lib_mvme) } \
1180 %{msim: %(lib_sim) } \
1181 %{mcall-linux: %(lib_linux) } \
1182 %{mcall-solaris: %(lib_solaris) } \
1183 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(lib_default) }}}}}}"
1184
1185 #undef LIBGCC_SPEC
1186 #define LIBGCC_SPEC "libgcc.a%s"
1187
1188 #ifndef LIB_DEFAULT_SPEC
1189 #define LIB_DEFAULT_SPEC ""
1190 #endif
1191
1192 #undef ENDFILE_SPEC
1193 #define ENDFILE_SPEC "\
1194 %{mads: ecrtn.o%s} \
1195 %{myellowknife: ecrtn.o%s} \
1196 %{mmvme: ecrtn.o%s} \
1197 %{msim: ecrtn.o%s} \
1198 %{mcall-linux: %(endfile_linux) } \
1199 %{mcall-solaris: scrtn.o%s} \
1200 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(endfile_default) }}}}}}"
1201
1202 #undef ENDFILE_DEFAULT_SPEC
1203 #define ENDFILE_DEFAULT_SPEC ""
1204
1205 /* Motorola ADS support. */
1206 #ifndef LIB_ADS_SPEC
1207 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
1208 #endif
1209
1210 #ifndef STARTFILE_ADS_SPEC
1211 #define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s"
1212 #endif
1213
1214 #ifndef ENDFILE_ADS_SPEC
1215 #define ENDFILE_ADS_SPEC "ecrtn.o%s"
1216 #endif
1217
1218 #ifndef LINK_START_ADS_SPEC
1219 #define LINK_START_ADS_SPEC "-T ads.ld%s"
1220 #endif
1221
1222 #ifndef LINK_OS_ADS_SPEC
1223 #define LINK_OS_ADS_SPEC ""
1224 #endif
1225
1226 #ifndef CPP_OS_ADS_SPEC
1227 #define CPP_OS_ADS_SPEC ""
1228 #endif
1229
1230 /* Motorola Yellowknife support. */
1231 #ifndef LIB_YELLOWKNIFE_SPEC
1232 #define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group"
1233 #endif
1234
1235 #ifndef STARTFILE_YELLOWKNIFE_SPEC
1236 #define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s"
1237 #endif
1238
1239 #ifndef ENDFILE_YELLOWKNIFE_SPEC
1240 #define ENDFILE_YELLOWKNIFE_SPEC "ecrtn.o%s"
1241 #endif
1242
1243 #ifndef LINK_START_YELLOWKNIFE_SPEC
1244 #define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s"
1245 #endif
1246
1247 #ifndef LINK_OS_YELLOWKNIFE_SPEC
1248 #define LINK_OS_YELLOWKNIFE_SPEC ""
1249 #endif
1250
1251 #ifndef CPP_OS_YELLOWKNIFE_SPEC
1252 #define CPP_OS_YELLOWKNIFE_SPEC ""
1253 #endif
1254
1255 /* Motorola MVME support. */
1256 #ifndef LIB_MVME_SPEC
1257 #define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group"
1258 #endif
1259
1260 #ifndef STARTFILE_MVME_SPEC
1261 #define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s"
1262 #endif
1263
1264 #ifndef ENDFILE_MVME_SPEC
1265 #define ENDFILE_MVME_SPEC "ecrtn.o%s"
1266 #endif
1267
1268 #ifndef LINK_START_MVME_SPEC
1269 #define LINK_START_MVME_SPEC "%{!Wl,-T*: %{!T*: -Ttext 0x40000}}"
1270 #endif
1271
1272 #ifndef LINK_OS_MVME_SPEC
1273 #define LINK_OS_MVME_SPEC ""
1274 #endif
1275
1276 #ifndef CPP_OS_MVME_SPEC
1277 #define CPP_OS_MVME_SPEC ""
1278 #endif
1279
1280 /* PowerPC simulator based on netbsd system calls support. */
1281 #ifndef LIB_SIM_SPEC
1282 #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
1283 #endif
1284
1285 #ifndef STARTFILE_SIM_SPEC
1286 #define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s"
1287 #endif
1288
1289 #ifndef ENDFILE_SIM_SPEC
1290 #define ENDFILE_SIM_SPEC "ecrtn.o%s"
1291 #endif
1292
1293 #ifndef LINK_START_SIM_SPEC
1294 #define LINK_START_SIM_SPEC "-Ttext 0x10000074"
1295 #endif
1296
1297 #ifndef LINK_OS_SIM_SPEC
1298 #define LINK_OS_SIM_SPEC ""
1299 #endif
1300
1301 #ifndef CPP_OS_SIM_SPEC
1302 #define CPP_OS_SIM_SPEC ""
1303 #endif
1304
1305 /* GNU/Linux support. */
1306 #ifndef LIB_LINUX_SPEC
1307 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } %{!mnewlib: -lc }"
1308 #endif
1309
1310 #ifndef STARTFILE_LINUX_SPEC
1311 #define STARTFILE_LINUX_SPEC "\
1312 %{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
1313 %{mnewlib: ecrti.o%s} \
1314 %{!mnewlib: crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
1315 #endif
1316
1317 #ifndef ENDFILE_LINUX_SPEC
1318 #define ENDFILE_LINUX_SPEC "\
1319 %{mnewlib: ecrtn.o%s} \
1320 %{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"
1321 #endif
1322
1323 #ifndef LINK_START_LINUX_SPEC
1324 #define LINK_START_LINUX_SPEC "-Ttext 0x400074"
1325 #endif
1326
1327 #ifndef LINK_OS_LINUX_SPEC
1328 #define LINK_OS_LINUX_SPEC ""
1329 #endif
1330
1331 #ifndef CPP_OS_LINUX_SPEC
1332 #define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
1333 %{!ansi: -Dunix -Dlinux } \
1334 -Asystem(unix) -Asystem(linux)"
1335 #endif
1336
1337 #ifndef CPP_OS_LINUX_SPEC
1338 #define CPP_OS_LINUX_SPEC ""
1339 #endif
1340
1341 /* Solaris support. */
1342 /* For Solaris, Gcc automatically adds in one of the files
1343 /usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
1344 /usr/ccs/lib/values-Xt.o for each final link step (depending upon the other
1345 gcc options selected, such as -traditional and -ansi). These files each
1346 contain one (initialized) copy of a special variable called `_lib_version'.
1347 Each one of these files has `_lib_version' initialized to a different (enum)
1348 value. The SVR4 library routines query the value of `_lib_version' at run
1349 to decide how they should behave. Specifically, they decide (based upon the
1350 value of `_lib_version') if they will act in a strictly ANSI conforming
1351 manner or not. */
1352
1353 #ifndef LIB_SOLARIS_SPEC
1354 #define LIB_SOLARIS_SPEC "\
1355 %{mnewlib: --start-group -lsolaris -lc --end-group } \
1356 %{!mnewlib: \
1357 %{ansi:values-Xc.o%s} \
1358 %{!ansi: \
1359 %{traditional:values-Xt.o%s} \
1360 %{!traditional:values-Xa.o%s}} \
1361 %{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
1362 %{solaris-cclib: /opt/SUNWspro/SC4.0/lib/libabi.a} \
1363 %{!shared: %{!symbolic: -lc }}}"
1364 #endif
1365
1366 #ifndef STARTFILE_SOLARIS_SPEC
1367 #define STARTFILE_SOLARIS_SPEC "\
1368 %{!msolaris-cclib: scrti.o%s scrt0.o%s} \
1369 %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crti.o%s /opt/SUNWspro/SC4.0/lib/crt1.o%s}"
1370 #endif
1371
1372 #ifndef ENDFILE_SOLARIS_SPEC
1373 #define ENDFILE_SOLARIS_SPEC "\
1374 %{!msolaris-cclib: scrtn.o%s} \
1375 %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crtn.o%s}"
1376 #endif
1377
1378 #ifndef LINK_START_SOLARIS_SPEC
1379 #ifdef CROSS_COMPILER
1380 #define LINK_START_SOLARIS_SPEC "-Ttext 0x2000074"
1381 #else
1382 #define LINK_START_SOLARIS_SPEC ""
1383 #endif
1384 #endif
1385
1386 #ifndef LINK_OS_SOLARIS_SPEC
1387 #define LINK_OS_SOLARIS_SPEC ""
1388 #endif
1389
1390 #ifndef CPP_OS_SOLARIS_SPEC
1391 #define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__ -D__SVR4__ \
1392 %{!ansi: -Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__ } \
1393 -Amachine(prep)"
1394 #endif
1395
1396 /* Define any extra SPECS that the compiler needs to generate. */
1397 #undef SUBTARGET_EXTRA_SPECS
1398 #define SUBTARGET_EXTRA_SPECS \
1399 { "lib_ads", LIB_ADS_SPEC }, \
1400 { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \
1401 { "lib_mvme", LIB_MVME_SPEC }, \
1402 { "lib_sim", LIB_SIM_SPEC }, \
1403 { "lib_linux", LIB_LINUX_SPEC }, \
1404 { "lib_solaris", LIB_SOLARIS_SPEC }, \
1405 { "lib_default", LIB_DEFAULT_SPEC }, \
1406 { "startfile_ads", STARTFILE_ADS_SPEC }, \
1407 { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \
1408 { "startfile_mvme", STARTFILE_MVME_SPEC }, \
1409 { "startfile_sim", STARTFILE_SIM_SPEC }, \
1410 { "startfile_linux", STARTFILE_LINUX_SPEC }, \
1411 { "startfile_solaris", STARTFILE_SOLARIS_SPEC }, \
1412 { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
1413 { "endfile_ads", ENDFILE_ADS_SPEC }, \
1414 { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \
1415 { "endfile_mvme", ENDFILE_MVME_SPEC }, \
1416 { "endfile_sim", ENDFILE_SIM_SPEC }, \
1417 { "endfile_linux", ENDFILE_LINUX_SPEC }, \
1418 { "endfile_solaris", ENDFILE_SOLARIS_SPEC }, \
1419 { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
1420 { "link_path", LINK_PATH_SPEC }, \
1421 { "link_shlib", LINK_SHLIB_SPEC }, \
1422 { "link_target", LINK_TARGET_SPEC }, \
1423 { "link_start", LINK_START_SPEC }, \
1424 { "link_start_ads", LINK_START_ADS_SPEC }, \
1425 { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
1426 { "link_start_mvme", LINK_START_MVME_SPEC }, \
1427 { "link_start_sim", LINK_START_SIM_SPEC }, \
1428 { "link_start_linux", LINK_START_LINUX_SPEC }, \
1429 { "link_start_solaris", LINK_START_SOLARIS_SPEC }, \
1430 { "link_start_default", LINK_START_DEFAULT_SPEC }, \
1431 { "link_os", LINK_OS_SPEC }, \
1432 { "link_os_ads", LINK_OS_ADS_SPEC }, \
1433 { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \
1434 { "link_os_mvme", LINK_OS_MVME_SPEC }, \
1435 { "link_os_sim", LINK_OS_SIM_SPEC }, \
1436 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
1437 { "link_os_solaris", LINK_OS_SOLARIS_SPEC }, \
1438 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
1439 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
1440 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
1441 { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
1442 { "cpp_endian_big", CPP_ENDIAN_BIG_SPEC }, \
1443 { "cpp_endian_little", CPP_ENDIAN_LITTLE_SPEC }, \
1444 { "cpp_endian_solaris", CPP_ENDIAN_SOLARIS_SPEC }, \
1445 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
1446 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
1447 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
1448 { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
1449 { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
1450 { "cpp_os_solaris", CPP_OS_SOLARIS_SPEC }, \
1451 { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
1452
1453 /* Define this macro as a C expression for the initializer of an
1454 array of string to tell the driver program which options are
1455 defaults for this target and thus do not need to be handled
1456 specially when using `MULTILIB_OPTIONS'.
1457
1458 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
1459 the target makefile fragment or if none of the options listed in
1460 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
1461
1462 #undef MULTILIB_DEFAULTS
1463 #define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
1464
1465 /* Define this macro if the code for function profiling should come
1466 before the function prologue. Normally, the profiling code comes
1467 after. */
1468 #define PROFILE_BEFORE_PROLOGUE 1
1469
1470 /* Function name to call to do profiling. */
1471 #undef RS6000_MCOUNT
1472 #define RS6000_MCOUNT "_mcount"