xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/i386/sol2.h (revision 9573673d78c64ea1eac42d7f2e9521be89932ae5)
1 /* Target definitions for GCC for Intel 80386 running Solaris 2
2    Copyright (C) 1993-2013 Free Software Foundation, Inc.
3    Contributed by Fred Fish (fnf@cygnus.com).
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11 
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20 
21 /* Augment i386/unix.h version to return 8-byte vectors in memory, matching
22    Sun Studio compilers until version 12, the only ones supported on
23    Solaris 9.  */
24 #undef TARGET_SUBTARGET_DEFAULT
25 #define TARGET_SUBTARGET_DEFAULT \
26 	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
27 
28 /* Old versions of the Solaris assembler can not handle the difference of
29    labels in different sections, so force DW_EH_PE_datarel.  */
30 #undef ASM_PREFERRED_EH_DATA_FORMAT
31 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)			\
32   (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0)				\
33 	       | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4	\
34 		  : DW_EH_PE_datarel))					\
35    : DW_EH_PE_absptr)
36 
37 /* The Solaris linker will not merge a read-only .eh_frame section
38    with a read-write .eh_frame section.  None of the encodings used
39    with non-PIC code require runtime relocations.  In 64-bit mode,
40    since there is no backwards compatibility issue, we use a read-only
41    section for .eh_frame.  In 32-bit mode, we use a writable .eh_frame
42    section in order to be compatible with G++ for Solaris x86.  */
43 #undef EH_TABLES_CAN_BE_READ_ONLY
44 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
45 
46 /* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
47    syntax.  */
48 #undef TARGET_SUN_TLS
49 #define TARGET_SUN_TLS 1
50 
51 #undef  SIZE_TYPE
52 #define SIZE_TYPE "unsigned int"
53 
54 #undef  PTRDIFF_TYPE
55 #define PTRDIFF_TYPE "int"
56 
57 /* Solaris 2/Intel as chokes on #line directives before Solaris 10.  */
58 #undef CPP_SPEC
59 #define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
60 
61 #define ASM_CPU_DEFAULT_SPEC ""
62 
63 #define ASM_CPU_SPEC ""
64 
65 /* Don't include ASM_PIC_SPEC.  While the Solaris 9 assembler accepts
66    -K PIC, it gives many warnings:
67 	R_386_32 relocation is used for symbol "<symbol>"
68    GNU as doesn't recognize -K at all.  */
69 #undef ASM_SPEC
70 #define ASM_SPEC ASM_SPEC_BASE
71 
72 #undef  ENDFILE_SPEC
73 #define ENDFILE_SPEC \
74   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
75    %{mpc32:crtprec32.o%s} \
76    %{mpc64:crtprec64.o%s} \
77    %{mpc80:crtprec80.o%s} \
78    crtend.o%s crtn.o%s"
79 
80 #define SUBTARGET_CPU_EXTRA_SPECS \
81   { "cpp_subtarget",	 CPP_SUBTARGET_SPEC },		\
82   { "asm_cpu",		 ASM_CPU_SPEC },		\
83   { "asm_cpu_default",	 ASM_CPU_DEFAULT_SPEC },	\
84 
85 #undef SUBTARGET_EXTRA_SPECS
86 #define SUBTARGET_EXTRA_SPECS \
87   { "startfile_arch",	STARTFILE_ARCH_SPEC },		\
88   { "link_arch",	LINK_ARCH_SPEC },		\
89   SUBTARGET_CPU_EXTRA_SPECS
90 
91 /* Register the Solaris-specific #pragma directives.  */
92 #define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
93 
94 #undef LOCAL_LABEL_PREFIX
95 #define LOCAL_LABEL_PREFIX "."
96 
97 /* The 32-bit Solaris assembler does not support .quad.  Do not use it.  */
98 #ifndef HAVE_AS_IX86_QUAD
99 #undef ASM_QUAD
100 #endif
101 
102 /* The Solaris assembler wants a .local for non-exported aliases.  */
103 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)	\
104   do {							\
105     const char *declname =				\
106       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));	\
107     ASM_OUTPUT_DEF ((FILE), declname,			\
108 		    IDENTIFIER_POINTER (TARGET));	\
109     if (! TREE_PUBLIC (DECL))				\
110       {							\
111 	fprintf ((FILE), "%s", LOCAL_ASM_OP);		\
112 	assemble_name ((FILE), declname);		\
113 	fprintf ((FILE), "\n");				\
114       }							\
115   } while (0)
116 
117 #ifndef USE_GAS
118 /* The Sun assembler uses .tcomm for TLS common sections.  */
119 #define TLS_COMMON_ASM_OP ".tcomm"
120 
121 /* Similar to the Sun assembler on SPARC, the native assembler requires
122    TLS objects to be declared as @tls_obj (not @tls_object).  Unlike SPARC,
123    gas doesn't understand this variant.  */
124 #undef  ASM_DECLARE_OBJECT_NAME
125 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)		\
126   do								\
127     {								\
128       HOST_WIDE_INT size;					\
129 								\
130       if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL))	\
131 	ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj");	\
132       else							\
133 	ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");	\
134 								\
135       size_directive_output = 0;				\
136       if (!flag_inhibit_size_directive				\
137 	  && (DECL) && DECL_SIZE (DECL))			\
138 	{							\
139 	  size_directive_output = 1;				\
140 	  size = int_size_in_bytes (TREE_TYPE (DECL));		\
141 	  ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);		\
142 	}							\
143 								\
144       ASM_OUTPUT_LABEL (FILE, NAME);				\
145     }								\
146   while (0)
147 #endif /* !USE_GAS */
148 
149 /* Output a simple call for .init/.fini.  */
150 #define ASM_OUTPUT_CALL(FILE, FN)				\
151   do								\
152     {								\
153       fprintf (FILE, "\tcall\t");				\
154       ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P');	\
155       fprintf (FILE, "\n");					\
156     }								\
157   while (0)
158 
159 #undef TARGET_ASM_NAMED_SECTION
160 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
161 
162 #ifndef USE_GAS
163 /* Emit COMDAT group signature symbols for Sun as.  */
164 #undef TARGET_ASM_FILE_END
165 #define TARGET_ASM_FILE_END solaris_file_end
166 #endif
167 
168 /* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so
169    inhibit their creation.  Also cf. sparc/sysv4.h.  */
170 #ifndef USE_GLD
171 #define CTORS_SECTION_ASM_OP	"\t.section\t.ctors, \"aw\""
172 #define DTORS_SECTION_ASM_OP	"\t.section\t.dtors, \"aw\""
173 #endif
174 
175 /* We do not need NT_VERSION notes.  */
176 #undef X86_FILE_START_VERSION_DIRECTIVE
177 #define X86_FILE_START_VERSION_DIRECTIVE false
178 
179 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
180    sections, so don't use them.  */
181 #ifndef USE_GLD
182 #define USE_HIDDEN_LINKONCE 0
183 #endif
184 
185 /* Put all *tf routines in libgcc.  */
186 #undef LIBGCC2_HAS_TF_MODE
187 #define LIBGCC2_HAS_TF_MODE 1
188 #define LIBGCC2_TF_CEXT q
189 #define TF_SIZE 113
190