svr4.h revision 132718
142660Smarkm/* Operating system specific defines to be used when targeting GCC for some
2146515Sru   generic System V Release 4 system.
321495Sjmacd   Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999,
4146515Sru   2000, 2001 Free Software Foundation, Inc.
5146515Sru   Contributed by Ron Guilmette (rfg@monkeys.com).
621495Sjmacd
721495SjmacdThis file is part of GCC.
821495Sjmacd
921495SjmacdGCC is free software; you can redistribute it and/or modify
1021495Sjmacdit under the terms of the GNU General Public License as published by
1121495Sjmacdthe Free Software Foundation; either version 2, or (at your option)
1221495Sjmacdany later version.
1321495Sjmacd
1421495SjmacdGCC is distributed in the hope that it will be useful,
1521495Sjmacdbut WITHOUT ANY WARRANTY; without even the implied warranty of
1621495SjmacdMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1721495SjmacdGNU General Public License for more details.
1821495Sjmacd
1921495SjmacdYou should have received a copy of the GNU General Public License
2021495Sjmacdalong with GCC; see the file COPYING.  If not, write to
21146515Sruthe Free Software Foundation, 59 Temple Place - Suite 330,
2221495SjmacdBoston, MA 02111-1307, USA.
2321495Sjmacd
2421495Sjmacd   To use this file, make up a line like that in config.gcc:
25114472Sru
26114472Sru	tm_file="$tm_file elfos.h svr4.h MACHINE/svr4.h"
2721495Sjmacd
2821495Sjmacd   where MACHINE is replaced by the name of the basic hardware that you
2921495Sjmacd   are targeting for.  Then, in the file MACHINE/svr4.h, put any really
30146515Sru   system-specific defines (or overrides of defines) which you find that
31146515Sru   you need.
3221495Sjmacd*/
33146515Sru
3421495Sjmacd/* Define a symbol indicating that we are using svr4.h.  */
3521495Sjmacd#define USING_SVR4_H
3621495Sjmacd
37146515Sru/* Cpp, assembler, linker, library, and startfile spec's.  */
3821495Sjmacd
3921495Sjmacd/* This defines which switch letters take arguments.  On svr4, most of
4021495Sjmacd   the normal cases (defined in gcc.c) apply, and we also have -h* and
4121495Sjmacd   -z* options (for the linker).  Note however that there is no such
4221495Sjmacd   thing as a -T option for svr4.  */
4321495Sjmacd
4442660Smarkm#undef  SWITCH_TAKES_ARG
4521495Sjmacd#define SWITCH_TAKES_ARG(CHAR)		\
4621495Sjmacd  (DEFAULT_SWITCH_TAKES_ARG (CHAR)	\
4721495Sjmacd   || (CHAR) == 'h'			\
4821495Sjmacd   || (CHAR) == 'x'			\
4921495Sjmacd   || (CHAR) == 'z')
5021495Sjmacd
5121495Sjmacd/* This defines which multi-letter switches take arguments.  On svr4,
5221495Sjmacd   there are no such switches except those implemented by GCC itself.  */
5321495Sjmacd
54146515Sru#define WORD_SWITCH_TAKES_ARG(STR)			\
5521495Sjmacd (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
5621495Sjmacd  && strcmp (STR, "Tdata") && strcmp (STR, "Ttext")	\
5721495Sjmacd  && strcmp (STR, "Tbss"))
5821495Sjmacd
5921495Sjmacd/* Provide an ASM_SPEC appropriate for svr4.  Here we try to support as
6021495Sjmacd   many of the specialized svr4 assembler options as seems reasonable,
6121495Sjmacd   given that there are certain options which we can't (or shouldn't)
6221495Sjmacd   support directly due to the fact that they conflict with other options
6321495Sjmacd   for other svr4 tools (e.g. ld) or with other options for GCC itself.
6421495Sjmacd   For example, we don't support the -o (output file) or -R (remove
6556160Sru   input file) options because GCC already handles these things.  We
6621495Sjmacd   also don't support the -m (run m4) option for the assembler because
6721495Sjmacd   that conflicts with the -m (produce load map) option of the svr4
6821495Sjmacd   linker.  We do however allow passing arbitrary options to the svr4
6921495Sjmacd   assembler via the -Wa, option.
7021495Sjmacd
7121495Sjmacd   Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
7221495Sjmacd   option.
7321495Sjmacd
7421495Sjmacd   The svr4 assembler wants '-' on the command line if it's expected to
7542660Smarkm   read its stdin.
7642660Smarkm*/
7742660Smarkm
7856160Sru#undef  ASM_SPEC
7921495Sjmacd#define ASM_SPEC \
8056160Sru  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
8121495Sjmacd
8242660Smarkm#define AS_NEEDS_DASH_FOR_PIPED_INPUT
8342660Smarkm
8421495Sjmacd/* Under svr4, the normal location of the `ld' and `as' programs is the
8542660Smarkm   /usr/ccs/bin directory.  */
8642660Smarkm
8756160Sru#ifndef CROSS_COMPILE
8856160Sru#undef  MD_EXEC_PREFIX
8956160Sru#define MD_EXEC_PREFIX "/usr/ccs/bin/"
9056160Sru#endif
9156160Sru
9256160Sru/* Under svr4, the normal location of the various *crt*.o files is the
9342660Smarkm   /usr/ccs/lib directory.  */
9442660Smarkm
9521495Sjmacd#ifndef CROSS_COMPILE
9642660Smarkm#undef  MD_STARTFILE_PREFIX
9742660Smarkm#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
9842660Smarkm#endif
9921495Sjmacd
10042660Smarkm/* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
10121495Sjmacd   standard C library (unless we are building a shared library).  */
10242660Smarkm
10342660Smarkm#undef	LIB_SPEC
10421495Sjmacd#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
10542660Smarkm
10642660Smarkm/* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
10721495Sjmacd   magical crtend.o file (see crtstuff.c) which provides part of the
10842660Smarkm   support for getting C++ file-scope static object constructed before
10942660Smarkm   entering `main', followed by the normal svr3/svr4 "finalizer" file,
11042660Smarkm   which is either `gcrtn.o' or `crtn.o'.  */
11121495Sjmacd
11221495Sjmacd#undef  ENDFILE_SPEC
11321495Sjmacd#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
11421495Sjmacd
11521495Sjmacd/* Provide a LINK_SPEC appropriate for svr4.  Here we provide support
11621495Sjmacd   for the special GCC options -static, -shared, and -symbolic which
11721495Sjmacd   allow us to link things in one of these three modes by applying the
11821495Sjmacd   appropriate combinations of options at link-time.  We also provide
11921495Sjmacd   support here for as many of the other svr4 linker options as seems
12056160Sru   reasonable, given that some of them conflict with options for other
12121495Sjmacd   svr4 tools (e.g. the assembler).  In particular, we do support the
12221495Sjmacd   -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, -l*,
12321495Sjmacd   -o*, -r, -s, -u*, and -L* options are directly supported by gcc.c
12421495Sjmacd   itself.  We don't directly support the -m (generate load map)
12521495Sjmacd   option because that conflicts with the -m (run m4) option of the
12621495Sjmacd   svr4 assembler.  We also don't directly support the svr4 linker's
12721495Sjmacd   -I* or -M* options because these conflict with existing GCC
12821495Sjmacd   options.  We do however allow passing arbitrary options to the svr4
12921495Sjmacd   linker via the -Wl, option, in gcc.c.  We don't support the svr4
13021495Sjmacd   linker's -a option at all because it is totally useless and because
13121495Sjmacd   it conflicts with GCC's own -a option.
13221495Sjmacd
13321495Sjmacd   Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
13421495Sjmacd
13542660Smarkm   When the -G link option is used (-shared and -symbolic) a final link is
13621495Sjmacd   not being done.  */
13721495Sjmacd
13821495Sjmacd#undef	LINK_SPEC
13921495Sjmacd#ifdef CROSS_COMPILE
14021495Sjmacd#define LINK_SPEC "%{h*} %{v:-V} \
14121495Sjmacd		   %{b} \
14221495Sjmacd		   %{static:-dn -Bstatic} \
14342660Smarkm		   %{shared:-G -dy -z text} \
14421495Sjmacd		   %{symbolic:-Bsymbolic -G -dy -z text} \
14521495Sjmacd		   %{G:-G} \
14621495Sjmacd		   %{YP,*} \
14721495Sjmacd		   %{Qy:} %{!Qn:-Qy}"
14821495Sjmacd#else
14921495Sjmacd#define LINK_SPEC "%{h*} %{v:-V} \
15021495Sjmacd		   %{b} \
15121495Sjmacd		   %{static:-dn -Bstatic} \
15221495Sjmacd		   %{shared:-G -dy -z text} \
15321495Sjmacd		   %{symbolic:-Bsymbolic -G -dy -z text} \
15421495Sjmacd		   %{G:-G} \
15521495Sjmacd		   %{YP,*} \
15621495Sjmacd		   %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
15721495Sjmacd		    %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \
15821495Sjmacd		   %{Qy:} %{!Qn:-Qy}"
15921495Sjmacd#endif
16021495Sjmacd
16121495Sjmacd/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o
16221495Sjmacd   or /usr/ccs/lib/values-Xa.o for each final link step (depending
16321495Sjmacd   upon the other gcc options selected, such as -ansi).  These files
16421495Sjmacd   each contain one (initialized) copy of a special variable called
165146515Sru   `_lib_version'.  Each one of these files has `_lib_version' initialized
16621495Sjmacd   to a different (enum) value.  The SVR4 library routines query the
16721495Sjmacd   value of `_lib_version' at run to decide how they should behave.
16821495Sjmacd   Specifically, they decide (based upon the value of `_lib_version')
16921495Sjmacd   if they will act in a strictly ANSI conforming manner or not.  */
17021495Sjmacd
17121495Sjmacd#undef	STARTFILE_SPEC
17221495Sjmacd#define STARTFILE_SPEC "%{!shared: \
17321495Sjmacd			 %{!symbolic: \
17421495Sjmacd			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
17521495Sjmacd			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
17621495Sjmacd			%{ansi:values-Xc.o%s} \
17721495Sjmacd			%{!ansi:values-Xa.o%s} \
17821495Sjmacd 			crtbegin.o%s"
17921495Sjmacd
18021495Sjmacd/* The numbers used to denote specific machine registers in the System V
18121495Sjmacd   Release 4 DWARF debugging information are quite likely to be totally
18221495Sjmacd   different from the numbers used in BSD stabs debugging information
18321495Sjmacd   for the same kind of target machine.  Thus, we undefine the macro
18442660Smarkm   DBX_REGISTER_NUMBER here as an extra inducement to get people to
18521495Sjmacd   provide proper machine-specific definitions of DBX_REGISTER_NUMBER
18621495Sjmacd   (which is also used to provide DWARF registers numbers in dwarfout.c)
18721495Sjmacd   in their tm.h files which include this file.  */
18821495Sjmacd
18921495Sjmacd#undef DBX_REGISTER_NUMBER
19021495Sjmacd
19121495Sjmacd/* Define the actual types of some ANSI-mandated types.  (These
19221495Sjmacd   definitions should work for most SVR4 systems).  */
19321495Sjmacd
19421495Sjmacd#undef  SIZE_TYPE
19542660Smarkm#define SIZE_TYPE "unsigned int"
19621495Sjmacd
19721495Sjmacd#undef  PTRDIFF_TYPE
19821495Sjmacd#define PTRDIFF_TYPE "int"
19942660Smarkm
20021495Sjmacd#undef  WCHAR_TYPE
20121495Sjmacd#define WCHAR_TYPE "long int"
20221495Sjmacd
20321495Sjmacd#undef  WCHAR_TYPE_SIZE
20421495Sjmacd#define WCHAR_TYPE_SIZE BITS_PER_WORD
20521495Sjmacd
20642660Smarkm#define TARGET_HAS_F_SETLKW
20742660Smarkm