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