svr4.h revision 259563
1245803Stheraven/* Operating system specific defines to be used when targeting GCC for some
2245803Stheraven   generic System V Release 4 system.
3245803Stheraven   Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999,
4245803Stheraven   2000, 2001 Free Software Foundation, Inc.
5245803Stheraven   Contributed by Ron Guilmette (rfg@monkeys.com).
6245803Stheraven
7245803StheravenThis file is part of GCC.
8245803Stheraven
9245803StheravenGCC is free software; you can redistribute it and/or modify
10245803Stheravenit under the terms of the GNU General Public License as published by
11245803Stheraventhe Free Software Foundation; either version 2, or (at your option)
12245803Stheravenany later version.
13245803Stheraven
14245803StheravenGCC is distributed in the hope that it will be useful,
15245803Stheravenbut WITHOUT ANY WARRANTY; without even the implied warranty of
16245803StheravenMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17245803StheravenGNU General Public License for more details.
18245803Stheraven
19245803StheravenYou should have received a copy of the GNU General Public License
20245803Stheravenalong with GCC; see the file COPYING.  If not, write to
21245803Stheraventhe Free Software Foundation, 51 Franklin Street, Fifth Floor,
22245803StheravenBoston, MA 02110-1301, USA.
23245803Stheraven
24245803Stheraven   To use this file, make up a line like that in config.gcc:
25245803Stheraven
26245803Stheraven	tm_file="$tm_file elfos.h svr4.h MACHINE/svr4.h"
27245803Stheraven
28245803Stheraven   where MACHINE is replaced by the name of the basic hardware that you
29245803Stheraven   are targeting for.  Then, in the file MACHINE/svr4.h, put any really
30245803Stheraven   system-specific defines (or overrides of defines) which you find that
31245803Stheraven   you need.
32245803Stheraven*/
33253149Stheraven
34253149Stheraven/* Define a symbol indicating that we are using svr4.h.  */
35245803Stheraven#define USING_SVR4_H
36245803Stheraven
37245803Stheraven/* Cpp, assembler, linker, library, and startfile spec's.  */
38245839Stheraven
39245839Stheraven/* This defines which switch letters take arguments.  On svr4, most of
40245803Stheraven   the normal cases (defined in gcc.c) apply, and we also have -h* and
41245803Stheraven   -z* options (for the linker).  Note however that there is no such
42245839Stheraven   thing as a -T option for svr4.  */
43245839Stheraven
44245839Stheraven#undef  SWITCH_TAKES_ARG
45245803Stheraven#define SWITCH_TAKES_ARG(CHAR)		\
46245803Stheraven  (DEFAULT_SWITCH_TAKES_ARG (CHAR)	\
47245803Stheraven   || (CHAR) == 'h'			\
48245803Stheraven   || (CHAR) == 'x'			\
49245803Stheraven   || (CHAR) == 'z')
50245803Stheraven
51245803Stheraven/* This defines which multi-letter switches take arguments.  On svr4,
52245803Stheraven   there are no such switches except those implemented by GCC itself.  */
53245803Stheraven
54245803Stheraven#define WORD_SWITCH_TAKES_ARG(STR)			\
55245803Stheraven (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
56245803Stheraven  && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
57245803Stheraven  && strcmp (STR, "Tbss"))
58245803Stheraven
59245803Stheraven/* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
60245803Stheraven   many of the specialized svr4 assembler options as seems reasonable,
61245803Stheraven   given that there are certain options which we can't (or shouldn't)
62245803Stheraven   support directly due to the fact that they conflict with other options
63245803Stheraven   for other svr4 tools (e.g. ld) or with other options for GCC itself.
64245803Stheraven   For example, we don't support the -o (output file) or -R (remove
65245803Stheraven   input file) options because GCC already handles these things.  We
66245803Stheraven   also don't support the -m (run m4) option for the assembler because
67245803Stheraven   that conflicts with the -m (produce load map) option of the svr4
68245803Stheraven   linker.  We do however allow passing arbitrary options to the svr4
69245803Stheraven   assembler via the -Wa, option.
70245803Stheraven
71245803Stheraven   Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
72245803Stheraven   option.
73245803Stheraven
74245803Stheraven   The svr4 assembler wants '-' on the command line if it's expected to
75245803Stheraven   read its stdin.
76245803Stheraven*/
77245803Stheraven
78245803Stheraven#undef  ASM_SPEC
79245803Stheraven#define ASM_SPEC \
80245803Stheraven  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
81245803Stheraven
82245803Stheraven#define AS_NEEDS_DASH_FOR_PIPED_INPUT
83245803Stheraven
84245803Stheraven/* Under svr4, the normal location of the `ld' and `as' programs is the
85245803Stheraven   /usr/ccs/bin directory.  */
86245803Stheraven
87245803Stheraven#ifndef CROSS_DIRECTORY_STRUCTURE
88245803Stheraven#undef  MD_EXEC_PREFIX
89245803Stheraven#define MD_EXEC_PREFIX "/usr/ccs/bin/"
90245803Stheraven#endif
91245803Stheraven
92245803Stheraven/* Under svr4, the normal location of the various *crt*.o files is the
93245803Stheraven   /usr/ccs/lib directory.  */
94245803Stheraven
95245803Stheraven#ifndef CROSS_DIRECTORY_STRUCTURE
96245803Stheraven#undef  MD_STARTFILE_PREFIX
97245803Stheraven#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
98245803Stheraven#endif
99245803Stheraven
100245803Stheraven/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
101245803Stheraven   standard C library (unless we are building a shared library).  */
102245803Stheraven
103245803Stheraven#undef	LIB_SPEC
104245803Stheraven#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
105245803Stheraven
106245803Stheraven/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
107245803Stheraven   magical crtend.o file (see crtstuff.c) which provides part of the
108245803Stheraven   support for getting C++ file-scope static object constructed before
109245803Stheraven   entering `main', followed by the normal svr3/svr4 "finalizer" file,
110245803Stheraven   which is either `gcrtn.o' or `crtn.o'.  */
111245803Stheraven
112245803Stheraven#undef  ENDFILE_SPEC
113245803Stheraven#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
114245803Stheraven
115245803Stheraven/* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
116245803Stheraven   for the special GCC options -static, -shared, and -symbolic which
117245803Stheraven   allow us to link things in one of these three modes by applying the
118245803Stheraven   appropriate combinations of options at link-time.  We also provide
119245803Stheraven   support here for as many of the other svr4 linker options as seems
120245803Stheraven   reasonable, given that some of them conflict with options for other
121245803Stheraven   svr4 tools (e.g. the assembler).  In particular, we do support the
122245803Stheraven   -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, -l*,
123245803Stheraven   -o*, -r, -s, -u*, and -L* options are directly supported by gcc.c
124245803Stheraven   itself.  We don't directly support the -m (generate load map)
125245803Stheraven   option because that conflicts with the -m (run m4) option of the
126245803Stheraven   svr4 assembler.  We also don't directly support the svr4 linker's
127245803Stheraven   -I* or -M* options because these conflict with existing GCC
128245803Stheraven   options.  We do however allow passing arbitrary options to the svr4
129245803Stheraven   linker via the -Wl, option, in gcc.c.  We don't support the svr4
130245803Stheraven   linker's -a option at all because it is totally useless and because
131245803Stheraven   it conflicts with GCC's own -a option.
132245803Stheraven
133245803Stheraven   Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
134245803Stheraven
135245803Stheraven   When the -G link option is used (-shared and -symbolic) a final link is
136245803Stheraven   not being done.  */
137245803Stheraven
138245803Stheraven#undef	LINK_SPEC
139245803Stheraven#ifdef CROSS_DIRECTORY_STRUCTURE
140245803Stheraven#define LINK_SPEC "%{h*} %{v:-V} \
141245803Stheraven		   %{b} \
142245803Stheraven		   %{static:-dn -Bstatic} \
143245803Stheraven		   %{shared:-G -dy -z text} \
144245803Stheraven		   %{symbolic:-Bsymbolic -G -dy -z text} \
145245803Stheraven		   %{G:-G} \
146245803Stheraven		   %{YP,*} \
147245803Stheraven		   %{Qy:} %{!Qn:-Qy}"
148245803Stheraven#else
149245803Stheraven#define LINK_SPEC "%{h*} %{v:-V} \
150245803Stheraven		   %{b} \
151245803Stheraven		   %{static:-dn -Bstatic} \
152245803Stheraven		   %{shared:-G -dy -z text} \
153245803Stheraven		   %{symbolic:-Bsymbolic -G -dy -z text} \
154245803Stheraven		   %{G:-G} \
155245803Stheraven		   %{YP,*} \
156245803Stheraven		   %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
157245803Stheraven		    %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \
158245803Stheraven		   %{Qy:} %{!Qn:-Qy}"
159245803Stheraven#endif
160245803Stheraven
161245803Stheraven/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o
162245803Stheraven   or /usr/ccs/lib/values-Xa.o for each final link step (depending
163245803Stheraven   upon the other gcc options selected, such as -ansi).  These files
164245803Stheraven   each contain one (initialized) copy of a special variable called
165245803Stheraven   `_lib_version'.  Each one of these files has `_lib_version' initialized
166245803Stheraven   to a different (enum) value.  The SVR4 library routines query the
167245803Stheraven   value of `_lib_version' at run to decide how they should behave.
168245803Stheraven   Specifically, they decide (based upon the value of `_lib_version')
169245803Stheraven   if they will act in a strictly ANSI conforming manner or not.  */
170245803Stheraven
171245803Stheraven#undef	STARTFILE_SPEC
172245803Stheraven#define STARTFILE_SPEC "%{!shared: \
173245803Stheraven			 %{!symbolic: \
174245803Stheraven			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
175245803Stheraven			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
176245803Stheraven			%{ansi:values-Xc.o%s} \
177245803Stheraven			%{!ansi:values-Xa.o%s} \
178245803Stheraven 			crtbegin.o%s"
179245803Stheraven
180245803Stheraven/* The numbers used to denote specific machine registers in the System V
181245803Stheraven   Release 4 DWARF debugging information are quite likely to be totally
182245803Stheraven   different from the numbers used in BSD stabs debugging information
183245803Stheraven   for the same kind of target machine.  Thus, we undefine the macro
184245803Stheraven   DBX_REGISTER_NUMBER here as an extra inducement to get people to
185245803Stheraven   provide proper machine-specific definitions of DBX_REGISTER_NUMBER
186245803Stheraven   (which is also used to provide DWARF registers numbers in dwarfout.c)
187245803Stheraven   in their tm.h files which include this file.  */
188245803Stheraven
189245803Stheraven#undef DBX_REGISTER_NUMBER
190245803Stheraven
191245803Stheraven/* Define the actual types of some ANSI-mandated types.  (These
192245803Stheraven   definitions should work for most SVR4 systems).  */
193245803Stheraven
194245803Stheraven#undef  SIZE_TYPE
195245803Stheraven#define SIZE_TYPE "unsigned int"
196245803Stheraven
197245803Stheraven#undef  PTRDIFF_TYPE
198245803Stheraven#define PTRDIFF_TYPE "int"
199245803Stheraven
200245803Stheraven#undef  WCHAR_TYPE
201245803Stheraven#define WCHAR_TYPE "long int"
202245803Stheraven
203245803Stheraven#undef  WCHAR_TYPE_SIZE
204245803Stheraven#define WCHAR_TYPE_SIZE BITS_PER_WORD
205245803Stheraven
206245803Stheraven#define TARGET_POSIX_IO
207245803Stheraven