1 /* Definitions of target machine for GNU compiler.
2 Intel 386 (OSF/1 with OSF/rose) version.
3 Copyright (C) 1991, 1992, 1993, 1996, 1999 Free Software Foundation, Inc.
5 This file is part of GNU CC.
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)
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.
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. */
23 #include "i386/gstabs.h"
25 /* Get perform_* macros to build libgcc.a. */
26 #include "i386/perform.h"
30 #undef WORD_SWITCH_TAKES_ARG
31 #define WORD_SWITCH_TAKES_ARG(STR) \
32 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
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). */
38 #define SWITCH_TAKES_ARG(CHAR) \
39 (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
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 */
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)
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, "" },
75 /* OSF/rose uses stabs, not dwarf. */
76 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
78 #ifndef DWARF_DEBUGGING_INFO
79 #define DWARF_DEBUGGING_INFO /* enable dwarf debugging for testing */
82 /* Handle #pragma weak and #pragma pack. */
84 #define HANDLE_SYSV_PRAGMA
85 #define SUPPORTS_WEAK TARGET_ELF
87 /* Change default predefines. */
89 #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)"
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}}"
105 /* Turn on -pic-extern by default for OSF/rose, -fpic for ELF. */
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*: }}"
119 #define ASM_SPEC "%{v*: -v}"
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: } \
127 %{static:-dn -Bstatic} \
129 %{symbolic:-Bsymbolic -G -dy} \
131 %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
132 %{noshrlib: -dn } %{pic-none: -dn } \
133 %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
136 #define LIB_SPEC "-lc"
141 #undef STARTFILE_SPEC
142 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
144 #undef TARGET_VERSION_INTERNAL
145 #undef TARGET_VERSION
147 #define I386_VERSION " 80386, OSF/rose objects"
149 #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
150 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
152 #undef MD_EXEC_PREFIX
153 #define MD_EXEC_PREFIX "/usr/ccs/gcc/"
155 #undef MD_STARTFILE_PREFIX
156 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
158 /* Specify size_t, ptrdiff_t, and wchar_t types. */
162 #undef WCHAR_TYPE_SIZE
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
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
175 /* Turn off long double being 96 bits. */
176 #undef LONG_DOUBLE_TYPE_SIZE
177 #define LONG_DOUBLE_TYPE_SIZE 64
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.
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). */
191 #define OSF_PROFILE_BEFORE_PROLOGUE \
193 && !current_function_needs_context \
195 || !frame_pointer_needed \
196 || (!current_function_uses_pic_offset_table \
197 && !current_function_uses_const_pool)))
199 #undef FUNCTION_PROLOGUE
200 #define FUNCTION_PROLOGUE(FILE, SIZE) \
203 char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
204 char *lprefix = LPREFIX; \
205 int labelno = profile_label_no; \
207 if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \
209 if (!flag_pic && !HALF_PIC_P ()) \
211 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
212 fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \
215 else if (HALF_PIC_P ()) \
219 HALF_PIC_EXTERNAL ("_mcount_ptr"); \
220 symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \
223 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
224 fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \
226 fprintf (FILE, "\tcall *(%%eax)\n"); \
231 static int call_no = 0; \
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", \
239 fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \
241 fprintf (FILE, "\tcall *(%%eax)\n"); \
245 function_prologue (FILE, SIZE); \
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
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. */
261 #undef FUNCTION_PROFILER
262 #define FUNCTION_PROFILER(FILE, LABELNO) \
265 if (!OSF_PROFILE_BEFORE_PROLOGUE) \
267 char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
268 char *lprefix = LPREFIX; \
269 int labelno = LABELNO; \
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. */ \
277 && !current_function_uses_pic_offset_table \
278 && !current_function_uses_const_pool) \
281 if (TARGET_MCOUNT && flag_pic) \
283 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
285 fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
288 else if (TARGET_MCOUNT && HALF_PIC_P ()) \
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)); \
298 else if (TARGET_MCOUNT) \
300 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
301 fprintf (FILE, "\tcall %smcount\n", prefix); \
304 else if (flag_pic && frame_pointer_needed) \
306 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
307 fprintf (FILE, "\tpushl %%ecx\n"); \
308 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
310 fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n"); \
311 fprintf (FILE, "\tcall *(%%eax)\n"); \
312 fprintf (FILE, "\tpopl %%eax\n"); \
315 else if (frame_pointer_needed) \
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"); \
330 /* A C function or functions which are needed in the library to
331 support block profiling. When support goes into libc, undo
335 #undef BLOCK_PROFILING_CODE
336 #define BLOCK_PROFILING_CODE
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 */
343 #define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
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'. */
350 #undef ASM_GENERATE_INTERNAL_LABEL
351 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
352 sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \
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. */
358 #undef ASM_OUTPUT_INTERNAL_LABEL
359 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
360 fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \
363 /* The prefix to add to user-visible assembler symbols. */
365 /* target_flags is not accessible by the preprocessor */
366 #undef USER_LABEL_PREFIX
367 #define USER_LABEL_PREFIX "_"
369 /* This is how to output a reference to a user-level label named NAME. */
371 #undef ASM_OUTPUT_LABELREF
372 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
373 fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
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. */
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)
383 /* Output a definition */
384 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
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"); \
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
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. */
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)
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.
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. */
415 #define LOOP_ALIGN(LABEL) (i386_align_loops)
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'. */
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))
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.
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. */
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)
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)))
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. */
448 #undef LEGITIMATE_CONSTANT_P
449 #define LEGITIMATE_CONSTANT_P(X) \
451 || GET_CODE (X) == CONST_DOUBLE \
452 || GET_CODE (X) == CONST_INT \
453 || !HALF_PIC_ADDRESS_P (X))
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
461 #undef SUBTARGET_OVERRIDE_OPTIONS
462 #define SUBTARGET_OVERRIDE_OPTIONS \
465 if (TARGET_ELF && TARGET_HALF_PIC) \
467 target_flags &= ~MASK_HALF_PIC; \
472 if (TARGET_ROSE && flag_pic) \
474 target_flags |= MASK_HALF_PIC; \
478 if (TARGET_HALF_PIC) \
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).
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
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
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.
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'. */
506 #undef ENCODE_SECTION_INFO
507 #define ENCODE_SECTION_INFO(DECL) \
511 HALF_PIC_ENCODE (DECL); \
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)); \
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.
531 If these items should be placed in the text section, this macro
532 should not be defined. */
535 #undef READONLY_DATA_SECTION
536 #define READONLY_DATA_SECTION() \
541 if (in_section != in_rodata) \
543 fprintf (asm_out_file, "\t.section \"rodata\"\n"); \
544 in_section = in_rodata; \
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). */
557 #undef EXTRA_SECTIONS
558 #define EXTRA_SECTIONS in_rodata, in_data1
560 /* Given a decl node or constant node, choose the section to output it in
561 and select that section. */
563 #undef SELECT_RTX_SECTION
564 #define SELECT_RTX_SECTION(MODE, RTX) \
567 if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX)) \
570 readonly_data_section (); \
574 #undef SELECT_SECTION
575 #define SELECT_SECTION(DECL, RELOC) \
577 if (RELOC && HALF_PIC_P ()) \
580 else if (TREE_CODE (DECL) == STRING_CST) \
582 if (flag_writable_strings) \
585 readonly_data_section (); \
588 else if (TREE_CODE (DECL) != VAR_DECL) \
589 readonly_data_section (); \
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)))) \
598 readonly_data_section (); \
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. */
608 #define TYPE_ASM_OP ".type"
609 #define SIZE_ASM_OP ".size"
610 #define SET_ASM_OP ".set"
612 /* This is how we tell the assembler that a symbol is weak. */
614 #define ASM_WEAKEN_LABEL(FILE,NAME) \
615 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
616 fputc ('\n', FILE); } while (0)
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). */
624 #define TYPE_OPERAND_FMT "@%s"
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
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'). */
636 #undef ASM_DECLARE_OBJECT_NAME
637 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
640 ASM_OUTPUT_LABEL(STREAM,NAME); \
641 HALF_PIC_DECLARE (NAME); \
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)) \
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))); \
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. */
667 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
669 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
671 && !flag_inhibit_size_directive && DECL_SIZE (DECL) \
672 && ! AT_END && TOP_LEVEL \
673 && DECL_INITIAL (DECL) == error_mark_node \
674 && !size_directive_output) \
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))); \
682 /* This is how to declare a function name. */
684 #undef ASM_DECLARE_FUNCTION_NAME
685 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
688 ASM_OUTPUT_LABEL(STREAM,NAME); \
689 HALF_PIC_DECLARE (NAME); \
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)); \
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. */
706 #ifndef ASM_DECLARE_RESULT
707 #define ASM_DECLARE_RESULT(FILE, RESULT)
710 /* This is how to declare the size of a function. */
712 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
715 if (TARGET_ELF && !flag_inhibit_size_directive) \
718 static int 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)); \
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
738 #define IDENT_ASM_OP ".ident"
740 /* Allow #sccs in preprocessor. */
742 #define SCCS_DIRECTIVE
744 /* This says what to print at the end of the assembly file */
745 #define ASM_FILE_END(STREAM) \
749 HALF_PIC_FINISH (STREAM); \
751 if (!flag_no_ident) \
753 char *fstart = main_input_filename; \
757 fstart = "<no file>"; \
759 fname = fstart + strlen (fstart) - 1; \
760 while (fname > fstart && *fname != '/') \
766 fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d", \
767 IDENT_ASM_OP, version_string, fname, optimize); \
769 if (write_symbols == PREFERRED_DEBUGGING_TYPE) \
770 fprintf ((STREAM), " -g%d", (int)debug_info_level); \
772 else if (write_symbols == DBX_DEBUG) \
773 fprintf ((STREAM), " -gstabs%d", (int)debug_info_level); \
775 else if (write_symbols == DWARF_DEBUG) \
776 fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level); \
778 else if (write_symbols != NO_DEBUG) \
779 fprintf ((STREAM), " -g??%d", (int)debug_info_level); \
781 if (flag_omit_frame_pointer) \
782 fprintf ((STREAM), " -fomit-frame-pointer"); \
784 if (flag_strength_reduce) \
785 fprintf ((STREAM), " -fstrength-reduce"); \
787 if (flag_unroll_loops) \
788 fprintf ((STREAM), " -funroll-loops"); \
790 if (flag_schedule_insns) \
791 fprintf ((STREAM), " -fschedule-insns"); \
793 if (flag_schedule_insns_after_reload) \
794 fprintf ((STREAM), " -fschedule-insns2"); \
796 if (flag_force_mem) \
797 fprintf ((STREAM), " -fforce-mem"); \
799 if (flag_force_addr) \
800 fprintf ((STREAM), " -fforce-addr"); \
802 if (flag_inline_functions) \
803 fprintf ((STREAM), " -finline-functions"); \
805 if (flag_caller_saves) \
806 fprintf ((STREAM), " -fcaller-saves"); \
809 fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic"); \
811 if (flag_inhibit_size_directive) \
812 fprintf ((STREAM), " -finhibit-size-directive"); \
814 if (flag_gnu_linker) \
815 fprintf ((STREAM), " -fgnu-linker"); \
818 fprintf ((STREAM), " -p"); \
820 if (profile_block_flag) \
821 fprintf ((STREAM), " -a"); \
823 if (TARGET_IEEE_FP) \
824 fprintf ((STREAM), " -mieee-fp"); \
826 if (TARGET_HALF_PIC) \
827 fprintf ((STREAM), " -mhalf-pic"); \
830 fprintf ((STREAM), " -mno-move"); \
833 fprintf ((STREAM), " -m386"); \
835 else if (TARGET_486) \
836 fprintf ((STREAM), " -m486"); \
839 fprintf ((STREAM), " -munknown-machine"); \
841 fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
846 /* Tell collect that the object format is OSF/rose. */
847 #define OBJECT_FORMAT_ROSE
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"
853 /* Use atexit for static constructors/destructors, instead of defining
854 our own exit function. */
857 /* Define this macro meaning that gcc should find the library 'libgcc.a'
858 by hand, rather than passing the argument '-lgcc' to tell the linker
860 #define LINK_LIBGCC_SPECIAL
862 /* A C statement to output assembler commands which will identify the object
863 file as having been compile with GNU CC. We don't need or want this for
864 OSF1. GDB doesn't need it and kdb doesn't like it */
865 #define ASM_IDENTIFY_GCC(FILE)
867 /* Identify the front-end which produced this file. To keep symbol
868 space down, and not confuse kdb, only do this if the language is
871 #define ASM_IDENTIFY_LANGUAGE(STREAM) \
873 if (strcmp (lang_identify (), "c") != 0) \
874 output_lang_identify (STREAM); \
877 /* Generate calls to memcpy, etc., not bcopy, etc. */
878 #define TARGET_MEM_FUNCTIONS
880 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
881 we want to retain compatibility with older gcc versions. */
882 #define DEFAULT_PCC_STRUCT_RETURN 0
884 /* Map i386 registers to the numbers dwarf expects. Of course this is different
885 from what stabs expects. */
887 #define DWARF_DBX_REGISTER_NUMBER(n) \
896 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
899 /* Now what stabs expects in the register. */
900 #define STABS_DBX_REGISTER_NUMBER(n) \
911 #undef DBX_REGISTER_NUMBER
912 #define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \
913 ? DWARF_DBX_REGISTER_NUMBER(n) \
914 : STABS_DBX_REGISTER_NUMBER(n))