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