1/* Operating system specific defines to be used when targeting GCC for
2   Sequent's Dynix/ptx v4 and later.
3   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
4   Free Software Foundation, Inc.
5   Generic SysV4 file Contributed by Ron Guilmette (rfg@monkeys.com).
6   Renamed and changed to suit Dynix/ptx v4 and later.
7   Modified by Tim Wright (timw@sequent.com).
8   Modified by Janis Johnson (janis@us.ibm.com).
9
10This file is part of GCC.
11
12GCC is free software; you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation; either version 2, or (at your option)
15any later version.
16
17GCC is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with GCC; see the file COPYING.  If not, write to
24the Free Software Foundation, 51 Franklin Street, Fifth Floor,
25Boston, MA 02110-1301, USA.
26
27*/
28
29/* Define a symbol indicating that we are using svr4.h.  */
30#define USING_SVR4_H
31
32/* Use DWARF 2 debugging info by default.  */
33
34#undef PREFERRED_DEBUGGING_TYPE
35#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
36
37#define DWARF2_DEBUGGING_INFO 1
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/* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
68   many of the specialized svr4 assembler options as seems reasonable,
69   given that there are certain options which we can't (or shouldn't)
70   support directly due to the fact that they conflict with other options
71   for other svr4 tools (e.g. ld) or with other options for GCC itself.
72   For example, we don't support the -o (output file) or -R (remove
73   input file) options because GCC already handles these things.  We
74   also don't support the -m (run m4) option for the assembler because
75   that conflicts with the -m (produce load map) option of the svr4
76   linker.  We do however allow passing arbitrary options to the svr4
77   assembler via the -Wa, option.
78
79   Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
80   option.
81*/
82
83#undef ASM_SPEC
84#ifdef USE_GAS
85#define ASM_SPEC \
86  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
87#else
88#define ASM_SPEC \
89  "-no_0f_fix -no_eflags_chk %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
90#endif
91
92#define AS_NEEDS_DASH_FOR_PIPED_INPUT
93
94/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
95   standard C library (unless we are building a shared library).  */
96
97#undef	LIB_SPEC
98#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
99
100/* Provide a LIBGCC_SPEC appropriate for svr4.  We also want to exclude
101   libgcc when -symbolic.  */
102
103#undef  LIBGCC_SPEC
104#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
105
106/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
107   magical crtend.o file (see crtstuff.c) which provides part of the
108   support for getting C++ file-scope static object constructed before
109   entering `main', followed by the normal svr3/svr4 "finalizer" file,
110   which is either `gcrtn.o' or `crtn.o'.  */
111
112#undef  ENDFILE_SPEC
113#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}"
114
115/* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
116   for the special GCC options -static, -shared, and -symbolic which
117   allow us to link things in one of these three modes by applying the
118   appropriate combinations of options at link-time.  We also provide
119   support here for as many of the other svr4 linker options as seems
120   reasonable, given that some of them conflict with options for other
121   svr4 tools (e.g. the assembler).  In particular, we do support the
122   -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*,
123   -l*, -o*, -r, -s, -u*, and -L* options are directly supported
124   by gcc.c itself.  We don't directly support the -m (generate load
125   map) option because that conflicts with the -m (run m4) option of
126   the svr4 assembler.  We also don't directly support the svr4 linker's
127   -I* or -M* options because these conflict with existing GCC options.
128   We do however allow passing arbitrary options to the svr4 linker
129   via the -Wl, option.  We don't support the svr4 linker's -a option
130   at all because it is totally useless and because it conflicts with
131   GCC's own -a option.
132
133   Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
134
135   When the -G link option is used (-shared and -symbolic) a final link is
136   not being done.  */
137
138#undef	LINK_SPEC
139#define LINK_SPEC "%{h*} %{v:-V} \
140		   %{b} \
141		   %{static:-dn -Bstatic} \
142		   %{shared:-G -dy -z text} \
143		   %{symbolic:-Bsymbolic -G -dy -z text} \
144		   %{G:-G} \
145		   %{YP,*} \
146		   %{!YP,*:%{p:-Y P,/lib/libp:/usr/lib/libp:/lib:/usr/lib} \
147		    %{!p:-Y P,/lib:/usr/lib}} \
148		   %{Qy:} %{!Qn:-Qy}"
149
150/* Gcc automatically adds in one of the files /lib/values-Xc.o
151   or /lib/values-Xa.o, for each final link step (depending upon the other
152   gcc options selected, such as -ansi).  These files each contain one
153   (initialized) copy of a special variable called `_lib_version'.  Each
154   one of these files has `_lib_version' initialized to a different (enum)
155   value.  The SVR4 library routines query the value of `_lib_version'
156   at run to decide how they should behave.  Specifically, they decide
157   (based upon the value of `_lib_version') if they will act in a strictly
158   ANSI conforming manner or not.
159*/
160
161#undef	STARTFILE_SPEC
162#define STARTFILE_SPEC "%{!shared: \
163			 %{!symbolic: \
164			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
165			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
166			%{ansi:values-Xc.o%s} \
167			%{!ansi:values-Xa.o%s} \
168 			crtbegin.o%s"
169
170/* Don't use bcopy, which doesn't handle overlaps before DYNIX/ptx 4.6.  */
171
172#undef HAVE_BCOPY
173
174/* The numbers used to denote specific machine registers in the System V
175   Release 4 DWARF debugging information are quite likely to be totally
176   different from the numbers used in BSD stabs debugging information
177   for the same kind of target machine.  Thus, we undefine the macro
178   DBX_REGISTER_NUMBER here as an extra inducement to get people to
179   provide proper machine-specific definitions of DBX_REGISTER_NUMBER
180   (which is also used to provide DWARF registers numbers in dwarfout.c)
181   in their tm.h files which include this file.  */
182
183#undef DBX_REGISTER_NUMBER
184
185/* Like block addresses, stabs line numbers are relative to the
186   current function.  */
187
188#define DBX_LINES_FUNCTION_RELATIVE 1
189
190/* Generate a blank trailing N_SO to mark the end of the .o file, since
191   we can't depend upon the linker to mark .o file boundaries with
192   embedded stabs.  */
193
194#define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
195
196/* Define the actual types of some ANSI-mandated types.  (These
197   definitions should work for most SVR4 systems).  */
198
199#undef SIZE_TYPE
200#define SIZE_TYPE "unsigned int"
201
202#undef PTRDIFF_TYPE
203#define PTRDIFF_TYPE "int"
204
205#undef WCHAR_TYPE
206#define WCHAR_TYPE "long int"
207
208#undef WCHAR_TYPE_SIZE
209#define WCHAR_TYPE_SIZE BITS_PER_WORD
210
211/* This says how to output assembler code to declare an uninitialized
212   external linkage data item.  There's a bug in the DYNIX/ptx linker
213   (PR 254649) when the alignment for such an object is specified, so
214   ignore the ALIGN parameter.  */
215
216#undef ASM_OUTPUT_ALIGNED_COMMON
217#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
218do {									\
219  fprintf ((FILE), "%s", COMMON_ASM_OP);				\
220  assemble_name ((FILE), (NAME));					\
221  fprintf ((FILE), ",%lu\n", (unsigned long)(SIZE)); \
222} while (0)
223
224