svr4.h revision 132718
1187517Sgonzo/* Operating system specific defines to be used when targeting GCC for some
2187517Sgonzo   generic System V Release 4 system.
3187517Sgonzo   Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999,
4187517Sgonzo   2000, 2001 Free Software Foundation, Inc.
5187517Sgonzo   Contributed by Ron Guilmette (rfg@monkeys.com).
6187517Sgonzo
7187517SgonzoThis file is part of GCC.
8187517Sgonzo
9187517SgonzoGCC is free software; you can redistribute it and/or modify
10187517Sgonzoit under the terms of the GNU General Public License as published by
11187517Sgonzothe Free Software Foundation; either version 2, or (at your option)
12187517Sgonzoany later version.
13187517Sgonzo
14187517SgonzoGCC is distributed in the hope that it will be useful,
15187517Sgonzobut WITHOUT ANY WARRANTY; without even the implied warranty of
16187517SgonzoMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17187517SgonzoGNU General Public License for more details.
18187517Sgonzo
19187517SgonzoYou should have received a copy of the GNU General Public License
20187517Sgonzoalong with GCC; see the file COPYING.  If not, write to
21187517Sgonzothe Free Software Foundation, 59 Temple Place - Suite 330,
22187517SgonzoBoston, MA 02111-1307, USA.
23187517Sgonzo
24187517Sgonzo   To use this file, make up a line like that in config.gcc:
25187517Sgonzo
26187517Sgonzo	tm_file="$tm_file elfos.h svr4.h MACHINE/svr4.h"
27187517Sgonzo
28187517Sgonzo   where MACHINE is replaced by the name of the basic hardware that you
29187517Sgonzo   are targeting for.  Then, in the file MACHINE/svr4.h, put any really
30187517Sgonzo   system-specific defines (or overrides of defines) which you find that
31187517Sgonzo   you need.
32187517Sgonzo*/
33187517Sgonzo
34187517Sgonzo/* Define a symbol indicating that we are using svr4.h.  */
35187517Sgonzo#define USING_SVR4_H
36187517Sgonzo
37187517Sgonzo/* Cpp, assembler, linker, library, and startfile spec's.  */
38187517Sgonzo
39187517Sgonzo/* This defines which switch letters take arguments.  On svr4, most of
40187517Sgonzo   the normal cases (defined in gcc.c) apply, and we also have -h* and
41187517Sgonzo   -z* options (for the linker).  Note however that there is no such
42187517Sgonzo   thing as a -T option for svr4.  */
43187517Sgonzo
44187517Sgonzo#undef  SWITCH_TAKES_ARG
45188883Sgonzo#define SWITCH_TAKES_ARG(CHAR)		\
46188883Sgonzo  (DEFAULT_SWITCH_TAKES_ARG (CHAR)	\
47188883Sgonzo   || (CHAR) == 'h'			\
48188883Sgonzo   || (CHAR) == 'x'			\
49188883Sgonzo   || (CHAR) == 'z')
50188883Sgonzo
51188883Sgonzo/* This defines which multi-letter switches take arguments.  On svr4,
52187517Sgonzo   there are no such switches except those implemented by GCC itself.  */
53187517Sgonzo
54187517Sgonzo#define WORD_SWITCH_TAKES_ARG(STR)			\
55187517Sgonzo (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
56187517Sgonzo  && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
57187517Sgonzo  && strcmp (STR, "Tbss"))
58187517Sgonzo
59187517Sgonzo/* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
60187517Sgonzo   many of the specialized svr4 assembler options as seems reasonable,
61187517Sgonzo   given that there are certain options which we can't (or shouldn't)
62187517Sgonzo   support directly due to the fact that they conflict with other options
63187517Sgonzo   for other svr4 tools (e.g. ld) or with other options for GCC itself.
64187517Sgonzo   For example, we don't support the -o (output file) or -R (remove
65187517Sgonzo   input file) options because GCC already handles these things.  We
66187517Sgonzo   also don't support the -m (run m4) option for the assembler because
67187517Sgonzo   that conflicts with the -m (produce load map) option of the svr4
68187517Sgonzo   linker.  We do however allow passing arbitrary options to the svr4
69187517Sgonzo   assembler via the -Wa, option.
70187517Sgonzo
71187517Sgonzo   Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
72187517Sgonzo   option.
73187517Sgonzo
74187517Sgonzo   The svr4 assembler wants '-' on the command line if it's expected to
75187517Sgonzo   read its stdin.
76187517Sgonzo*/
77187517Sgonzo
78187517Sgonzo#undef  ASM_SPEC
79187517Sgonzo#define ASM_SPEC \
80187517Sgonzo  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
81187517Sgonzo
82187517Sgonzo#define AS_NEEDS_DASH_FOR_PIPED_INPUT
83187517Sgonzo
84187517Sgonzo/* Under svr4, the normal location of the `ld' and `as' programs is the
85187517Sgonzo   /usr/ccs/bin directory.  */
86187517Sgonzo
87187517Sgonzo#ifndef CROSS_COMPILE
88187517Sgonzo#undef  MD_EXEC_PREFIX
89187517Sgonzo#define MD_EXEC_PREFIX "/usr/ccs/bin/"
90187517Sgonzo#endif
91187517Sgonzo
92187517Sgonzo/* Under svr4, the normal location of the various *crt*.o files is the
93187517Sgonzo   /usr/ccs/lib directory.  */
94187517Sgonzo
95187517Sgonzo#ifndef CROSS_COMPILE
96187517Sgonzo#undef  MD_STARTFILE_PREFIX
97187517Sgonzo#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
98187517Sgonzo#endif
99187517Sgonzo
100187517Sgonzo/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
101187517Sgonzo   standard C library (unless we are building a shared library).  */
102187517Sgonzo
103187517Sgonzo#undef	LIB_SPEC
104187517Sgonzo#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
105187517Sgonzo
106187517Sgonzo/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
107187517Sgonzo   magical crtend.o file (see crtstuff.c) which provides part of the
108187517Sgonzo   support for getting C++ file-scope static object constructed before
109187517Sgonzo   entering `main', followed by the normal svr3/svr4 "finalizer" file,
110187517Sgonzo   which is either `gcrtn.o' or `crtn.o'.  */
111187517Sgonzo
112187517Sgonzo#undef  ENDFILE_SPEC
113187517Sgonzo#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
114187517Sgonzo
115187517Sgonzo/* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
116187517Sgonzo   for the special GCC options -static, -shared, and -symbolic which
117187517Sgonzo   allow us to link things in one of these three modes by applying the
118187517Sgonzo   appropriate combinations of options at link-time.  We also provide
119187517Sgonzo   support here for as many of the other svr4 linker options as seems
120187517Sgonzo   reasonable, given that some of them conflict with options for other
121187517Sgonzo   svr4 tools (e.g. the assembler).  In particular, we do support the
122187517Sgonzo   -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, -l*,
123187517Sgonzo   -o*, -r, -s, -u*, and -L* options are directly supported by gcc.c
124187517Sgonzo   itself.  We don't directly support the -m (generate load map)
125187517Sgonzo   option because that conflicts with the -m (run m4) option of the
126187517Sgonzo   svr4 assembler.  We also don't directly support the svr4 linker's
127187517Sgonzo   -I* or -M* options because these conflict with existing GCC
128187517Sgonzo   options.  We do however allow passing arbitrary options to the svr4
129187517Sgonzo   linker via the -Wl, option, in gcc.c.  We don't support the svr4
130187517Sgonzo   linker's -a option at all because it is totally useless and because
131187517Sgonzo   it conflicts with GCC's own -a option.
132187517Sgonzo
133187517Sgonzo   Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
134187517Sgonzo
135187517Sgonzo   When the -G link option is used (-shared and -symbolic) a final link is
136187517Sgonzo   not being done.  */
137187517Sgonzo
138187517Sgonzo#undef	LINK_SPEC
139187517Sgonzo#ifdef CROSS_COMPILE
140187517Sgonzo#define LINK_SPEC "%{h*} %{v:-V} \
141187517Sgonzo		   %{b} \
142187517Sgonzo		   %{static:-dn -Bstatic} \
143187517Sgonzo		   %{shared:-G -dy -z text} \
144187517Sgonzo		   %{symbolic:-Bsymbolic -G -dy -z text} \
145188883Sgonzo		   %{G:-G} \
146188883Sgonzo		   %{YP,*} \
147188883Sgonzo		   %{Qy:} %{!Qn:-Qy}"
148188883Sgonzo#else
149188883Sgonzo#define LINK_SPEC "%{h*} %{v:-V} \
150187517Sgonzo		   %{b} \
151187517Sgonzo		   %{static:-dn -Bstatic} \
152188883Sgonzo		   %{shared:-G -dy -z text} \
153188883Sgonzo		   %{symbolic:-Bsymbolic -G -dy -z text} \
154188883Sgonzo		   %{G:-G} \
155188883Sgonzo		   %{YP,*} \
156187517Sgonzo		   %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
157187517Sgonzo		    %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \
158187517Sgonzo		   %{Qy:} %{!Qn:-Qy}"
159187517Sgonzo#endif
160187517Sgonzo
161187517Sgonzo/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o
162187517Sgonzo   or /usr/ccs/lib/values-Xa.o for each final link step (depending
163187517Sgonzo   upon the other gcc options selected, such as -ansi).  These files
164187517Sgonzo   each contain one (initialized) copy of a special variable called
165187517Sgonzo   `_lib_version'.  Each one of these files has `_lib_version' initialized
166187517Sgonzo   to a different (enum) value.  The SVR4 library routines query the
167187517Sgonzo   value of `_lib_version' at run to decide how they should behave.
168188883Sgonzo   Specifically, they decide (based upon the value of `_lib_version')
169187517Sgonzo   if they will act in a strictly ANSI conforming manner or not.  */
170187517Sgonzo
171187517Sgonzo#undef	STARTFILE_SPEC
172187517Sgonzo#define STARTFILE_SPEC "%{!shared: \
173187517Sgonzo			 %{!symbolic: \
174187517Sgonzo			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
175187517Sgonzo			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
176187517Sgonzo			%{ansi:values-Xc.o%s} \
177187517Sgonzo			%{!ansi:values-Xa.o%s} \
178187517Sgonzo 			crtbegin.o%s"
179188883Sgonzo
180188883Sgonzo/* The numbers used to denote specific machine registers in the System V
181188883Sgonzo   Release 4 DWARF debugging information are quite likely to be totally
182188883Sgonzo   different from the numbers used in BSD stabs debugging information
183187517Sgonzo   for the same kind of target machine.  Thus, we undefine the macro
184187517Sgonzo   DBX_REGISTER_NUMBER here as an extra inducement to get people to
185187517Sgonzo   provide proper machine-specific definitions of DBX_REGISTER_NUMBER
186187517Sgonzo   (which is also used to provide DWARF registers numbers in dwarfout.c)
187187517Sgonzo   in their tm.h files which include this file.  */
188187517Sgonzo
189187517Sgonzo#undef DBX_REGISTER_NUMBER
190187517Sgonzo
191187517Sgonzo/* Define the actual types of some ANSI-mandated types.  (These
192187517Sgonzo   definitions should work for most SVR4 systems).  */
193187517Sgonzo
194187517Sgonzo#undef  SIZE_TYPE
195187517Sgonzo#define SIZE_TYPE "unsigned int"
196187517Sgonzo
197187517Sgonzo#undef  PTRDIFF_TYPE
198187517Sgonzo#define PTRDIFF_TYPE "int"
199187517Sgonzo
200187517Sgonzo#undef  WCHAR_TYPE
201187517Sgonzo#define WCHAR_TYPE "long int"
202187517Sgonzo
203187517Sgonzo#undef  WCHAR_TYPE_SIZE
204187517Sgonzo#define WCHAR_TYPE_SIZE BITS_PER_WORD
205187517Sgonzo
206187517Sgonzo#define TARGET_HAS_F_SETLKW
207187517Sgonzo