OSDN Git Service

* gbl-ctors.h: Lose HAVE_ATEXIT. Don't define ON_EXIT.
[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, 92, 93, 96, 98, 1999 Free Software Foundation, Inc.
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 #include "halfpic.h"
23 #include "i386/gstabs.h"
24
25 /* Get perform_* macros to build libgcc.a.  */
26 #include "i386/perform.h"
27
28 #define OSF_OS
29
30 #undef  WORD_SWITCH_TAKES_ARG
31 #define WORD_SWITCH_TAKES_ARG(STR)                                      \
32  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
33
34 /* This defines which switch letters take arguments.  On svr4, most of
35    the normal cases (defined in gcc.c) apply, and we also have -h* and
36    -z* options (for the linker).  */
37
38 #define SWITCH_TAKES_ARG(CHAR) \
39   (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
40    || (CHAR) == 'h' \
41    || (CHAR) == 'z')
42
43 #define MASK_HALF_PIC           010000000000    /* Mask for half-pic code */
44 #define MASK_HALF_PIC_DEBUG     004000000000    /* Debug flag */
45 #define MASK_ELF                002000000000    /* ELF not rose */
46 #define MASK_NO_UNDERSCORES     000400000000    /* suppress leading _ */
47 #define MASK_LARGE_ALIGN        000200000000    /* align to >word boundaries */
48 #define MASK_NO_MCOUNT          000100000000    /* profiling uses mcount_ptr */
49
50 #define TARGET_HALF_PIC         (target_flags & MASK_HALF_PIC)
51 #define TARGET_DEBUG            (target_flags & MASK_HALF_PIC_DEBUG)
52 #define HALF_PIC_DEBUG          TARGET_DEBUG
53 #define TARGET_ELF              (target_flags & MASK_ELF)
54 #define TARGET_ROSE             ((target_flags & MASK_ELF) == 0)
55 #define TARGET_UNDERSCORES      ((target_flags & MASK_NO_UNDERSCORES) == 0)
56 #define TARGET_LARGE_ALIGN      (target_flags & MASK_LARGE_ALIGN)
57 #define TARGET_MCOUNT           ((target_flags & MASK_NO_MCOUNT) == 0)
58
59 #undef  SUBTARGET_SWITCHES
60 #define SUBTARGET_SWITCHES                                              \
61      { "half-pic",               MASK_HALF_PIC, "Emit half-PIC code" },                 \
62      { "no-half-pic",           -MASK_HALF_PIC, "" }                    \
63      { "debug-half-pic",         MASK_HALF_PIC_DEBUG, 0 /* intentionally undoc */ },                    \
64      { "debugb",                 MASK_HALF_PIC_DEBUG, 0 /* intentionally undoc */ },                    \
65      { "elf",                    MASK_ELF, "Emit ELF object code" },                            \
66      { "rose",                  -MASK_ELF, "Emit ROSE object code" },                           \
67      { "underscores",           -MASK_NO_UNDERSCORES, "Symbols have a leading underscore" },                    \
68      { "no-underscores",         MASK_NO_UNDERSCORES, "" },                     \
69      { "large-align",            MASK_LARGE_ALIGN, "Align to >word boundaries" },                       \
70      { "no-large-align",        -MASK_LARGE_ALIGN, "" },                        \
71      { "mcount",                -MASK_NO_MCOUNT, "Use mcount for profiling" },                  \
72      { "mcount-ptr",             MASK_NO_MCOUNT, "Use mcount_ptr for profiling" },                      \
73      { "no-mcount",              MASK_NO_MCOUNT, "" },
74
75 /* OSF/rose uses stabs, not dwarf.  */
76 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
77
78 #ifndef DWARF_DEBUGGING_INFO
79 #define DWARF_DEBUGGING_INFO    /* enable dwarf debugging for testing */
80 #endif
81
82 /* Handle #pragma weak and #pragma pack.  */
83
84 #define HANDLE_SYSV_PRAGMA
85 #define SUPPORTS_WEAK   TARGET_ELF
86
87 /* Change default predefines.  */
88 #undef  CPP_PREDEFINES
89 #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)"
90
91 #undef  CPP_SPEC
92 #define CPP_SPEC "%(cpp_cpu) \
93 %{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
94 %{melf: -D__ELF__ %{fpic: -D__SHARED__}} \
95 %{mno-underscores: -D__NO_UNDERSCORES__} \
96 %{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
97 %{.S:   %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
98 %{.S:   -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
99 %{.cc:  -D__LANGUAGE_C_PLUS_PLUS} \
100 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
101 %{.C:   -D__LANGUAGE_C_PLUS_PLUS} \
102 %{.m:   -D__LANGUAGE_OBJECTIVE_C} \
103 %{!.S:  -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
104
105 /* Turn on -pic-extern by default for OSF/rose, -fpic for ELF.  */
106 #undef  CC1_SPEC
107 #define CC1_SPEC "\
108 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
109 %{!melf: %{!mrose: -mrose }} \
110 %{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \
111         %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \
112 %{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \
113          %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \
114          %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \
115          %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \
116          %{pic-calls: } %{pic-names*: }}"
117
118 #undef  ASM_SPEC
119 #define ASM_SPEC       "%{v*: -v}"
120
121 #undef  LINK_SPEC
122 #define LINK_SPEC      "%{v*: -v} \
123 %{!melf:        %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
124                 %{nostdlib} %{noshrlib} %{glue}} \
125 %{melf:         %{dy} %{dn} %{glue: } \
126                 %{h*} %{z*} \
127                 %{static:-dn -Bstatic} \
128                 %{shared:-G -dy} \
129                 %{symbolic:-Bsymbolic -G -dy} \
130                 %{G:-G} \
131                 %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
132                         %{noshrlib: -dn } %{pic-none: -dn } \
133                         %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
134
135 #undef  LIB_SPEC
136 #define LIB_SPEC "-lc"
137
138 #undef  LIBG_SPEC
139 #define LIBG_SPEC ""
140
141 #undef  STARTFILE_SPEC
142 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
143
144 #undef TARGET_VERSION_INTERNAL
145 #undef TARGET_VERSION
146
147 #define I386_VERSION " 80386, OSF/rose objects"
148
149 #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
150 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
151
152 #undef  MD_EXEC_PREFIX
153 #define MD_EXEC_PREFIX          "/usr/ccs/gcc/"
154
155 #undef  MD_STARTFILE_PREFIX
156 #define MD_STARTFILE_PREFIX     "/usr/ccs/lib/"
157
158 /* Specify size_t, ptrdiff_t, and wchar_t types.  */
159 #undef  SIZE_TYPE
160 #undef  PTRDIFF_TYPE
161 #undef  WCHAR_TYPE
162 #undef  WCHAR_TYPE_SIZE
163
164 #define SIZE_TYPE       "long unsigned int"
165 #define PTRDIFF_TYPE    "int"
166 #define WCHAR_TYPE      "unsigned int"
167 #define WCHAR_TYPE_SIZE BITS_PER_WORD
168
169 /* Define this macro if the system header files support C++ as well
170    as C.  This macro inhibits the usual method of using system header
171    files in C++, which is to pretend that the file's contents are
172    enclosed in `extern "C" {...}'. */
173 #define NO_IMPLICIT_EXTERN_C
174
175 /* Turn off long double being 96 bits.  */
176 #undef LONG_DOUBLE_TYPE_SIZE
177 #define LONG_DOUBLE_TYPE_SIZE 64
178
179 /* This macro generates the assembly code for function entry.
180    FILE is a stdio stream to output the code to.
181    SIZE is an int: how many units of temporary storage to allocate.
182    Refer to the array `regs_ever_live' to determine which registers
183    to save; `regs_ever_live[I]' is nonzero if register number I
184    is ever used in the function.  This macro is responsible for
185    knowing which registers should not be saved even if used.
186
187    We override it here to allow for the new profiling code to go before
188    the prologue and the old mcount code to go after the prologue (and
189    after %ebx has been set up for ELF shared library support).  */
190
191 #define OSF_PROFILE_BEFORE_PROLOGUE                                     \
192   (!TARGET_MCOUNT                                                       \
193    && !current_function_needs_context                                   \
194    && (!flag_pic                                                        \
195        || !frame_pointer_needed                                         \
196        || (!current_function_uses_pic_offset_table                      \
197            && !current_function_uses_const_pool)))
198
199 #undef  FUNCTION_PROLOGUE
200 #define FUNCTION_PROLOGUE(FILE, SIZE)                                   \
201 do                                                                      \
202   {                                                                     \
203     char *prefix = (TARGET_UNDERSCORES) ? "_" : "";                     \
204     char *lprefix = LPREFIX;                                            \
205     int labelno = profile_label_no;                                     \
206                                                                         \
207     if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)                    \
208       {                                                                 \
209         if (!flag_pic && !HALF_PIC_P ())                                \
210           {                                                             \
211             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
212             fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix);          \
213           }                                                             \
214                                                                         \
215         else if (HALF_PIC_P ())                                         \
216           {                                                             \
217             rtx symref;                                                 \
218                                                                         \
219             HALF_PIC_EXTERNAL ("_mcount_ptr");                          \
220             symref = HALF_PIC_PTR (gen_rtx_SYMBOL_REF (Pmode,           \
221                                                        "_mcount_ptr")); \
222                                                                         \
223             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
224             fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix,               \
225                      XSTR (symref, 0));                                 \
226             fprintf (FILE, "\tcall *(%%eax)\n");                        \
227           }                                                             \
228                                                                         \
229         else                                                            \
230           {                                                             \
231             static int call_no = 0;                                     \
232                                                                         \
233             fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no);        \
234             fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no);  \
235             fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \
236                      lprefix, call_no++);                               \
237             fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n",        \
238                      lprefix, labelno);                                 \
239             fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n",   \
240                      prefix);                                           \
241             fprintf (FILE, "\tcall *(%%eax)\n");                        \
242           }                                                             \
243       }                                                                 \
244                                                                         \
245     function_prologue (FILE, SIZE);                                     \
246   }                                                                     \
247 while (0)
248
249 /* A C statement or compound statement to output to FILE some assembler code to
250    call the profiling subroutine `mcount'.  Before calling, the assembler code
251    must load the address of a counter variable into a register where `mcount'
252    expects to find the address.  The name of this variable is `LP' followed by
253    the number LABELNO, so you would generate the name using `LP%d' in a
254    `fprintf'.
255
256    The details of how the address should be passed to `mcount' are determined
257    by your operating system environment, not by GNU CC.  To figure them out,
258    compile a small program for profiling using the system's installed C
259    compiler and look at the assembler code that results. */
260
261 #undef  FUNCTION_PROFILER
262 #define FUNCTION_PROFILER(FILE, LABELNO)                                \
263 do                                                                      \
264   {                                                                     \
265     if (!OSF_PROFILE_BEFORE_PROLOGUE)                                   \
266       {                                                                 \
267         char *prefix = (TARGET_UNDERSCORES) ? "_" : "";                 \
268         char *lprefix = LPREFIX;                                        \
269         int labelno = LABELNO;                                          \
270                                                                         \
271         /* Note that OSF/rose blew it in terms of calling mcount,       \
272            since OSF/rose prepends a leading underscore, but mcount's   \
273            doesn't.  At present, we keep this kludge for ELF as well    \
274            to allow old kernels to build profiling.  */                 \
275                                                                         \
276         if (flag_pic                                                    \
277             && !current_function_uses_pic_offset_table                  \
278             && !current_function_uses_const_pool)                       \
279           abort ();                                                     \
280                                                                         \
281         if (TARGET_MCOUNT && flag_pic)                                  \
282           {                                                             \
283             fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",        \
284                      lprefix, labelno);                                 \
285             fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix);    \
286           }                                                             \
287                                                                         \
288         else if (TARGET_MCOUNT && HALF_PIC_P ())                        \
289           {                                                             \
290             rtx symdef;                                                 \
291                                                                         \
292             HALF_PIC_EXTERNAL ("mcount");                               \
293             symdef = HALF_PIC_PTR (gen_rtx_SYMBOL_REF (Pmode, "mcount")); \
294             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
295             fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \
296           }                                                             \
297                                                                         \
298         else if (TARGET_MCOUNT)                                         \
299           {                                                             \
300             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
301             fprintf (FILE, "\tcall %smcount\n", prefix);                \
302           }                                                             \
303                                                                         \
304         else if (flag_pic && frame_pointer_needed)                      \
305           {                                                             \
306             fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");                  \
307             fprintf (FILE, "\tpushl %%ecx\n");                          \
308             fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",        \
309                      lprefix, labelno);                                 \
310             fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n");    \
311             fprintf (FILE, "\tcall *(%%eax)\n");                        \
312             fprintf (FILE, "\tpopl %%eax\n");                           \
313           }                                                             \
314                                                                         \
315         else if (frame_pointer_needed)                                  \
316           {                                                             \
317             fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");                  \
318             fprintf (FILE, "\tpushl %%ecx\n");                          \
319             fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
320             fprintf (FILE, "\tcall *_mcount_ptr\n");                    \
321             fprintf (FILE, "\tpopl %%eax\n");                           \
322           }                                                             \
323                                                                         \
324         else                                                            \
325           abort ();                                                     \
326       }                                                                 \
327   }                                                                     \
328 while (0)
329
330 /* A C function or functions which are needed in the library to
331    support block profiling.  When support goes into libc, undo
332    the #if 0.  */
333
334 #if 0
335 #undef  BLOCK_PROFILING_CODE
336 #define BLOCK_PROFILING_CODE
337 #endif
338
339 /* Prefix for internally generated assembler labels.  If we aren't using
340    underscores, we are using prefix `.'s to identify labels that should
341    be ignored, as in `i386/gas.h' --karl@cs.umb.edu  */
342 #undef  LPREFIX
343 #define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
344
345 /* This is how to store into the string BUF
346    the symbol_ref name of an internal numbered label where
347    PREFIX is the class of label and NUM is the number within the class.
348    This is suitable for output with `assemble_name'.  */
349
350 #undef  ASM_GENERATE_INTERNAL_LABEL
351 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)                  \
352     sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".",         \
353              (PREFIX), (NUMBER))
354
355 /* This is how to output an internal numbered label where
356    PREFIX is the class of label and NUM is the number within the class.  */
357
358 #undef  ASM_OUTPUT_INTERNAL_LABEL
359 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                      \
360   fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".",          \
361            PREFIX, NUM)
362
363 /* The prefix to add to user-visible assembler symbols. */
364
365 /* target_flags is not accessible by the preprocessor */
366 #undef USER_LABEL_PREFIX
367 #define USER_LABEL_PREFIX "_"
368
369 /* This is how to output a reference to a user-level label named NAME.  */
370
371 #undef  ASM_OUTPUT_LABELREF
372 #define ASM_OUTPUT_LABELREF(FILE,NAME)                                  \
373   fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
374
375 /* This is how to output an element of a case-vector that is relative.
376    This is only used for PIC code.  See comments by the `casesi' insn in
377    i386.md for an explanation of the expression this outputs. */
378
379 #undef ASM_OUTPUT_ADDR_DIFF_ELT
380 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
381   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
382
383 /* Output a definition */
384 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
385 do                                                                      \
386 {                                                                       \
387     fprintf ((FILE), "\t%s\t", SET_ASM_OP);                             \
388     assemble_name (FILE, LABEL1);                                       \
389     fprintf (FILE, ",");                                                \
390     assemble_name (FILE, LABEL2);                                       \
391     fprintf (FILE, "\n");                                               \
392     }                                                                   \
393 while (0)
394
395 /* A C expression to output text to align the location counter in the
396    way that is desirable at a point in the code that is reached only
397    by jumping.
398
399    This macro need not be defined if you don't want any special
400    alignment to be done at such a time.  Most machine descriptions do
401    not currently define the macro.  */
402
403 #undef  LABEL_ALIGN_AFTER_BARRIER
404 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
405   ((!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
406
407 /* A C expression to output text to align the location counter in the
408    way that is desirable at the beginning of a loop.
409
410    This macro need not be defined if you don't want any special
411    alignment to be done at such a time.  Most machine descriptions do
412    not currently define the macro.  */
413
414 #undef  LOOP_ALIGN
415 #define LOOP_ALIGN(LABEL) (i386_align_loops)
416
417 /* A C statement to output to the stdio stream STREAM an assembler
418    command to advance the location counter to a multiple of 2 to the
419    POWER bytes.  POWER will be a C expression of type `int'.  */
420
421 #undef  ASM_OUTPUT_ALIGN
422 #define ASM_OUTPUT_ALIGN(STREAM, POWER)                                 \
423   fprintf (STREAM, "\t.align\t%d\n",                                    \
424            (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
425
426 /* A C expression that is 1 if the RTX X is a constant which is a
427    valid address.  On most machines, this can be defined as
428    `CONSTANT_P (X)', but a few machines are more restrictive in
429    which constant addresses are supported.
430
431    `CONSTANT_P' accepts integer-values expressions whose values are
432    not explicitly known, such as `symbol_ref', `label_ref', and
433    `high' expressions and `const' arithmetic expressions, in
434    addition to `const_int' and `const_double' expressions.  */
435
436 #define CONSTANT_ADDRESS_P_ORIG(X)                                      \
437   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
438    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST                \
439    || GET_CODE (X) == HIGH)
440
441 #undef  CONSTANT_ADDRESS_P
442 #define CONSTANT_ADDRESS_P(X)                                           \
443   ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
444
445 /* Nonzero if the constant value X is a legitimate general operand.
446    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
447
448 #undef  LEGITIMATE_CONSTANT_P
449 #define LEGITIMATE_CONSTANT_P(X)                                        \
450   (!HALF_PIC_P ()                                                       \
451    || GET_CODE (X) == CONST_DOUBLE                                      \
452    || GET_CODE (X) == CONST_INT                                         \
453    || !HALF_PIC_ADDRESS_P (X))
454
455 /* Sometimes certain combinations of command options do not make sense
456    on a particular target machine.  You can define a macro
457    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
458    defined, is executed once just after all the command options have
459    been parsed.  */
460
461 #undef  SUBTARGET_OVERRIDE_OPTIONS
462 #define SUBTARGET_OVERRIDE_OPTIONS                                      \
463 {                                                                       \
464   /*                                                                    \
465   if (TARGET_ELF && TARGET_HALF_PIC)                                    \
466     {                                                                   \
467       target_flags &= ~MASK_HALF_PIC;                                   \
468       flag_pic = 1;                                                     \
469     }                                                                   \
470   */                                                                    \
471                                                                         \
472   if (TARGET_ROSE && flag_pic)                                          \
473     {                                                                   \
474       target_flags |= MASK_HALF_PIC;                                    \
475       flag_pic = 0;                                                     \
476     }                                                                   \
477                                                                         \
478   if (TARGET_HALF_PIC)                                                  \
479     half_pic_init ();                                                   \
480 }
481
482 /* Define this macro if references to a symbol must be treated
483    differently depending on something about the variable or
484    function named by the symbol (such as what section it is in).
485
486    The macro definition, if any, is executed immediately after the
487    rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
488    The value of the rtl will be a `mem' whose address is a
489    `symbol_ref'.
490
491    The usual thing for this macro to do is to a flag in the
492    `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
493    name string in the `symbol_ref' (if one bit is not enough
494    information).
495
496    The best way to modify the name string is by adding text to the
497    beginning, with suitable punctuation to prevent any ambiguity.
498    Allocate the new name in `saveable_obstack'.  You will have to
499    modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
500    and output the name accordingly.
501
502    You can also check the information stored in the `symbol_ref' in
503    the definition of `GO_IF_LEGITIMATE_ADDRESS' or
504    `PRINT_OPERAND_ADDRESS'. */
505
506 #undef  ENCODE_SECTION_INFO
507 #define ENCODE_SECTION_INFO(DECL)                                       \
508 do                                                                      \
509   {                                                                     \
510    if (HALF_PIC_P ())                                                   \
511       HALF_PIC_ENCODE (DECL);                                           \
512                                                                         \
513    else if (flag_pic)                                                   \
514      {                                                                  \
515        rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'             \
516                   ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));             \
517        SYMBOL_REF_FLAG (XEXP (rtl, 0))                                  \
518          = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'                   \
519             || ! TREE_PUBLIC (DECL));                                   \
520       }                                                                 \
521   }                                                                     \
522 while (0)
523
524
525 /* On most machines, read-only variables, constants, and jump tables
526    are placed in the text section.  If this is not the case on your
527    machine, this macro should be defined to be the name of a function
528    (either `data_section' or a function defined in `EXTRA_SECTIONS')
529    that switches to the section to be used for read-only items.
530
531    If these items should be placed in the text section, this macro
532    should not be defined.  */
533
534 #if 0
535 #undef  READONLY_DATA_SECTION
536 #define READONLY_DATA_SECTION()                                         \
537 do                                                                      \
538   {                                                                     \
539     if (TARGET_ELF)                                                     \
540       {                                                                 \
541         if (in_section != in_rodata)                                    \
542           {                                                             \
543             fprintf (asm_out_file, "\t.section \"rodata\"\n");          \
544             in_section = in_rodata;                                     \
545           }                                                             \
546       }                                                                 \
547     else                                                                \
548       text_section ();                                                  \
549   }                                                                     \
550 while (0)
551 #endif
552
553 /* A list of names for sections other than the standard two, which are
554    `in_text' and `in_data'.  You need not define this macro on a
555    system with no other sections (that GCC needs to use).  */
556
557 #undef  EXTRA_SECTIONS
558 #define EXTRA_SECTIONS in_rodata, in_data1
559
560 /* Given a decl node or constant node, choose the section to output it in
561    and select that section.  */
562
563 #undef  SELECT_RTX_SECTION
564 #define SELECT_RTX_SECTION(MODE, RTX)                                   \
565 do                                                                      \
566   {                                                                     \
567     if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX))     \
568       data_section ();                                                  \
569     else                                                                \
570       readonly_data_section ();                                         \
571   }                                                                     \
572 while (0)
573
574 #undef  SELECT_SECTION
575 #define SELECT_SECTION(DECL, RELOC)                                     \
576 {                                                                       \
577   if (RELOC && HALF_PIC_P ())                                           \
578     data_section ();                                                    \
579                                                                         \
580   else if (TREE_CODE (DECL) == STRING_CST)                              \
581     {                                                                   \
582       if (flag_writable_strings)                                        \
583         data_section ();                                                \
584       else                                                              \
585         readonly_data_section ();                                       \
586     }                                                                   \
587                                                                         \
588   else if (TREE_CODE (DECL) != VAR_DECL)                                \
589     readonly_data_section ();                                           \
590                                                                         \
591   else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)            \
592            || !DECL_INITIAL (DECL)                                      \
593            || (DECL_INITIAL (DECL) != error_mark_node                   \
594                && !TREE_CONSTANT (DECL_INITIAL (DECL))))                \
595     data_section ();                                                    \
596                                                                         \
597   else                                                                  \
598     readonly_data_section ();                                           \
599 }
600
601
602 /* Define the strings used for the special svr4 .type and .size directives.
603    These strings generally do not vary from one system running svr4 to
604    another, but if a given system (e.g. m88k running svr) needs to use
605    different pseudo-op names for these, they may be overridden in the
606    file which includes this one.  */
607
608 #define TYPE_ASM_OP     ".type"
609 #define SIZE_ASM_OP     ".size"
610 #define SET_ASM_OP      ".set"
611
612 /* This is how we tell the assembler that a symbol is weak.  */
613
614 #define ASM_WEAKEN_LABEL(FILE,NAME) \
615   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
616        fputc ('\n', FILE); } while (0)
617
618 /* The following macro defines the format used to output the second
619    operand of the .type assembler directive.  Different svr4 assemblers
620    expect various different forms for this operand.  The one given here
621    is just a default.  You may need to override it in your machine-
622    specific tm.h file (depending upon the particulars of your assembler).  */
623
624 #define TYPE_OPERAND_FMT        "@%s"
625
626 /* A C statement (sans semicolon) to output to the stdio stream
627    STREAM any text necessary for declaring the name NAME of an
628    initialized variable which is being defined.  This macro must
629    output the label definition (perhaps using `ASM_OUTPUT_LABEL').
630    The argument DECL is the `VAR_DECL' tree node representing the
631    variable.
632
633    If this macro is not defined, then the variable name is defined
634    in the usual manner as a label (by means of `ASM_OUTPUT_LABEL').  */
635
636 #undef  ASM_DECLARE_OBJECT_NAME
637 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                          \
638 do                                                                           \
639  {                                                                           \
640    ASM_OUTPUT_LABEL(STREAM,NAME);                                            \
641    HALF_PIC_DECLARE (NAME);                                                  \
642    if (TARGET_ELF)                                                           \
643      {                                                                       \
644        fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);                             \
645        assemble_name (STREAM, NAME);                                         \
646        putc (',', STREAM);                                                   \
647        fprintf (STREAM, TYPE_OPERAND_FMT, "object");                         \
648        putc ('\n', STREAM);                                                  \
649        size_directive_output = 0;                                            \
650        if (!flag_inhibit_size_directive && DECL_SIZE (DECL))                 \
651          {                                                                   \
652            size_directive_output = 1;                                        \
653            fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP);                         \
654            assemble_name (STREAM, NAME);                                     \
655            fprintf (STREAM, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
656          }                                                                   \
657      }                                                                       \
658  }                                                                           \
659 while (0)
660
661 /* Output the size directive for a decl in rest_of_decl_compilation
662    in the case where we did not do so before the initializer.
663    Once we find the error_mark_node, we know that the value of
664    size_directive_output was set
665    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
666
667 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)         \
668 do {                                                                     \
669      char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);                   \
670      if (TARGET_ELF                                                      \
671          && !flag_inhibit_size_directive && DECL_SIZE (DECL)             \
672          && ! AT_END && TOP_LEVEL                                        \
673          && DECL_INITIAL (DECL) == error_mark_node                       \
674          && !size_directive_output)                                      \
675        {                                                                 \
676          fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
677          assemble_name (FILE, name);                                     \
678          fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
679        }                                                                 \
680    } while (0)
681
682 /* This is how to declare a function name. */
683
684 #undef  ASM_DECLARE_FUNCTION_NAME
685 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)                     \
686 do                                                                      \
687  {                                                                      \
688    ASM_OUTPUT_LABEL(STREAM,NAME);                                       \
689    HALF_PIC_DECLARE (NAME);                                             \
690    if (TARGET_ELF)                                                      \
691      {                                                                  \
692        fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);                        \
693        assemble_name (STREAM, NAME);                                    \
694        putc (',', STREAM);                                              \
695        fprintf (STREAM, TYPE_OPERAND_FMT, "function");                  \
696        putc ('\n', STREAM);                                             \
697        ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL));                 \
698      }                                                                  \
699  }                                                                      \
700 while (0)
701
702 /* Write the extra assembler code needed to declare a function's result.
703    Most svr4 assemblers don't require any special declaration of the
704    result value, but there are exceptions.  */
705
706 #ifndef ASM_DECLARE_RESULT
707 #define ASM_DECLARE_RESULT(FILE, RESULT)
708 #endif
709
710 /* This is how to declare the size of a function.  */
711
712 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
713 do                                                                      \
714   {                                                                     \
715     if (TARGET_ELF && !flag_inhibit_size_directive)                     \
716       {                                                                 \
717         char label[256];                                                \
718         static int labelno;                                             \
719         labelno++;                                                      \
720         ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
721         ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
722         fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
723         assemble_name (FILE, (FNAME));                                  \
724         fprintf (FILE, ",");                                            \
725         assemble_name (FILE, label);                                    \
726         fprintf (FILE, "-");                                            \
727         assemble_name (FILE, (FNAME));                                  \
728         putc ('\n', FILE);                                              \
729       }                                                                 \
730   }                                                                     \
731 while (0)
732
733 /* Attach a special .ident directive to the end of the file to identify
734    the version of GCC which compiled this code.  The format of the
735    .ident string is patterned after the ones produced by native svr4
736    C compilers.  */
737
738 #define IDENT_ASM_OP ".ident"
739
740 /* Allow #sccs in preprocessor.  */
741
742 #define SCCS_DIRECTIVE
743
744 /* This says what to print at the end of the assembly file */
745 #define ASM_FILE_END(STREAM)                                            \
746 do                                                                      \
747   {                                                                     \
748     if (HALF_PIC_P ())                                                  \
749       HALF_PIC_FINISH (STREAM);                                         \
750                                                                         \
751     if (!flag_no_ident)                                                 \
752       {                                                                 \
753         char *fstart = main_input_filename;                             \
754         char *fname;                                                    \
755                                                                         \
756         if (!fstart)                                                    \
757           fstart = "<no file>";                                         \
758                                                                         \
759         fname = fstart + strlen (fstart) - 1;                           \
760         while (fname > fstart && *fname != '/')                         \
761           fname--;                                                      \
762                                                                         \
763         if (*fname == '/')                                              \
764           fname++;                                                      \
765                                                                         \
766         fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d",             \
767                  IDENT_ASM_OP, version_string, fname, optimize);        \
768                                                                         \
769         if (write_symbols == PREFERRED_DEBUGGING_TYPE)                  \
770           fprintf ((STREAM), " -g%d", (int)debug_info_level);           \
771                                                                         \
772         else if (write_symbols == DBX_DEBUG)                            \
773           fprintf ((STREAM), " -gstabs%d", (int)debug_info_level);      \
774                                                                         \
775         else if (write_symbols == DWARF_DEBUG)                          \
776           fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level);      \
777                                                                         \
778         else if (write_symbols != NO_DEBUG)                             \
779           fprintf ((STREAM), " -g??%d", (int)debug_info_level);         \
780                                                                         \
781         if (flag_omit_frame_pointer)                                    \
782           fprintf ((STREAM), " -fomit-frame-pointer");                  \
783                                                                         \
784         if (flag_strength_reduce)                                       \
785           fprintf ((STREAM), " -fstrength-reduce");                     \
786                                                                         \
787         if (flag_unroll_loops)                                          \
788           fprintf ((STREAM), " -funroll-loops");                        \
789                                                                         \
790         if (flag_schedule_insns)                                        \
791           fprintf ((STREAM), " -fschedule-insns");                      \
792                                                                         \
793         if (flag_schedule_insns_after_reload)                           \
794           fprintf ((STREAM), " -fschedule-insns2");                     \
795                                                                         \
796         if (flag_force_mem)                                             \
797           fprintf ((STREAM), " -fforce-mem");                           \
798                                                                         \
799         if (flag_force_addr)                                            \
800           fprintf ((STREAM), " -fforce-addr");                          \
801                                                                         \
802         if (flag_inline_functions)                                      \
803           fprintf ((STREAM), " -finline-functions");                    \
804                                                                         \
805         if (flag_caller_saves)                                          \
806           fprintf ((STREAM), " -fcaller-saves");                        \
807                                                                         \
808         if (flag_pic)                                                   \
809           fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic");     \
810                                                                         \
811         if (flag_inhibit_size_directive)                                \
812           fprintf ((STREAM), " -finhibit-size-directive");              \
813                                                                         \
814         if (flag_gnu_linker)                                            \
815           fprintf ((STREAM), " -fgnu-linker");                          \
816                                                                         \
817         if (profile_flag)                                               \
818           fprintf ((STREAM), " -p");                                    \
819                                                                         \
820         if (profile_block_flag)                                         \
821           fprintf ((STREAM), " -a");                                    \
822                                                                         \
823         if (TARGET_IEEE_FP)                                             \
824           fprintf ((STREAM), " -mieee-fp");                             \
825                                                                         \
826         if (TARGET_HALF_PIC)                                            \
827           fprintf ((STREAM), " -mhalf-pic");                            \
828                                                                         \
829         if (!TARGET_MOVE)                                               \
830           fprintf ((STREAM), " -mno-move");                             \
831                                                                         \
832         if (TARGET_386)                                                 \
833           fprintf ((STREAM), " -m386");                                 \
834                                                                         \
835         else if (TARGET_486)                                            \
836           fprintf ((STREAM), " -m486");                                 \
837                                                                         \
838         else                                                            \
839           fprintf ((STREAM), " -munknown-machine");                     \
840                                                                         \
841         fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
842       }                                                                 \
843   }                                                                     \
844 while (0)
845
846 /* Tell collect that the object format is OSF/rose.  */
847 #define OBJECT_FORMAT_ROSE
848
849 /* Tell collect where the appropriate binaries are.  */
850 #define REAL_NM_FILE_NAME       "/usr/ccs/gcc/bfd-nm"
851 #define REAL_STRIP_FILE_NAME    "/usr/ccs/bin/strip"
852
853 /* Define this macro meaning that gcc should find the library 'libgcc.a'
854    by hand, rather than passing the argument '-lgcc' to tell the linker
855    to do the search */
856 #define LINK_LIBGCC_SPECIAL
857
858 /* A C statement to output assembler commands which will identify the object
859   file as having been compile with GNU CC. We don't need or want this for
860   OSF1. GDB doesn't need it and kdb doesn't like it */
861 #define ASM_IDENTIFY_GCC(FILE)
862
863 /* Identify the front-end which produced this file.  To keep symbol
864    space down, and not confuse kdb, only do this if the language is
865    not C.  */
866
867 #define ASM_IDENTIFY_LANGUAGE(STREAM)                                   \
868 {                                                                       \
869   if (strcmp (lang_identify (), "c") != 0)                              \
870     output_lang_identify (STREAM);                                      \
871 }
872
873 /* Generate calls to memcpy, etc., not bcopy, etc. */
874 #define TARGET_MEM_FUNCTIONS
875
876 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
877    we want to retain compatibility with older gcc versions.  */
878 #define DEFAULT_PCC_STRUCT_RETURN 0
879
880 /* Map i386 registers to the numbers dwarf expects.  Of course this is different
881    from what stabs expects.  */
882
883 #define DWARF_DBX_REGISTER_NUMBER(n) \
884 ((n) == 0 ? 0 \
885  : (n) == 1 ? 2 \
886  : (n) == 2 ? 1 \
887  : (n) == 3 ? 3 \
888  : (n) == 4 ? 6 \
889  : (n) == 5 ? 7 \
890  : (n) == 6 ? 5 \
891  : (n) == 7 ? 4 \
892  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
893  : (-1))
894
895 /* Now what stabs expects in the register.  */
896 #define STABS_DBX_REGISTER_NUMBER(n) \
897 ((n) == 0 ? 0 : \
898  (n) == 1 ? 2 : \
899  (n) == 2 ? 1 : \
900  (n) == 3 ? 3 : \
901  (n) == 4 ? 6 : \
902  (n) == 5 ? 7 : \
903  (n) == 6 ? 4 : \
904  (n) == 7 ? 5 : \
905  (n) + 4)
906
907 #undef  DBX_REGISTER_NUMBER
908 #define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG)          \
909                                 ? DWARF_DBX_REGISTER_NUMBER(n)          \
910                                 : STABS_DBX_REGISTER_NUMBER(n))