sol2.h revision 132718
1132718Skan/* Target definitions for GCC for Intel 80386 running Solaris 2
2122180Skan   Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
390075Sobrien   Free Software Foundation, Inc.
450397Sobrien   Contributed by Fred Fish (fnf@cygnus.com).
518334Speter
6132718SkanThis file is part of GCC.
718334Speter
8132718SkanGCC 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
13132718SkanGCC 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
19132718Skanalong with GCC; see the file COPYING.  If not, write to
2018334Speterthe Free Software Foundation, 59 Temple Place - Suite 330,
2118334SpeterBoston, MA 02111-1307, USA.  */
2218334Speter
2318334Speter/* The Solaris 2.0 x86 linker botches alignment of code sections.
2418334Speter   It tries to align to a 16 byte boundary by padding with 0x00000090
2518334Speter   ints, rather than 0x90 bytes (nop).  This generates trash in the
2618334Speter   ".init" section since the contribution from crtbegin.o is only 7
2718334Speter   bytes.  The linker pads it to 16 bytes with a single 0x90 byte, and
2818334Speter   two 0x00000090 ints, which generates a segmentation violation when
2918334Speter   executed.  This macro forces the assembler to do the padding, since
3090075Sobrien   it knows what it is doing.  */
3190075Sobrien#define FORCE_CODE_SECTION_ALIGN  asm(ALIGN_ASM_OP "16");
3218334Speter
3390075Sobrien/* Select a format to encode pointers in exception handling data.  CODE
3490075Sobrien   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
3590075Sobrien   true if the symbol may be affected by dynamic relocations.  */
3690075Sobrien#undef ASM_PREFERRED_EH_DATA_FORMAT
3790075Sobrien#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)			\
3890075Sobrien  (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel	\
3990075Sobrien   : DW_EH_PE_absptr)
4018334Speter
4190075Sobrien/* Solaris 2/Intel as chokes on #line directives.  */
4218334Speter#undef CPP_SPEC
43117395Skan#define CPP_SPEC "%{.S:-P} %(cpp_subtarget)"
4418334Speter
45117395Skan/* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler
46117395Skan   gives many warnings: R_386_32 relocation is used for symbol ".text".  */
47117395Skan#undef ASM_SPEC
48117395Skan#define ASM_SPEC "\
49117395Skan%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
50117395Skan%(asm_cpu) \
5190075Sobrien"
5290075Sobrien
53117395Skan#define ASM_CPU_SPEC ""
54117395Skan
55117395Skan#undef SUBTARGET_EXTRA_SPECS
56117395Skan#define SUBTARGET_EXTRA_SPECS \
57117395Skan  { "cpp_subtarget",	CPP_SUBTARGET_SPEC },	\
58117395Skan  { "asm_cpu",		ASM_CPU_SPEC },		\
59117395Skan  { "startfile_arch",	STARTFILE_ARCH_SPEC },	\
60117395Skan  { "link_arch",	LINK_ARCH_SPEC }
6118334Speter
6252284Sobrien#undef LOCAL_LABEL_PREFIX
6352284Sobrien#define LOCAL_LABEL_PREFIX "."
6496263Sobrien
6596263Sobrien/* The Solaris assembler does not support .quad.  Do not use it.  */
6696263Sobrien#undef ASM_QUAD
67132718Skan
68132718Skan/* The Solaris assembler wants a .local for non-exported aliases.  */
69132718Skan#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)	\
70132718Skan  do {							\
71132718Skan    const char *declname =				\
72132718Skan      IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));	\
73132718Skan    ASM_OUTPUT_DEF ((FILE), declname,			\
74132718Skan		    IDENTIFIER_POINTER (TARGET));	\
75132718Skan    if (! TREE_PUBLIC (DECL))				\
76132718Skan      {							\
77132718Skan	fprintf ((FILE), "%s", LOCAL_ASM_OP);		\
78132718Skan	assemble_name ((FILE), declname);		\
79132718Skan	fprintf ((FILE), "\n");				\
80132718Skan      }							\
81132718Skan  } while (0)
82