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