sol2.h revision 96263
118334Speter/* Target definitions for GNU compiler for Intel 80386 running Solaris 2
290075Sobrien   Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
390075Sobrien   Free Software Foundation, Inc.
450397Sobrien   Contributed by Fred Fish (fnf@cygnus.com).
518334Speter
618334SpeterThis file is part of GNU CC.
718334Speter
818334SpeterGNU CC is free software; you can redistribute it and/or modify
918334Speterit under the terms of the GNU General Public License as published by
1018334Speterthe Free Software Foundation; either version 2, or (at your option)
1118334Speterany later version.
1218334Speter
1318334SpeterGNU CC is distributed in the hope that it will be useful,
1418334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of
1518334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1618334SpeterGNU General Public License for more details.
1718334Speter
1818334SpeterYou should have received a copy of the GNU General Public License
1918334Speteralong with GNU CC; see the file COPYING.  If not, write to
2018334Speterthe Free Software Foundation, 59 Temple Place - Suite 330,
2118334SpeterBoston, MA 02111-1307, USA.  */
2218334Speter
2318334Speter
2452750Sobrien/* We use stabs-in-elf for debugging, because that is what the native
2552750Sobrien   toolchain uses.  */
2652750Sobrien#undef PREFERRED_DEBUGGING_TYPE
2752750Sobrien#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
2852750Sobrien
2952750Sobrien#if ! GAS_REJECTS_MINUS_S
3052750Sobrien
3152750Sobrien/*
3252750Sobrien  Changed from config/svr4.h in the following ways:
3352750Sobrien
3452750Sobrien  - Removed -Yd (neither the sun bundled assembler nor gas accept it).
3552750Sobrien  - Added "-s" so that stabs are not discarded.
3652750Sobrien*/
3752750Sobrien
3852750Sobrien#undef ASM_SPEC
3952750Sobrien#define ASM_SPEC \
4052750Sobrien  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s"
4152750Sobrien
4296263Sobrien#define CMOV_SUN_AS_SYNTAX 1
4396263Sobrien
4452750Sobrien#else /* GAS_REJECTS_MINUS_S */
4552750Sobrien
4652750Sobrien/* Same as above, except for -s, unsupported by GNU as.  */
4752750Sobrien#undef ASM_SPEC
4852750Sobrien#define ASM_SPEC \
4952750Sobrien  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*}"
5052750Sobrien
5152750Sobrien#endif /* GAS_REJECTS_MINUS_S */
5252750Sobrien
5318334Speter/* The Solaris 2.0 x86 linker botches alignment of code sections.
5418334Speter   It tries to align to a 16 byte boundary by padding with 0x00000090
5518334Speter   ints, rather than 0x90 bytes (nop).  This generates trash in the
5618334Speter   ".init" section since the contribution from crtbegin.o is only 7
5718334Speter   bytes.  The linker pads it to 16 bytes with a single 0x90 byte, and
5818334Speter   two 0x00000090 ints, which generates a segmentation violation when
5918334Speter   executed.  This macro forces the assembler to do the padding, since
6090075Sobrien   it knows what it is doing.  */
6190075Sobrien#define FORCE_CODE_SECTION_ALIGN  asm(ALIGN_ASM_OP "16");
6218334Speter
6390075Sobrien/* Select a format to encode pointers in exception handling data.  CODE
6490075Sobrien   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
6590075Sobrien   true if the symbol may be affected by dynamic relocations.  */
6690075Sobrien#undef ASM_PREFERRED_EH_DATA_FORMAT
6790075Sobrien#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)			\
6890075Sobrien  (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel	\
6990075Sobrien   : DW_EH_PE_absptr)
7018334Speter
7190075Sobrien/* Solaris 2/Intel uses a wint_t different from the default, as on SPARC.  */
7290075Sobrien#undef	WINT_TYPE
7390075Sobrien#define	WINT_TYPE "long int"
7490075Sobrien
7590075Sobrien#undef	WINT_TYPE_SIZE
7690075Sobrien#define	WINT_TYPE_SIZE BITS_PER_WORD
7790075Sobrien
7896263Sobrien#define HANDLE_PRAGMA_REDEFINE_EXTNAME 1
7996263Sobrien
8018334Speter#undef CPP_PREDEFINES
8118334Speter#define CPP_PREDEFINES \
8296263Sobrien  "-Dunix -D__svr4__ -D__SVR4 -Dsun -D__PRAGMA_REDEFINE_EXTNAME -Asystem=svr4"
8318334Speter
8490075Sobrien/* Solaris 2/Intel as chokes on #line directives.  */
8518334Speter#undef CPP_SPEC
8690075Sobrien#define CPP_SPEC \
8790075Sobrien  "%{.S:-P} \
8890075Sobrien   %(cpp_cpu) \
8990075Sobrien   %{pthreads:-D_REENTRANT -D_PTHREADS} \
9090075Sobrien   %{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} \
9118334Speter   %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude}"
9218334Speter
9390075Sobrien/* For C++ we need to add some additional macro definitions required
9490075Sobrien   by the C++ standard library.  */
9590075Sobrien#define CPLUSPLUS_CPP_SPEC "\
9690075Sobrien-D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 \
9790075Sobrien-D__EXTENSIONS__ \
9890075Sobrien%(cpp) \
9990075Sobrien"
10090075Sobrien
10118334Speter#undef LIB_SPEC
10218334Speter#define LIB_SPEC \
10390075Sobrien  "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
10490075Sobrien   %{!shared:\
10590075Sobrien     %{!symbolic:\
10690075Sobrien       %{pthreads:-lpthread} \
10790075Sobrien       %{!pthreads:%{threads:-lthread}} \
10890075Sobrien       -lc}}"
10918334Speter
11018334Speter#undef  ENDFILE_SPEC
11118334Speter#define ENDFILE_SPEC "crtend.o%s %{pg:crtn.o%s}%{!pg:crtn.o%s}"
11218334Speter
11350397Sobrien#undef	STARTFILE_SPEC
11450397Sobrien#define STARTFILE_SPEC "%{!shared: \
11550397Sobrien			 %{!symbolic: \
11650397Sobrien			  %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
11750397Sobrien			%{pg:gmon.o%s} crti.o%s \
11850397Sobrien			%{ansi:values-Xc.o%s} \
11950397Sobrien			%{!ansi: \
12050397Sobrien			 %{traditional:values-Xt.o%s} \
12150397Sobrien			 %{!traditional:values-Xa.o%s}} \
12250397Sobrien 			crtbegin.o%s"
12350397Sobrien
12418334Speter/* This should be the same as in svr4.h, except with -R added.  */
12518334Speter#undef LINK_SPEC
12618334Speter#define LINK_SPEC \
12750397Sobrien  "%{h*} %{v:-V} \
12818334Speter   %{b} %{Wl,*:%*} \
12918334Speter   %{static:-dn -Bstatic} \
13090075Sobrien   %{shared:-G -dy %{!mimpure-text:-z text}} \
13118334Speter   %{symbolic:-Bsymbolic -G -dy -z text} \
13218334Speter   %{G:-G} \
13318334Speter   %{YP,*} \
13418334Speter   %{R*} \
13518334Speter   %{compat-bsd: \
13650397Sobrien     %{!YP,*:%{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
13790075Sobrien             %{!pg:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
13890075Sobrien                   %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
13990075Sobrien             -R /usr/ucblib} \
14018334Speter   %{!compat-bsd: \
14150397Sobrien     %{!YP,*:%{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
14290075Sobrien             %{!pg:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
14390075Sobrien                   %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}} \
14418334Speter   %{Qy:} %{!Qn:-Qy}"
14518334Speter
14618334Speter/* This defines which switch letters take arguments.
14718334Speter   It is as in svr4.h but with -R added.  */
14818334Speter
14918334Speter#undef SWITCH_TAKES_ARG
15018334Speter#define SWITCH_TAKES_ARG(CHAR) \
15150397Sobrien  (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
15218334Speter   || (CHAR) == 'R' \
15318334Speter   || (CHAR) == 'h' \
15418334Speter   || (CHAR) == 'z')
15518334Speter
15690075Sobrien#define STDC_0_IN_SYSTEM_HEADERS 1
15752284Sobrien
15852284Sobrien#undef LOCAL_LABEL_PREFIX
15952284Sobrien#define LOCAL_LABEL_PREFIX "."
16096263Sobrien
16196263Sobrien/* The Solaris assembler does not support .quad.  Do not use it.  */
16296263Sobrien#undef ASM_QUAD
163