2002-05-03 David S. Miller <davem@redhat.com>
[official-gcc.git] / gcc / config / i386 / osf1elf.h
bloba772442c4fc89536e9d94ee697d1554eb05c993e
1 /* OSF/1 1.3 now is compitable with SVR4, so include sysv4.h, and
2 put difference here.
3 Copyright (C) 2000 Free Software Foundation, Inc. */
5 #include <stdio.h>
7 #undef TARGET_VERSION
8 #define TARGET_VERSION fprintf (stderr, " (i386 OSF/1)");
10 #define TARGET_OSF1ELF
12 /* WORD_SWITCH_TAKES_ARG defined in svr4 is not correct. We also
13 need an extra -soname */
14 #undef WORD_SWITCH_TAKES_ARG
15 #define WORD_SWITCH_TAKES_ARG(STR) \
16 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
17 || !strcmp (STR, "Tdata") || !strcmp (STR, "Ttext") \
18 || !strcmp (STR, "Tbss") || !strcmp (STR, "soname"))
20 /* Note, -fpic and -fPIC are equivalent */
21 #undef CPP_SPEC
22 #define CPP_SPEC "\
23 %(cpp_cpu) \
24 %{fpic: -D__SHARED__} %{fPIC: %{!fpic: -D__SHARED__}} \
25 %{.S: %{!ansi:%{!traditional-cpp: -traditional}}} \
26 %{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
27 %{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
28 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
29 %{.C: -D__LANGUAGE_C_PLUS_PLUS} \
30 %{.m: -D__LANGUAGE_OBJECTIVE_C} \
31 %{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
33 /* -mmcount or -mno-mcount should be used with -pg or -p */
34 #undef CC1_SPEC
35 #define CC1_SPEC "%(cc1_cpu) %{p: %{!mmcount: %{!mno-mcount: -mno-mcount }}} \
36 %{!p: %{pg: %{!mmcount: %{!mno-mcount: -mno-mcount }}}}"
38 /* Note, -D__NO_UNDERSCORES__ -D__ELF__ are provided in the older version of
39 OSF/1 gcc. We keep them here, so that old /usr/include/i386/asm.h works.
41 #undef CPP_PREDEFINES
42 #define CPP_PREDEFINES \
43 "-D__NO_UNDERSCORES__ -D__ELF__ -DOSF -DOSF1 -Dunix \
44 -Asystem=unix -Asystem=xpg4 -Asystem=osf1"
46 /* current OSF/1 doesn't provide separate crti.o and gcrti.o (and also, crtn.o
47 and gcrtn.o) for profile. */
49 #undef STARTFILE_SPEC
50 #define STARTFILE_SPEC "%{!shared: \
51 %{!symbolic: \
52 %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
53 crti.o%s \
54 crtbegin.o%s"
56 #undef ENDFILE_SPEC
57 #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
59 #undef ASM_SPEC
60 #define ASM_SPEC "%{v*: -v}"
62 #undef LINK_SPEC
63 #define LINK_SPEC "%{v*: -v} \
64 %{h*} %{z*} \
65 %{dy:-call_shared} %{dn:-static} \
66 %{static:-static} \
67 %{shared:-shared} \
68 %{call_shared:-call_shared} \
69 %{symbolic:-Bsymbolic -shared -call_shared} \
70 %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
71 %{noshrlib: -static } \
72 %{!noshrlib: -call_shared}}}}}}"
74 #undef MD_EXEC_PREFIX
75 #define MD_EXEC_PREFIX "/usr/ccs/gcc/"
77 #undef MD_STARTFILE_PREFIX
78 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
80 /* Define this macro meaning that gcc should find the library 'libgcc.a'
81 by hand, rather than passing the argument '-lgcc' to tell the linker
82 to do the search */
83 #define LINK_LIBGCC_SPECIAL
85 /* This goes with LINK_LIBGCC_SPECIAL, we need tell libgcc.a differently */
86 #undef LIBGCC_SPEC
87 #define LIBGCC_SPEC "%{!shared:%{!symbolic:libgcc.a%s}}"
89 /* Specify size_t, ptrdiff_t, and wchar_t types. */
90 #undef SIZE_TYPE
91 #undef PTRDIFF_TYPE
92 #undef WCHAR_TYPE
93 #undef WCHAR_TYPE_SIZE
95 #define SIZE_TYPE "long unsigned int"
96 #define PTRDIFF_TYPE "int"
97 #define WCHAR_TYPE "unsigned int"
98 #define WCHAR_TYPE_SIZE BITS_PER_WORD
100 /* Turn off long double being 96 bits. */
101 #undef LONG_DOUBLE_TYPE_SIZE
102 #define LONG_DOUBLE_TYPE_SIZE 64
104 /* Work with OSF/1 profile */
105 #define MASK_NO_MCOUNT 000200000000 /* profiling uses mcount_ptr */
107 #define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0)
109 #undef SUBTARGET_SWITCHES
110 #define SUBTARGET_SWITCHES \
111 { "mcount", -MASK_NO_MCOUNT, \
112 N_("Profiling uses mcount") }, \
113 { "no-mcount", MASK_NO_MCOUNT, "" },
115 /* This macro generates the assembly code for function entry.
116 FILE is a stdio stream to output the code to.
117 SIZE is an int: how many units of temporary storage to allocate.
118 Refer to the array `regs_ever_live' to determine which registers
119 to save; `regs_ever_live[I]' is nonzero if register number I
120 is ever used in the function. This macro is responsible for
121 knowing which registers should not be saved even if used.
123 We override it here to allow for the new profiling code to go before
124 the prologue and the old mcount code to go after the prologue (and
125 after %ebx has been set up for ELF shared library support). */
126 #if 0
127 #define OSF_PROFILE_BEFORE_PROLOGUE \
128 (!TARGET_MCOUNT \
129 && !current_function_needs_context \
130 && (!flag_pic \
131 || !frame_pointer_needed \
132 || (!current_function_uses_pic_offset_table \
133 && !current_function_uses_const_pool)))
134 #else
135 #define OSF_PROFILE_BEFORE_PROLOGUE 0
136 #endif
138 /* A C statement or compound statement to output to FILE some assembler code to
139 call the profiling subroutine `mcount'. Before calling, the assembler code
140 must load the address of a counter variable into a register where `mcount'
141 expects to find the address. The name of this variable is `LP' followed by
142 the number LABELNO, so you would generate the name using `LP%d' in a
143 `fprintf'.
145 The details of how the address should be passed to `mcount' are determined
146 by your operating system environment, not by GNU CC. To figure them out,
147 compile a small program for profiling using the system's installed C
148 compiler and look at the assembler code that results. */
150 #undef FUNCTION_PROFILER
151 #define FUNCTION_PROFILER(FILE, LABELNO) \
152 do \
154 if (!OSF_PROFILE_BEFORE_PROLOGUE) \
156 const char *const prefix = ""; \
157 const char *const lprefix = LPREFIX; \
158 int labelno = LABELNO; \
160 /* Note that OSF/rose blew it in terms of calling mcount, \
161 since OSF/rose prepends a leading underscore, but mcount's \
162 doesn't. At present, we keep this kludge for ELF as well \
163 to allow old kernels to build profiling. */ \
165 if (flag_pic \
166 && !current_function_uses_pic_offset_table \
167 && !current_function_uses_const_pool) \
168 abort (); \
170 if (TARGET_MCOUNT && flag_pic) \
172 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
173 lprefix, labelno); \
174 fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
177 else if (TARGET_MCOUNT) \
179 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
180 fprintf (FILE, "\tcall %smcount\n", prefix); \
183 else if (flag_pic && frame_pointer_needed) \
185 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
186 fprintf (FILE, "\tpushl %%ecx\n"); \
187 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
188 lprefix, labelno); \
189 fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n"); \
190 fprintf (FILE, "\tcall *(%%eax)\n"); \
191 fprintf (FILE, "\tpopl %%eax\n"); \
194 else if (frame_pointer_needed) \
196 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
197 fprintf (FILE, "\tpushl %%ecx\n"); \
198 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
199 fprintf (FILE, "\tcall *_mcount_ptr\n"); \
200 fprintf (FILE, "\tpopl %%eax\n"); \
203 else \
204 abort (); \
207 while (0)