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