1 /* OSF/1 1.3 now is compitable with SVR4, so include sysv4.h, and
2 put difference here. */
5 #include "i386/sysv4.h" /* Base i386 target machine definitions */
6 #define _sys_siglist sys_siglist
7 extern char *sys_siglist[];
10 #define TARGET_VERSION fprintf (stderr, " (i386 OSF/1)");
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 */
23 %{fpic: -D__SHARED__} %{fPIC: %{!fpic: -D__SHARED__}} \
24 %{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
25 %{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
26 %{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
27 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
28 %{.C: -D__LANGUAGE_C_PLUS_PLUS} \
29 %{.m: -D__LANGUAGE_OBJECTIVE_C} \
30 %{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
32 /* -mmcount or -mno-mcount should be used with -pg or -p */
34 #define CC1_SPEC "%{p: %{!mmcount: %{!mno-mcount: -mno-mcount }}} \
35 %{!p: %{pg: %{!mmcount: %{!mno-mcount: -mno-mcount }}}}"
37 /* Note, -D__NO_UNDERSCORES__ -D__ELF__ are provided in the older version of
38 OSF/1 gcc. We keep them here, so that old /usr/include/i386/asm.h works.
41 #define CPP_PREDEFINES \
42 "-D__NO_UNDERSCORES__ -D__ELF__ -DOSF -DOSF1 -Di386 -Dunix -Asystem(xpg4) -Asystem(osf1) -Acpu(i386) -Amachine(i386)"
44 /* current OSF/1 doesn't provide separate crti.o and gcrti.o (and also, crtn.o
45 and gcrtn.o) for profile. */
48 #define STARTFILE_SPEC "%{!shared: \
50 %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
55 #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
58 #define ASM_SPEC "%{v*: -v}"
61 #define LINK_SPEC "%{v*: -v} \
63 %{dy:-call_shared} %{dn:-static} \
66 %{call_shared:-call_shared} \
67 %{symbolic:-Bsymbolic -shared -call_shared} \
68 %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
69 %{noshrlib: -static } \
70 %{!noshrlib: -call_shared}}}}}}"
73 #define MD_EXEC_PREFIX "/usr/ccs/gcc/"
75 #undef MD_STARTFILE_PREFIX
76 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
78 /* Define this macro meaning that gcc should find the library 'libgcc.a'
79 by hand, rather than passing the argument '-lgcc' to tell the linker
81 #define LINK_LIBGCC_SPECIAL
83 /* This goes with LINK_LIBGCC_SPECIAL, we need tell libgcc.a differently */
85 #define LIBGCC_SPEC "%{!shared:%{!symbolic:libgcc.a%s}}"
87 /* A C statement to output assembler commands which will identify the object
88 file as having been compile with GNU CC. We don't need or want this for
90 #undef ASM_IDENTIFY_GCC
91 #define ASM_IDENTIFY_GCC(FILE)
93 /* Identify the front-end which produced this file. To keep symbol
94 space down, and not confuse kdb, only do this if the language is
96 #define ASM_IDENTIFY_LANGUAGE(STREAM) \
98 if (strcmp (lang_identify (), "c") != 0) \
99 output_lang_identify (STREAM); \
102 /* Specify size_t, ptrdiff_t, and wchar_t types. */
106 #undef WCHAR_TYPE_SIZE
108 #define SIZE_TYPE "long unsigned int"
109 #define PTRDIFF_TYPE "int"
110 #define WCHAR_TYPE "unsigned int"
111 #define WCHAR_TYPE_SIZE BITS_PER_WORD
113 /* Turn off long double being 96 bits. */
114 #undef LONG_DOUBLE_TYPE_SIZE
115 #define LONG_DOUBLE_TYPE_SIZE 64
117 /* Work with OSF/1 profile */
118 #define MASK_NO_MCOUNT 000200000000 /* profiling uses mcount_ptr */
120 #define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0)
122 #undef SUBTARGET_SWITCHES
123 #define SUBTARGET_SWITCHES \
124 { "mcount", -MASK_NO_MCOUNT, "Profiling uses mcount" }, \
125 { "no-mcount", MASK_NO_MCOUNT, "" },
127 /* This macro generates the assembly code for function entry.
128 FILE is a stdio stream to output the code to.
129 SIZE is an int: how many units of temporary storage to allocate.
130 Refer to the array `regs_ever_live' to determine which registers
131 to save; `regs_ever_live[I]' is nonzero if register number I
132 is ever used in the function. This macro is responsible for
133 knowing which registers should not be saved even if used.
135 We override it here to allow for the new profiling code to go before
136 the prologue and the old mcount code to go after the prologue (and
137 after %ebx has been set up for ELF shared library support). */
139 #define OSF_PROFILE_BEFORE_PROLOGUE \
141 && !current_function_needs_context \
143 || !frame_pointer_needed \
144 || (!current_function_uses_pic_offset_table \
145 && !current_function_uses_const_pool)))
147 #define OSF_PROFILE_BEFORE_PROLOGUE 0
149 #undef FUNCTION_PROLOGUE
150 #define FUNCTION_PROLOGUE(FILE, SIZE) \
154 char *lprefix = LPREFIX; \
155 int labelno = profile_label_no; \
157 if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \
161 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
162 fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \
167 static int call_no = 0; \
169 fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \
170 fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \
171 fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \
172 lprefix, call_no++); \
173 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n", \
175 fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \
177 fprintf (FILE, "\tcall *(%%eax)\n"); \
181 function_prologue (FILE, SIZE); \
185 /* A C statement or compound statement to output to FILE some assembler code to
186 call the profiling subroutine `mcount'. Before calling, the assembler code
187 must load the address of a counter variable into a register where `mcount'
188 expects to find the address. The name of this variable is `LP' followed by
189 the number LABELNO, so you would generate the name using `LP%d' in a
192 The details of how the address should be passed to `mcount' are determined
193 by your operating system environment, not by GNU CC. To figure them out,
194 compile a small program for profiling using the system's installed C
195 compiler and look at the assembler code that results. */
197 #undef FUNCTION_PROFILER
198 #define FUNCTION_PROFILER(FILE, LABELNO) \
201 if (!OSF_PROFILE_BEFORE_PROLOGUE) \
204 char *lprefix = LPREFIX; \
205 int labelno = LABELNO; \
207 /* Note that OSF/rose blew it in terms of calling mcount, \
208 since OSF/rose prepends a leading underscore, but mcount's \
209 doesn't. At present, we keep this kludge for ELF as well \
210 to allow old kernels to build profiling. */ \
213 && !current_function_uses_pic_offset_table \
214 && !current_function_uses_const_pool) \
217 if (TARGET_MCOUNT && flag_pic) \
219 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
221 fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
224 else if (TARGET_MCOUNT) \
226 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
227 fprintf (FILE, "\tcall %smcount\n", prefix); \
230 else if (flag_pic && frame_pointer_needed) \
232 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
233 fprintf (FILE, "\tpushl %%ecx\n"); \
234 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
236 fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n"); \
237 fprintf (FILE, "\tcall *(%%eax)\n"); \
238 fprintf (FILE, "\tpopl %%eax\n"); \
241 else if (frame_pointer_needed) \
243 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
244 fprintf (FILE, "\tpushl %%ecx\n"); \
245 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
246 fprintf (FILE, "\tcall *_mcount_ptr\n"); \
247 fprintf (FILE, "\tpopl %%eax\n"); \
256 #if defined (CROSS_COMPILE) && defined (HOST_BITS_PER_INT) && defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_LONGLONG)
257 #if (HOST_BITS_PER_INT==32) && (HOST_BITS_PER_LONG==64) && (HOST_BITS_PER_LONGLONG==64)
258 #define REAL_ARITHMETIC