1 /* Target definitions for GCC for Intel 80386 running Solaris 2
2    Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3    2004
4    Free Software Foundation, Inc.
5    Contributed by Fred Fish (fnf@cygnus.com).
6 
7 This file is part of GCC.
8 
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13 
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING.  If not, write to
21 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.  */
23 
24 /* The Solaris 2.0 x86 linker botches alignment of code sections.
25    It tries to align to a 16 byte boundary by padding with 0x00000090
26    ints, rather than 0x90 bytes (nop).  This generates trash in the
27    ".init" section since the contribution from crtbegin.o is only 7
28    bytes.  The linker pads it to 16 bytes with a single 0x90 byte, and
29    two 0x00000090 ints, which generates a segmentation violation when
30    executed.  This macro forces the assembler to do the padding, since
31    it knows what it is doing.  */
32 #define FORCE_CODE_SECTION_ALIGN  asm(ALIGN_ASM_OP "16");
33 
34 /* Old versions of the Solaris assembler can not handle the difference of
35    labels in different sections, so force DW_EH_PE_datarel.  */
36 #undef ASM_PREFERRED_EH_DATA_FORMAT
37 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)			\
38   (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0)				\
39 	       | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4	\
40 		  : DW_EH_PE_datarel))					\
41    : DW_EH_PE_absptr)
42 
43 /* The Solaris linker will not merge a read-only .eh_frame section
44    with a read-write .eh_frame section.  None of the encodings used
45    with non-PIC code require runtime relocations.  In 64-bit mode,
46    since there is no backwards compatibility issue, we use a read-only
47    section for .eh_frame.  In 32-bit mode, we use a writable .eh_frame
48    section in order to be compatible with G++ for Solaris x86.  */
49 #undef EH_TABLES_CAN_BE_READ_ONLY
50 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
51 
52 /* Solaris 2/Intel as chokes on #line directives.  */
53 #undef CPP_SPEC
54 #define CPP_SPEC "%{.S:-P} %(cpp_subtarget)"
55 
56 /* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler
57    gives many warnings: R_386_32 relocation is used for symbol ".text".  */
58 #undef ASM_SPEC
59 #define ASM_SPEC "\
60 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
61 %(asm_cpu) \
62 "
63 
64 #define ASM_CPU_SPEC ""
65 
66 #undef SUBTARGET_EXTRA_SPECS
67 #define SUBTARGET_EXTRA_SPECS \
68   { "cpp_subtarget",	CPP_SUBTARGET_SPEC },	\
69   { "asm_cpu",		ASM_CPU_SPEC },		\
70   { "startfile_arch",	STARTFILE_ARCH_SPEC },	\
71   { "link_arch",	LINK_ARCH_SPEC }
72 
73 #undef LOCAL_LABEL_PREFIX
74 #define LOCAL_LABEL_PREFIX "."
75 
76 /* The 32-bit Solaris assembler does not support .quad.  Do not use it.  */
77 #ifndef TARGET_BI_ARCH
78 #undef ASM_QUAD
79 #endif
80 
81 /* The Solaris assembler wants a .local for non-exported aliases.  */
82 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)	\
83   do {							\
84     const char *declname =				\
85       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));	\
86     ASM_OUTPUT_DEF ((FILE), declname,			\
87 		    IDENTIFIER_POINTER (TARGET));	\
88     if (! TREE_PUBLIC (DECL))				\
89       {							\
90 	fprintf ((FILE), "%s", LOCAL_ASM_OP);		\
91 	assemble_name ((FILE), declname);		\
92 	fprintf ((FILE), "\n");				\
93       }							\
94   } while (0)
95 
96 /* Solaris-specific #pragmas are implemented on top of attributes.  Hook in
97    the bits from config/sol2.c.  */
98 #define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes
99 #define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE
100 
101 /* Output a simple call for .init/.fini.  */
102 #define ASM_OUTPUT_CALL(FILE, FN)				\
103   do								\
104     {								\
105       fprintf (FILE, "\tcall\t");				\
106       print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P');	\
107       fprintf (FILE, "\n");					\
108     }								\
109   while (0)
110 
111 /* We do not need NT_VERSION notes.  */
112 #undef X86_FILE_START_VERSION_DIRECTIVE
113 #define X86_FILE_START_VERSION_DIRECTIVE false
114