OSDN Git Service

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