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