OSDN Git Service

* config/i386/att.h: Fix comment formatting.
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / osfrose.h
1 /* Definitions of target machine for GNU compiler.
2    Intel 386 (OSF/1 with OSF/rose) version.
3    Copyright (C) 1991, 1992, 1993, 1996, 1998, 1999, 2000
4    Free Software Foundation, Inc.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 #include "halfpic.h"
24 #include "i386/gstabs.h"
25
26 #define OSF_OS
27
28 #undef  WORD_SWITCH_TAKES_ARG
29 #define WORD_SWITCH_TAKES_ARG(STR)                                      \
30  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
31
32 /* This defines which switch letters take arguments.  On svr4, most of
33    the normal cases (defined in gcc.c) apply, and we also have -h* and
34    -z* options (for the linker).  */
35
36 #define SWITCH_TAKES_ARG(CHAR) \
37   (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
38    || (CHAR) == 'h' \
39    || (CHAR) == 'z')
40
41 #define MASK_HALF_PIC           010000000000    /* Mask for half-pic code */
42 #define MASK_HALF_PIC_DEBUG     004000000000    /* Debug flag */
43 #define MASK_ELF                002000000000    /* ELF not rose */
44 #define MASK_NO_UNDERSCORES     000400000000    /* suppress leading _ */
45 #define MASK_LARGE_ALIGN        000200000000    /* align to >word boundaries */
46 #define MASK_NO_MCOUNT          000100000000    /* profiling uses mcount_ptr */
47
48 #define TARGET_HALF_PIC         (target_flags & MASK_HALF_PIC)
49 #define TARGET_DEBUG            (target_flags & MASK_HALF_PIC_DEBUG)
50 #define HALF_PIC_DEBUG          TARGET_DEBUG
51 #define TARGET_ELF              (target_flags & MASK_ELF)
52 #define TARGET_ROSE             ((target_flags & MASK_ELF) == 0)
53 #define TARGET_UNDERSCORES      ((target_flags & MASK_NO_UNDERSCORES) == 0)
54 #define TARGET_LARGE_ALIGN      (target_flags & MASK_LARGE_ALIGN)
55 #define TARGET_MCOUNT           ((target_flags & MASK_NO_MCOUNT) == 0)
56
57 #undef  SUBTARGET_SWITCHES
58 #define SUBTARGET_SWITCHES                                              \
59      { "half-pic",               MASK_HALF_PIC,                         \
60        N_("Emit half-PIC code") },                                      \
61      { "no-half-pic",           -MASK_HALF_PIC, "" },                   \
62      { "debug-half-pic",         MASK_HALF_PIC_DEBUG,                   \
63        0 /* intentionally undoc */ },                                   \
64      { "debugb",                 MASK_HALF_PIC_DEBUG,                   \
65        0 /* intentionally undoc */ },                                   \
66      { "elf",                    MASK_ELF,                              \
67        N_("Emit ELF object code") },                                    \
68      { "rose",                  -MASK_ELF,                              \
69        N_("Emit ROSE object code") },                                   \
70      { "underscores",           -MASK_NO_UNDERSCORES,                   \
71        N_("Symbols have a leading underscore") },                       \
72      { "no-underscores",         MASK_NO_UNDERSCORES, "" },             \
73      { "large-align",            MASK_LARGE_ALIGN,                      \
74        N_("Align to >word boundaries") },                               \
75      { "no-large-align",        -MASK_LARGE_ALIGN, "" },                \
76      { "mcount",                -MASK_NO_MCOUNT,                        \
77        N_("Use mcount for profiling") },                                \
78      { "mcount-ptr",             MASK_NO_MCOUNT,                        \
79        N_("Use mcount_ptr for profiling") },                            \
80      { "no-mcount",              MASK_NO_MCOUNT, "" },
81
82 /* OSF/rose uses stabs, not dwarf.  */
83 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
84
85 #ifndef DWARF_DEBUGGING_INFO
86 #define DWARF_DEBUGGING_INFO    /* enable dwarf debugging for testing */
87 #endif
88
89 /* Handle #pragma weak and #pragma pack.  */
90
91 #define HANDLE_SYSV_PRAGMA
92 #define SUPPORTS_WEAK   TARGET_ELF
93
94 /* Change default predefines.  */
95 #undef  CPP_PREDEFINES
96 #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem=xpg4"
97
98 #undef  CPP_SPEC
99 #define CPP_SPEC "%(cpp_cpu) \
100 %{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
101 %{melf: -D__ELF__ %{fpic: -D__SHARED__}} \
102 %{mno-underscores: -D__NO_UNDERSCORES__} \
103 %{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
104 %{.S:   %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
105 %{.S:   -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
106 %{.cc:  -D__LANGUAGE_C_PLUS_PLUS} \
107 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
108 %{.C:   -D__LANGUAGE_C_PLUS_PLUS} \
109 %{.m:   -D__LANGUAGE_OBJECTIVE_C} \
110 %{!.S:  -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
111
112 /* Turn on -pic-extern by default for OSF/rose, -fpic for ELF.  */
113 #undef  CC1_SPEC
114 #define CC1_SPEC "%(cc1_cpu) \
115 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
116 %{!melf: %{!mrose: -mrose }} \
117 %{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \
118         %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \
119 %{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \
120          %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \
121          %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \
122          %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \
123          %{pic-calls: } %{pic-names*: }}"
124
125 #undef  ASM_SPEC
126 #define ASM_SPEC       "%{v*: -v}"
127
128 #undef  LINK_SPEC
129 #define LINK_SPEC      "%{v*: -v} \
130 %{!melf:        %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
131                 %{nostdlib} %{noshrlib} %{glue}} \
132 %{melf:         %{dy} %{dn} %{glue: } \
133                 %{h*} %{z*} \
134                 %{static:-dn -Bstatic} \
135                 %{shared:-G -dy} \
136                 %{symbolic:-Bsymbolic -G -dy} \
137                 %{G:-G} \
138                 %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
139                         %{noshrlib: -dn } %{pic-none: -dn } \
140                         %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
141
142 #undef  LIB_SPEC
143 #define LIB_SPEC "-lc"
144
145 #undef  LIBG_SPEC
146 #define LIBG_SPEC ""
147
148 #undef  STARTFILE_SPEC
149 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
150
151 #undef TARGET_VERSION_INTERNAL
152 #undef TARGET_VERSION
153
154 #define I386_VERSION " 80386, OSF/rose objects"
155
156 #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
157 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
158
159 #undef  MD_EXEC_PREFIX
160 #define MD_EXEC_PREFIX          "/usr/ccs/gcc/"
161
162 #undef  MD_STARTFILE_PREFIX
163 #define MD_STARTFILE_PREFIX     "/usr/ccs/lib/"
164
165 /* Specify size_t, ptrdiff_t, and wchar_t types.  */
166 #undef  SIZE_TYPE
167 #undef  PTRDIFF_TYPE
168 #undef  WCHAR_TYPE
169 #undef  WCHAR_TYPE_SIZE
170
171 #define SIZE_TYPE       "long unsigned int"
172 #define PTRDIFF_TYPE    "int"
173 #define WCHAR_TYPE      "unsigned int"
174 #define WCHAR_TYPE_SIZE BITS_PER_WORD
175
176 /* Define this macro if the system header files support C++ as well
177    as C.  This macro inhibits the usual method of using system header
178    files in C++, which is to pretend that the file's contents are
179    enclosed in `extern "C" {...}'.  */
180 #define NO_IMPLICIT_EXTERN_C
181
182 /* Turn off long double being 96 bits.  */
183 #undef LONG_DOUBLE_TYPE_SIZE
184 #define LONG_DOUBLE_TYPE_SIZE 64
185
186 #define OSF_PROFILE_BEFORE_PROLOGUE                                     \
187   (!TARGET_MCOUNT                                                       \
188    && !current_function_needs_context                                   \
189    && (!flag_pic                                                        \
190        || !frame_pointer_needed                                         \
191        || (!current_function_uses_pic_offset_table                      \
192            && !current_function_uses_const_pool)))
193
194 /* A C statement or compound statement to output to FILE some assembler code to
195    call the profiling subroutine `mcount'.  Before calling, the assembler code
196    must load the address of a counter variable into a register where `mcount'
197    expects to find the address.  The name of this variable is `LP' followed by
198    the number LABELNO, so you would generate the name using `LP%d' in a
199    `fprintf'.
200
201    The details of how the address should be passed to `mcount' are determined
202    by your operating system environment, not by GNU CC.  To figure them out,
203    compile a small program for profiling using the system's installed C
204    compiler and look at the assembler code that results.  */
205
206 #undef  FUNCTION_PROFILER
207 #define FUNCTION_PROFILER(FILE, LABELNO)                                \
208 do                                                                      \
209   {                                                                     \
210     if (!OSF_PROFILE_BEFORE_PROLOGUE)                                   \
211       {                                                                 \
212         const char *const prefix = (TARGET_UNDERSCORES) ? "_" : "";     \
213         const char *const lprefix = LPREFIX;                            \
214         int labelno = LABELNO;                                          \
215                                                                         \
216         /* Note that OSF/rose blew it in terms of calling mcount,       \
217            since OSF/rose prepends a leading underscore, but mcount's   \
218            doesn't.  At present, we keep this kludge for ELF as well    \
219            to allow old kernels to build profiling.  */                 \
220                                                                         \
221         if (flag_pic                                                    \
222             && !current_function_uses_pic_offset_table                  \
223             && !current_function_uses_const_pool)                       \
224           abort ();                                                     \
225                                                                         \
226         if (TARGET_MCOUNT && flag_pic)                                  \
227           {                                                             \
228             fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",        \
229                      lprefix, labelno);                                 \
230             fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix);    \
231           }                                                             \
232                                                                         \
233         else if (TARGET_MCOUNT && HALF_PIC_P ())                        \
234           {                                                             \
235             rtx symdef;                                                 \
236                                                                         \
237             HALF_PIC_EXTERNAL ("mcount");                               \
238             symdef = HALF_PIC_PTR (gen_rtx_SYMBOL_REF (Pmode, "mcount")); \
239             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
240             fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \
241           }                                                             \
242                                                                         \
243         else if (TARGET_MCOUNT)                                         \
244           {                                                             \
245             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
246             fprintf (FILE, "\tcall %smcount\n", prefix);                \
247           }                                                             \
248                                                                         \
249         else if (flag_pic && frame_pointer_needed)                      \
250           {                                                             \
251             fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");                  \
252             fprintf (FILE, "\tpushl %%ecx\n");                          \
253             fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",        \
254                      lprefix, labelno);                                 \
255             fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n");    \
256             fprintf (FILE, "\tcall *(%%eax)\n");                        \
257             fprintf (FILE, "\tpopl %%eax\n");                           \
258           }                                                             \
259                                                                         \
260         else if (frame_pointer_needed)                                  \
261           {                                                             \
262             fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");                  \
263             fprintf (FILE, "\tpushl %%ecx\n");                          \
264             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
265             fprintf (FILE, "\tcall *_mcount_ptr\n");                    \
266             fprintf (FILE, "\tpopl %%eax\n");                           \
267           }                                                             \
268                                                                         \
269         else                                                            \
270           abort ();                                                     \
271       }                                                                 \
272   }                                                                     \
273 while (0)
274
275 /* A C function or functions which are needed in the library to
276    support block profiling.  When support goes into libc, undo
277    the #if 0.  */
278
279 #if 0
280 #undef  BLOCK_PROFILING_CODE
281 #define BLOCK_PROFILING_CODE
282 #endif
283
284 /* Prefix for internally generated assembler labels.  If we aren't using
285    underscores, we are using prefix `.'s to identify labels that should
286    be ignored, as in `i386/gas.h' --karl@cs.umb.edu  */
287 #undef  LPREFIX
288 #define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
289
290 /* This is how to store into the string BUF
291    the symbol_ref name of an internal numbered label where
292    PREFIX is the class of label and NUM is the number within the class.
293    This is suitable for output with `assemble_name'.  */
294
295 #undef  ASM_GENERATE_INTERNAL_LABEL
296 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)                  \
297     sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".",         \
298              (PREFIX), (NUMBER))
299
300 /* This is how to output an internal numbered label where
301    PREFIX is the class of label and NUM is the number within the class.  */
302
303 #undef  ASM_OUTPUT_INTERNAL_LABEL
304 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                      \
305   fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".",          \
306            PREFIX, NUM)
307
308 /* The prefix to add to user-visible assembler symbols.  */
309
310 /* target_flags is not accessible by the preprocessor */
311 #undef USER_LABEL_PREFIX
312 #define USER_LABEL_PREFIX "_"
313
314 /* This is how to output a reference to a user-level label named NAME.  */
315
316 #undef  ASM_OUTPUT_LABELREF
317 #define ASM_OUTPUT_LABELREF(FILE,NAME)                                  \
318   fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
319
320 /* This is how to output an element of a case-vector that is relative.
321    This is only used for PIC code.  See comments by the `casesi' insn in
322    i386.md for an explanation of the expression this outputs.  */
323
324 #undef ASM_OUTPUT_ADDR_DIFF_ELT
325 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
326   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
327
328 /* Output a definition */
329 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
330 do                                                                      \
331 {                                                                       \
332     fprintf ((FILE), "%s", SET_ASM_OP);                                 \
333     assemble_name (FILE, LABEL1);                                       \
334     fprintf (FILE, ",");                                                \
335     assemble_name (FILE, LABEL2);                                       \
336     fprintf (FILE, "\n");                                               \
337     }                                                                   \
338 while (0)
339
340 /* A C expression to output text to align the location counter in the
341    way that is desirable at a point in the code that is reached only
342    by jumping.
343
344    This macro need not be defined if you don't want any special
345    alignment to be done at such a time.  Most machine descriptions do
346    not currently define the macro.  */
347
348 #undef  LABEL_ALIGN_AFTER_BARRIER
349 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
350   ((!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
351
352 /* A C expression to output text to align the location counter in the
353    way that is desirable at the beginning of a loop.
354
355    This macro need not be defined if you don't want any special
356    alignment to be done at such a time.  Most machine descriptions do
357    not currently define the macro.  */
358
359 #undef  LOOP_ALIGN
360 #define LOOP_ALIGN(LABEL) (i386_align_loops)
361
362 /* A C statement to output to the stdio stream STREAM an assembler
363    command to advance the location counter to a multiple of 2 to the
364    POWER bytes.  POWER will be a C expression of type `int'.  */
365
366 #undef  ASM_OUTPUT_ALIGN
367 #define ASM_OUTPUT_ALIGN(STREAM, POWER)                                 \
368   fprintf (STREAM, "\t.align\t%d\n",                                    \
369            (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
370
371 /* A C expression that is 1 if the RTX X is a constant which is a
372    valid address.  On most machines, this can be defined as
373    `CONSTANT_P (X)', but a few machines are more restrictive in
374    which constant addresses are supported.
375
376    `CONSTANT_P' accepts integer-values expressions whose values are
377    not explicitly known, such as `symbol_ref', `label_ref', and
378    `high' expressions and `const' arithmetic expressions, in
379    addition to `const_int' and `const_double' expressions.  */
380
381 #define CONSTANT_ADDRESS_P_ORIG(X)                                      \
382   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
383    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST                \
384    || GET_CODE (X) == HIGH)
385
386 #undef  CONSTANT_ADDRESS_P
387 #define CONSTANT_ADDRESS_P(X)                                           \
388   ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
389
390 /* Nonzero if the constant value X is a legitimate general operand.
391    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
392
393 #undef  LEGITIMATE_CONSTANT_P
394 #define LEGITIMATE_CONSTANT_P(X)                                        \
395   (!HALF_PIC_P ()                                                       \
396    || GET_CODE (X) == CONST_DOUBLE                                      \
397    || GET_CODE (X) == CONST_INT                                         \
398    || !HALF_PIC_ADDRESS_P (X))
399
400 /* Sometimes certain combinations of command options do not make sense
401    on a particular target machine.  You can define a macro
402    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
403    defined, is executed once just after all the command options have
404    been parsed.  */
405
406 #undef  SUBTARGET_OVERRIDE_OPTIONS
407 #define SUBTARGET_OVERRIDE_OPTIONS                                      \
408 {                                                                       \
409   /*                                                                    \
410   if (TARGET_ELF && TARGET_HALF_PIC)                                    \
411     {                                                                   \
412       target_flags &= ~MASK_HALF_PIC;                                   \
413       flag_pic = 1;                                                     \
414     }                                                                   \
415   */                                                                    \
416                                                                         \
417   if (TARGET_ROSE && flag_pic)                                          \
418     {                                                                   \
419       target_flags |= MASK_HALF_PIC;                                    \
420       flag_pic = 0;                                                     \
421     }                                                                   \
422                                                                         \
423   if (TARGET_HALF_PIC)                                                  \
424     half_pic_init ();                                                   \
425 }
426
427 /* Define this macro if references to a symbol must be treated
428    differently depending on something about the variable or
429    function named by the symbol (such as what section it is in).
430
431    The macro definition, if any, is executed immediately after the
432    rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
433    The value of the rtl will be a `mem' whose address is a
434    `symbol_ref'.
435
436    The usual thing for this macro to do is to a flag in the
437    `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
438    name string in the `symbol_ref' (if one bit is not enough
439    information).
440
441    The best way to modify the name string is by adding text to the
442    beginning, with suitable punctuation to prevent any ambiguity.
443    Allocate the new name in `saveable_obstack'.  You will have to
444    modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
445    and output the name accordingly.
446
447    You can also check the information stored in the `symbol_ref' in
448    the definition of `GO_IF_LEGITIMATE_ADDRESS' or
449    `PRINT_OPERAND_ADDRESS'.  */
450
451 #undef  ENCODE_SECTION_INFO
452 #define ENCODE_SECTION_INFO(DECL)                                       \
453 do                                                                      \
454   {                                                                     \
455    if (HALF_PIC_P ())                                                   \
456       HALF_PIC_ENCODE (DECL);                                           \
457                                                                         \
458    else if (flag_pic)                                                   \
459      {                                                                  \
460        rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'             \
461                   ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));             \
462        SYMBOL_REF_FLAG (XEXP (rtl, 0))                                  \
463          = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'                   \
464             || ! TREE_PUBLIC (DECL));                                   \
465       }                                                                 \
466   }                                                                     \
467 while (0)
468
469
470 /* On most machines, read-only variables, constants, and jump tables
471    are placed in the text section.  If this is not the case on your
472    machine, this macro should be defined to be the name of a function
473    (either `data_section' or a function defined in `EXTRA_SECTIONS')
474    that switches to the section to be used for read-only items.
475
476    If these items should be placed in the text section, this macro
477    should not be defined.  */
478
479 #if 0
480 #undef  READONLY_DATA_SECTION
481 #define READONLY_DATA_SECTION()                                         \
482 do                                                                      \
483   {                                                                     \
484     if (TARGET_ELF)                                                     \
485       {                                                                 \
486         if (in_section != in_rodata)                                    \
487           {                                                             \
488             fprintf (asm_out_file, "\t.section \"rodata\"\n");          \
489             in_section = in_rodata;                                     \
490           }                                                             \
491       }                                                                 \
492     else                                                                \
493       text_section ();                                                  \
494   }                                                                     \
495 while (0)
496 #endif
497
498 /* A list of names for sections other than the standard two, which are
499    `in_text' and `in_data'.  You need not define this macro on a
500    system with no other sections (that GCC needs to use).  */
501
502 #undef  EXTRA_SECTIONS
503 #define EXTRA_SECTIONS in_rodata, in_data1
504
505 /* Given a decl node or constant node, choose the section to output it in
506    and select that section.  */
507
508 #undef  SELECT_RTX_SECTION
509 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN)                            \
510 do                                                                      \
511   {                                                                     \
512     if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX))     \
513       data_section ();                                                  \
514     else                                                                \
515       readonly_data_section ();                                         \
516   }                                                                     \
517 while (0)
518
519 #undef  SELECT_SECTION
520 #define SELECT_SECTION(DECL, RELOC, ALIGN)                              \
521 {                                                                       \
522   if (RELOC && HALF_PIC_P ())                                           \
523     data_section ();                                                    \
524                                                                         \
525   else if (TREE_CODE (DECL) == STRING_CST)                              \
526     {                                                                   \
527       if (flag_writable_strings)                                        \
528         data_section ();                                                \
529       else                                                              \
530         readonly_data_section ();                                       \
531     }                                                                   \
532                                                                         \
533   else if (TREE_CODE (DECL) != VAR_DECL)                                \
534     readonly_data_section ();                                           \
535                                                                         \
536   else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)            \
537            || !DECL_INITIAL (DECL)                                      \
538            || (DECL_INITIAL (DECL) != error_mark_node                   \
539                && !TREE_CONSTANT (DECL_INITIAL (DECL))))                \
540     data_section ();                                                    \
541                                                                         \
542   else                                                                  \
543     readonly_data_section ();                                           \
544 }
545
546
547 /* Define the strings used for the special svr4 .type and .size directives.
548    These strings generally do not vary from one system running svr4 to
549    another, but if a given system (e.g. m88k running svr) needs to use
550    different pseudo-op names for these, they may be overridden in the
551    file which includes this one.  */
552
553 #define TYPE_ASM_OP     "\t.type\t"
554 #define SIZE_ASM_OP     "\t.size\t"
555 #define SET_ASM_OP      "\t.set\t"
556
557 /* This is how we tell the assembler that a symbol is weak.  */
558
559 #define ASM_WEAKEN_LABEL(FILE,NAME) \
560   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
561        fputc ('\n', FILE); } while (0)
562
563 /* The following macro defines the format used to output the second
564    operand of the .type assembler directive.  Different svr4 assemblers
565    expect various different forms for this operand.  The one given here
566    is just a default.  You may need to override it in your machine-
567    specific tm.h file (depending upon the particulars of your assembler).  */
568
569 #define TYPE_OPERAND_FMT        "@%s"
570
571 /* A C statement (sans semicolon) to output to the stdio stream
572    STREAM any text necessary for declaring the name NAME of an
573    initialized variable which is being defined.  This macro must
574    output the label definition (perhaps using `ASM_OUTPUT_LABEL').
575    The argument DECL is the `VAR_DECL' tree node representing the
576    variable.
577
578    If this macro is not defined, then the variable name is defined
579    in the usual manner as a label (by means of `ASM_OUTPUT_LABEL').  */
580
581 #undef  ASM_DECLARE_OBJECT_NAME
582 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                          \
583 do                                                                           \
584  {                                                                           \
585    ASM_OUTPUT_LABEL(STREAM,NAME);                                            \
586    HALF_PIC_DECLARE (NAME);                                                  \
587    if (TARGET_ELF)                                                           \
588      {                                                                       \
589        fprintf (STREAM, "%s", TYPE_ASM_OP);                                 \
590        assemble_name (STREAM, NAME);                                         \
591        putc (',', STREAM);                                                   \
592        fprintf (STREAM, TYPE_OPERAND_FMT, "object");                         \
593        putc ('\n', STREAM);                                                  \
594        size_directive_output = 0;                                            \
595        if (!flag_inhibit_size_directive && DECL_SIZE (DECL))                 \
596          {                                                                   \
597            size_directive_output = 1;                                        \
598            fprintf (STREAM, "%s", SIZE_ASM_OP);                              \
599            assemble_name (STREAM, NAME);                                     \
600            fprintf (STREAM, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
601          }                                                                   \
602      }                                                                       \
603  }                                                                           \
604 while (0)
605
606 /* Output the size directive for a decl in rest_of_decl_compilation
607    in the case where we did not do so before the initializer.
608    Once we find the error_mark_node, we know that the value of
609    size_directive_output was set
610    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
611
612 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)         \
613 do {                                                                     \
614      const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);             \
615      if (TARGET_ELF                                                      \
616          && !flag_inhibit_size_directive && DECL_SIZE (DECL)             \
617          && ! AT_END && TOP_LEVEL                                        \
618          && DECL_INITIAL (DECL) == error_mark_node                       \
619          && !size_directive_output)                                      \
620        {                                                                 \
621          fprintf (FILE, "%s", SIZE_ASM_OP);                              \
622          assemble_name (FILE, name);                                     \
623          fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
624        }                                                                 \
625    } while (0)
626
627 /* This is how to declare a function name.  */
628
629 #undef  ASM_DECLARE_FUNCTION_NAME
630 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)                     \
631 do                                                                      \
632  {                                                                      \
633    ASM_OUTPUT_LABEL(STREAM,NAME);                                       \
634    HALF_PIC_DECLARE (NAME);                                             \
635    if (TARGET_ELF)                                                      \
636      {                                                                  \
637        fprintf (STREAM, "%s", TYPE_ASM_OP);                             \
638        assemble_name (STREAM, NAME);                                    \
639        putc (',', STREAM);                                              \
640        fprintf (STREAM, TYPE_OPERAND_FMT, "function");                  \
641        putc ('\n', STREAM);                                             \
642        ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL));                 \
643      }                                                                  \
644  }                                                                      \
645 while (0)
646
647 /* Write the extra assembler code needed to declare a function's result.
648    Most svr4 assemblers don't require any special declaration of the
649    result value, but there are exceptions.  */
650
651 #ifndef ASM_DECLARE_RESULT
652 #define ASM_DECLARE_RESULT(FILE, RESULT)
653 #endif
654
655 /* This is how to declare the size of a function.  */
656
657 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
658 do                                                                      \
659   {                                                                     \
660     if (TARGET_ELF && !flag_inhibit_size_directive)                     \
661       {                                                                 \
662         char label[256];                                                \
663         static int labelno;                                             \
664         labelno++;                                                      \
665         ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
666         ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
667         fprintf (FILE, "%s", SIZE_ASM_OP);                              \
668         assemble_name (FILE, (FNAME));                                  \
669         fprintf (FILE, ",");                                            \
670         assemble_name (FILE, label);                                    \
671         fprintf (FILE, "-");                                            \
672         assemble_name (FILE, (FNAME));                                  \
673         putc ('\n', FILE);                                              \
674       }                                                                 \
675   }                                                                     \
676 while (0)
677
678 #define IDENT_ASM_OP "\t.ident\t"
679
680 /* Allow #sccs in preprocessor.  */
681
682 #define SCCS_DIRECTIVE
683
684 /* This says what to print at the end of the assembly file */
685 #undef ASM_FILE_END
686 #define ASM_FILE_END(STREAM)                                            \
687 do                                                                      \
688   {                                                                     \
689     if (HALF_PIC_P ())                                                  \
690       HALF_PIC_FINISH (STREAM);                                         \
691     ix86_asm_file_end (STREAM);                                         \
692   }                                                                     \
693 while (0)
694
695 /* Tell collect that the object format is OSF/rose.  */
696 #define OBJECT_FORMAT_ROSE
697
698 /* Tell collect where the appropriate binaries are.  */
699 #define REAL_NM_FILE_NAME       "/usr/ccs/gcc/bfd-nm"
700 #define REAL_STRIP_FILE_NAME    "/usr/ccs/bin/strip"
701
702 /* Define this macro meaning that gcc should find the library 'libgcc.a'
703    by hand, rather than passing the argument '-lgcc' to tell the linker
704    to do the search */
705 #define LINK_LIBGCC_SPECIAL
706
707 /* Generate calls to memcpy, etc., not bcopy, etc.  */
708 #define TARGET_MEM_FUNCTIONS
709
710 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
711    we want to retain compatibility with older gcc versions.  */
712 #define DEFAULT_PCC_STRUCT_RETURN 0
713
714 /* Map i386 registers to the numbers dwarf expects.  Of course this is
715    different from what stabs expects.  */
716
717 #undef  DBX_REGISTER_NUMBER
718 #define DBX_REGISTER_NUMBER(n)  ((write_symbols == DWARF_DEBUG) \
719                                  ? svr4_dbx_register_map[n]     \
720                                  : dbx_register_map[n])