OSDN Git Service

2002-01-16 H.J. Lu <hjl@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / config / ptx4.h
1 /* Operating system specific defines to be used when targeting GCC for some
2    generic System V Release 4 system.
3    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
4    Contributed by Ron Guilmette (rfg@monkeys.com).
5    Renamed and changed to suit Dynix/ptx v4 and later.
6    Modified by Tim Wright (timw@sequent.com).
7    Modified by Janis Johnson (janis@us.ibm.com).
8   
9 This file is part of GNU CC.
10
11 GNU CC is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
14 any later version.
15
16 GNU CC is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with GNU CC; see the file COPYING.  If not, write to
23 the Free Software Foundation, 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA.
25
26 */
27
28 /* Define a symbol indicating that we are using svr4.h.  */
29 #define USING_SVR4_H
30
31 /* Use DWARF debugging info by default.  */
32
33 #undef PREFERRED_DEBUGGING_TYPE
34 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
35
36
37 /* Cpp, assembler, linker, library, and startfile spec's.  */
38
39 /* This defines which switch letters take arguments.  On svr4, most of
40    the normal cases (defined in gcc.c) apply, and we also have -h* and
41    -z* options (for the linker).  Note however that there is no such
42    thing as a -T option for svr4.  */
43
44 #define SWITCH_TAKES_ARG(CHAR) \
45   (   (CHAR) == 'D' \
46    || (CHAR) == 'U' \
47    || (CHAR) == 'o' \
48    || (CHAR) == 'e' \
49    || (CHAR) == 'u' \
50    || (CHAR) == 'I' \
51    || (CHAR) == 'm' \
52    || (CHAR) == 'L' \
53    || (CHAR) == 'A' \
54    || (CHAR) == 'h' \
55    || (CHAR) == 'z')
56
57 /* This defines which multi-letter switches take arguments.  On svr4,
58    there are no such switches except those implemented by GCC itself.  */
59
60 #define WORD_SWITCH_TAKES_ARG(STR)                      \
61  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                   \
62   && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")     \
63   && strcmp (STR, "Tbss"))
64
65 /* You should redefine CPP_PREDEFINES in any file which includes this one.
66    The definition should be appropriate for the type of target system
67    involved, and it should include any -A (assertion) options which are
68    appropriate for the given target system.  */
69 #undef CPP_PREDEFINES
70
71 /* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
72    many of the specialized svr4 assembler options as seems reasonable,
73    given that there are certain options which we can't (or shouldn't)
74    support directly due to the fact that they conflict with other options 
75    for other svr4 tools (e.g. ld) or with other options for GCC itself.
76    For example, we don't support the -o (output file) or -R (remove
77    input file) options because GCC already handles these things.  We
78    also don't support the -m (run m4) option for the assembler because
79    that conflicts with the -m (produce load map) option of the svr4
80    linker.  We do however allow passing arbitrary options to the svr4
81    assembler via the -Wa, option.
82
83    Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
84    option.
85 */
86
87 #undef ASM_SPEC
88 #ifdef USE_GAS
89 #define ASM_SPEC \
90   "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
91 #else
92 #define ASM_SPEC \
93   "-no_0f_fix -no_eflags_chk %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
94 #endif
95
96 /* svr4 assemblers need the `-' (indicating input from stdin) to come after
97    the -o option (and its argument) for some reason.  If we try to put it
98    before the -o option, the assembler will try to read the file named as
99    the output file in the -o option as an input file (after it has already
100    written some stuff to it) and the binary stuff contained therein will
101    cause totally confuse the assembler, resulting in many spurious error
102    messages.  */
103
104 #undef ASM_FINAL_SPEC
105 #define ASM_FINAL_SPEC "%{pipe:-}"
106
107 /* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
108    standard C library (unless we are building a shared library).  */
109
110 #undef  LIB_SPEC
111 #define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
112
113 /* Provide a LIBGCC_SPEC appropriate for svr4.  We also want to exclude
114    libgcc when -symbolic.  */
115
116 #undef  LIBGCC_SPEC
117 #define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
118
119 /* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
120    magical crtend.o file (see crtstuff.c) which provides part of the
121    support for getting C++ file-scope static object constructed before
122    entering `main', followed by the normal svr3/svr4 "finalizer" file,
123    which is either `gcrtn.o' or `crtn.o'.  */
124
125 #undef  ENDFILE_SPEC
126 #define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}"
127
128 /* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
129    for the special GCC options -static, -shared, and -symbolic which
130    allow us to link things in one of these three modes by applying the
131    appropriate combinations of options at link-time.  We also provide
132    support here for as many of the other svr4 linker options as seems
133    reasonable, given that some of them conflict with options for other
134    svr4 tools (e.g. the assembler).  In particular, we do support the
135    -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*,
136    -l*, -o*, -r, -s, -u*, and -L* options are directly supported
137    by gcc.c itself.  We don't directly support the -m (generate load
138    map) option because that conflicts with the -m (run m4) option of
139    the svr4 assembler.  We also don't directly support the svr4 linker's
140    -I* or -M* options because these conflict with existing GCC options.
141    We do however allow passing arbitrary options to the svr4 linker
142    via the -Wl, option.  We don't support the svr4 linker's -a option
143    at all because it is totally useless and because it conflicts with
144    GCC's own -a option.
145
146    Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
147
148    When the -G link option is used (-shared and -symbolic) a final link is
149    not being done.  */
150
151 #undef  LINK_SPEC
152 #define LINK_SPEC "%{h*} %{v:-V} \
153                    %{b} %{Wl,*:%*} \
154                    %{static:-dn -Bstatic} \
155                    %{shared:-G -dy -z text} \
156                    %{symbolic:-Bsymbolic -G -dy -z text} \
157                    %{G:-G} \
158                    %{YP,*} \
159                    %{!YP,*:%{p:-Y P,/lib/libp:/usr/lib/libp:/lib:/usr/lib} \
160                     %{!p:-Y P,/lib:/usr/lib}} \
161                    %{Qy:} %{!Qn:-Qy}"
162
163 /* Gcc automatically adds in one of the files /lib/values-Xc.o,
164    /lib/values-Xa.o, or /lib/values-Xt.o for each final link
165    step (depending upon the other gcc options selected, such as
166    -traditional and -ansi).  These files each contain one (initialized)
167    copy of a special variable called `_lib_version'.  Each one of these
168    files has `_lib_version' initialized to a different (enum) value.
169    The SVR4 library routines query the value of `_lib_version' at run
170    to decide how they should behave.  Specifically, they decide (based
171    upon the value of `_lib_version') if they will act in a strictly ANSI
172    conforming manner or not.
173 */
174
175 #undef  STARTFILE_SPEC
176 #define STARTFILE_SPEC "%{!shared: \
177                          %{!symbolic: \
178                           %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
179                         %{pg:gcrti.o%s}%{!pg:crti.o%s} \
180                         %{ansi:values-Xc.o%s} \
181                         %{!ansi: \
182                          %{traditional:values-Xt.o%s} \
183                          %{!traditional:values-Xa.o%s}} \
184                         crtbegin.o%s"
185
186 /* Allow #sccs in preprocessor.  */
187
188 #define SCCS_DIRECTIVE
189
190 /* Don't use bcopy, which doesn't handle overlaps before DYNIX/ptx 4.6. */
191
192 #undef HAVE_BCOPY
193
194 /* The numbers used to denote specific machine registers in the System V
195    Release 4 DWARF debugging information are quite likely to be totally
196    different from the numbers used in BSD stabs debugging information
197    for the same kind of target machine.  Thus, we undefine the macro
198    DBX_REGISTER_NUMBER here as an extra inducement to get people to
199    provide proper machine-specific definitions of DBX_REGISTER_NUMBER
200    (which is also used to provide DWARF registers numbers in dwarfout.c)
201    in their tm.h files which include this file.  */
202
203 #undef DBX_REGISTER_NUMBER
204
205 /* Like block addresses, stabs line numbers are relative to the
206    current function.  */
207
208 #undef ASM_OUTPUT_SOURCE_LINE
209 #define ASM_OUTPUT_SOURCE_LINE(file, line)                              \
210 do                                                                      \
211   {                                                                     \
212     static int sym_lineno = 1;                                          \
213     fprintf (file, ".stabn 68,0,%d,.LM%d-",                             \
214              line, sym_lineno);                                         \
215     assemble_name (file,                                                \
216                    XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
217     fprintf (file, "\n.LM%d:\n", sym_lineno);                           \
218     sym_lineno += 1;                                                    \
219   }                                                                     \
220 while (0)
221
222 /* Generate a blank trailing N_SO to mark the end of the .o file, since
223    we can't depend upon the linker to mark .o file boundaries with
224    embedded stabs.  */
225
226 #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
227 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)                 \
228   fprintf (FILE,                                                        \
229            "\t.text\n\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO)
230
231 /* Define the actual types of some ANSI-mandated types.  (These
232    definitions should work for most SVR4 systems).  */
233
234 #undef SIZE_TYPE
235 #define SIZE_TYPE "unsigned int"
236
237 #undef PTRDIFF_TYPE
238 #define PTRDIFF_TYPE "int"
239
240 #undef WCHAR_TYPE
241 #define WCHAR_TYPE "long int"
242
243 #undef WCHAR_TYPE_SIZE
244 #define WCHAR_TYPE_SIZE BITS_PER_WORD
245
246 /* This says how to output assembler code to declare an uninitialized
247    external linkage data item.  There's a bug in the DYNIX/ptx linker
248    (PR 254649) when the alignment for such an object is specified, so
249    ignore the ALIGN parameter. */
250
251 #undef ASM_OUTPUT_ALIGNED_COMMON
252 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
253 do {                                                                    \
254   fprintf ((FILE), "%s", COMMON_ASM_OP);                                \
255   assemble_name ((FILE), (NAME));                                       \
256   fprintf ((FILE), ",%u\n", (SIZE));                                    \
257 } while (0)