OSDN Git Service

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