svr4.h revision 117395
198684Sdes/* Operating system specific defines to be used when targeting GCC for some
276259Sgreen   generic System V Release 4 system.
376259Sgreen   Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999,
476259Sgreen   2000, 2001 Free Software Foundation, Inc.
576259Sgreen   Contributed by Ron Guilmette (rfg@monkeys.com).
676259Sgreen
776259SgreenThis file is part of GNU CC.
876259Sgreen
976259SgreenGNU CC is free software; you can redistribute it and/or modify
1076259Sgreenit under the terms of the GNU General Public License as published by
1176259Sgreenthe Free Software Foundation; either version 2, or (at your option)
1276259Sgreenany later version.
1376259Sgreen
1476259SgreenGNU CC is distributed in the hope that it will be useful,
1592559Sdesbut WITHOUT ANY WARRANTY; without even the implied warranty of
1698941SdesMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1798941SdesGNU General Public License for more details.
1892559Sdes
1998941SdesYou should have received a copy of the GNU General Public License
2098941Sdesalong with GNU CC; see the file COPYING.  If not, write to
2198941Sdesthe Free Software Foundation, 59 Temple Place - Suite 330,
2276259SgreenBoston, MA 02111-1307, USA.
2398941Sdes
2476259Sgreen   To use this file, make up a line like that in config.gcc:
2576259Sgreen
2676259Sgreen	tm_file="$tm_file elfos.h svr4.h MACHINE/svr4.h"
2776259Sgreen
2876259Sgreen   where MACHINE is replaced by the name of the basic hardware that you
2992559Sdes   are targeting for.  Then, in the file MACHINE/svr4.h, put any really
3092559Sdes   system-specific defines (or overrides of defines) which you find that
3192559Sdes   you need.  For example, CPP_PREDEFINES is defined here with only the
3276259Sgreen   defined -Dunix and -DSVR4.  You should probably override that in your
3376259Sgreen   target-specific MACHINE/svr4.h file with a set of defines that
3476259Sgreen   includes these, but also contains an appropriate define for the type
3576259Sgreen   of hardware that you are targeting.
3676259Sgreen*/
3792559Sdes
3892559Sdes/* Define a symbol indicating that we are using svr4.h.  */
3992559Sdes#define USING_SVR4_H
4092559Sdes
4192559Sdes/* Cpp, assembler, linker, library, and startfile spec's.  */
4292559Sdes
4392559Sdes/* This defines which switch letters take arguments.  On svr4, most of
4492559Sdes   the normal cases (defined in gcc.c) apply, and we also have -h* and
4576259Sgreen   -z* options (for the linker).  Note however that there is no such
4698941Sdes   thing as a -T option for svr4.  */
4776259Sgreen
4898941Sdes#define SWITCH_TAKES_ARG(CHAR)		\
4976259Sgreen  (DEFAULT_SWITCH_TAKES_ARG (CHAR)	\
5076259Sgreen   || (CHAR) == 'h'			\
5176259Sgreen   || (CHAR) == 'x'			\
5276259Sgreen   || (CHAR) == 'z')
5376259Sgreen
5476259Sgreen/* This defines which multi-letter switches take arguments.  On svr4,
5576259Sgreen   there are no such switches except those implemented by GCC itself.  */
5676259Sgreen
5776259Sgreen#define WORD_SWITCH_TAKES_ARG(STR)			\
5876259Sgreen (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
5976259Sgreen  && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
6076259Sgreen  && strcmp (STR, "Tbss"))
6176259Sgreen
6276259Sgreen/* You should redefine CPP_PREDEFINES in any file which includes this one.
6376259Sgreen   The definition should be appropriate for the type of target system
6476259Sgreen   involved, and it should include any -A (assertion) options which are
6576259Sgreen   appropriate for the given target system.  */
6676259Sgreen#undef CPP_PREDEFINES
6776259Sgreen
6892559Sdes/* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
6976259Sgreen   many of the specialized svr4 assembler options as seems reasonable,
7076259Sgreen   given that there are certain options which we can't (or shouldn't)
7176259Sgreen   support directly due to the fact that they conflict with other options
7276259Sgreen   for other svr4 tools (e.g. ld) or with other options for GCC itself.
7376259Sgreen   For example, we don't support the -o (output file) or -R (remove
7476259Sgreen   input file) options because GCC already handles these things.  We
7576259Sgreen   also don't support the -m (run m4) option for the assembler because
7676259Sgreen   that conflicts with the -m (produce load map) option of the svr4
7776259Sgreen   linker.  We do however allow passing arbitrary options to the svr4
7876259Sgreen   assembler via the -Wa, option.
7976259Sgreen
8076259Sgreen   Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
8176259Sgreen   option.
8276259Sgreen*/
8376259Sgreen
8476259Sgreen#undef  ASM_SPEC
8576259Sgreen#define ASM_SPEC \
8676259Sgreen  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
8776259Sgreen
8876259Sgreen/* svr4 assemblers need the `-' (indicating input from stdin) to come after
8976259Sgreen   the -o option (and its argument) for some reason.  If we try to put it
9076259Sgreen   before the -o option, the assembler will try to read the file named as
9176259Sgreen   the output file in the -o option as an input file (after it has already
9276259Sgreen   written some stuff to it) and the binary stuff contained therein will
9376259Sgreen   cause totally confuse the assembler, resulting in many spurious error
9476259Sgreen   messages.  */
9576259Sgreen
9692559Sdes#undef  ASM_FINAL_SPEC
9792559Sdes#define ASM_FINAL_SPEC "%|"
9876259Sgreen
9976259Sgreen/* Under svr4, the normal location of the `ld' and `as' programs is the
10076259Sgreen   /usr/ccs/bin directory.  */
10176259Sgreen
10276259Sgreen#ifndef CROSS_COMPILE
10376259Sgreen#undef  MD_EXEC_PREFIX
10476259Sgreen#define MD_EXEC_PREFIX "/usr/ccs/bin/"
10576259Sgreen#endif
10676259Sgreen
10792559Sdes/* Under svr4, the normal location of the various *crt*.o files is the
10876259Sgreen   /usr/ccs/lib directory.  */
10976259Sgreen
11076259Sgreen#ifndef CROSS_COMPILE
11176259Sgreen#undef  MD_STARTFILE_PREFIX
11276259Sgreen#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
11392559Sdes#endif
11476259Sgreen
11576259Sgreen/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
11676259Sgreen   standard C library (unless we are building a shared library).  */
11776259Sgreen
11876259Sgreen#undef	LIB_SPEC
11998941Sdes#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
12076259Sgreen
12198941Sdes/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
12276259Sgreen   magical crtend.o file (see crtstuff.c) which provides part of the
12398684Sdes   support for getting C++ file-scope static object constructed before
12498941Sdes   entering `main', followed by the normal svr3/svr4 "finalizer" file,
12598941Sdes   which is either `gcrtn.o' or `crtn.o'.  */
12698941Sdes
12798684Sdes#undef  ENDFILE_SPEC
12892559Sdes#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
12998941Sdes
13092559Sdes/* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
13198941Sdes   for the special GCC options -static, -shared, and -symbolic which
13292559Sdes   allow us to link things in one of these three modes by applying the
13392559Sdes   appropriate combinations of options at link-time.  We also provide
13498941Sdes   support here for as many of the other svr4 linker options as seems
13592559Sdes   reasonable, given that some of them conflict with options for other
13698941Sdes   svr4 tools (e.g. the assembler).  In particular, we do support the
13792559Sdes   -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, -l*,
13898941Sdes   -o*, -r, -s, -u*, and -L* options are directly supported by gcc.c
13998941Sdes   itself.  We don't directly support the -m (generate load map)
14098941Sdes   option because that conflicts with the -m (run m4) option of the
14198941Sdes   svr4 assembler.  We also don't directly support the svr4 linker's
14298941Sdes   -I* or -M* options because these conflict with existing GCC
14376259Sgreen   options.  We do however allow passing arbitrary options to the svr4
14498941Sdes   linker via the -Wl, option, in gcc.c.  We don't support the svr4
14576259Sgreen   linker's -a option at all because it is totally useless and because
14698941Sdes   it conflicts with GCC's own -a option.
14798684Sdes
14898684Sdes   Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
14998941Sdes
15098684Sdes   When the -G link option is used (-shared and -symbolic) a final link is
15198941Sdes   not being done.  */
15298941Sdes
15398941Sdes#undef	LINK_SPEC
15498941Sdes#ifdef CROSS_COMPILE
15598941Sdes#define LINK_SPEC "%{h*} %{v:-V} \
15698941Sdes		   %{b} \
15798941Sdes		   %{static:-dn -Bstatic} \
15898941Sdes		   %{shared:-G -dy -z text} \
15998941Sdes		   %{symbolic:-Bsymbolic -G -dy -z text} \
16098941Sdes		   %{G:-G} \
16198941Sdes		   %{YP,*} \
16298941Sdes		   %{Qy:} %{!Qn:-Qy}"
16398941Sdes#else
16498941Sdes#define LINK_SPEC "%{h*} %{v:-V} \
16598941Sdes		   %{b} \
16698941Sdes		   %{static:-dn -Bstatic} \
16798941Sdes		   %{shared:-G -dy -z text} \
16898941Sdes		   %{symbolic:-Bsymbolic -G -dy -z text} \
16998941Sdes		   %{G:-G} \
170		   %{YP,*} \
171		   %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
172		    %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \
173		   %{Qy:} %{!Qn:-Qy}"
174#endif
175
176/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o
177   or /usr/ccs/lib/values-Xa.o for each final link step (depending
178   upon the other gcc options selected, such as -ansi).  These files
179   each contain one (initialized) copy of a special variable called
180   `_lib_version'.  Each one of these files has `_lib_version' initialized
181   to a different (enum) value.  The SVR4 library routines query the
182   value of `_lib_version' at run to decide how they should behave.
183   Specifically, they decide (based upon the value of `_lib_version')
184   if they will act in a strictly ANSI conforming manner or not.  */
185
186#undef	STARTFILE_SPEC
187#define STARTFILE_SPEC "%{!shared: \
188			 %{!symbolic: \
189			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
190			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
191			%{ansi:values-Xc.o%s} \
192			%{!ansi:values-Xa.o%s} \
193 			crtbegin.o%s"
194
195/* The numbers used to denote specific machine registers in the System V
196   Release 4 DWARF debugging information are quite likely to be totally
197   different from the numbers used in BSD stabs debugging information
198   for the same kind of target machine.  Thus, we undefine the macro
199   DBX_REGISTER_NUMBER here as an extra inducement to get people to
200   provide proper machine-specific definitions of DBX_REGISTER_NUMBER
201   (which is also used to provide DWARF registers numbers in dwarfout.c)
202   in their tm.h files which include this file.  */
203
204#undef DBX_REGISTER_NUMBER
205
206/* Define the actual types of some ANSI-mandated types.  (These
207   definitions should work for most SVR4 systems).  */
208
209#undef  SIZE_TYPE
210#define SIZE_TYPE "unsigned int"
211
212#undef  PTRDIFF_TYPE
213#define PTRDIFF_TYPE "int"
214
215#undef  WCHAR_TYPE
216#define WCHAR_TYPE "long int"
217
218#undef  WCHAR_TYPE_SIZE
219#define WCHAR_TYPE_SIZE BITS_PER_WORD
220
221/* This causes trouble, because it requires the host machine
222   to support ANSI C.  */
223/* #define MULTIBYTE_CHARS */
224
225#define TARGET_HAS_F_SETLKW
226