]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/sol2.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / i386 / sol2.h
1 /* Target definitions for GCC for Intel 80386 running Solaris 2
2 Copyright (C) 1993-2018 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 #define SUBTARGET_OPTIMIZATION_OPTIONS \
22 { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 }
23
24 /* 32-bit Solaris/x86 only guarantees 4-byte stack alignment as required by
25 the i386 psABI, so realign it as necessary for SSE instructions. */
26 #undef STACK_REALIGN_DEFAULT
27 #define STACK_REALIGN_DEFAULT (TARGET_64BIT ? 0 : 1)
28
29 /* Old versions of the Solaris assembler can not handle the difference of
30 labels in different sections, so force DW_EH_PE_datarel if so. */
31 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
32 #undef ASM_PREFERRED_EH_DATA_FORMAT
33 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
34 (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0) \
35 | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
36 : DW_EH_PE_datarel)) \
37 : DW_EH_PE_absptr)
38 #endif
39
40 /* The Solaris linker will not merge a read-only .eh_frame section
41 with a read-write .eh_frame section. None of the encodings used
42 with non-PIC code require runtime relocations. In 64-bit mode,
43 since there is no backwards compatibility issue, we use a read-only
44 section for .eh_frame. In 32-bit mode, we use a writable .eh_frame
45 section in order to be compatible with G++ for Solaris x86. */
46 #undef EH_TABLES_CAN_BE_READ_ONLY
47 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
48
49 /* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
50 syntax. */
51 #undef TARGET_SUN_TLS
52 #define TARGET_SUN_TLS 1
53
54 /* Solaris 2/Intel as chokes on #line directives before Solaris 10. */
55 #undef CPP_SPEC
56 #define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
57
58 /* GNU as understands --32 and --64, but the native Solaris
59 assembler requires -xarch=generic or -xarch=generic64 instead. */
60 #ifdef USE_GAS
61 #define ASM_CPU32_DEFAULT_SPEC "--32"
62 #define ASM_CPU64_DEFAULT_SPEC "--64"
63 #else
64 #define ASM_CPU32_DEFAULT_SPEC "-xarch=generic"
65 #define ASM_CPU64_DEFAULT_SPEC "-xarch=generic64"
66 #endif
67
68 /* Since Studio 12.6, as needs -xbrace_comment=no so its AVX512 syntax is
69 fully compatible with gas. */
70 #ifdef HAVE_AS_XBRACE_COMMENT_OPTION
71 #define ASM_XBRACE_COMMENT_SPEC "-xbrace_comment=no"
72 #else
73 #define ASM_XBRACE_COMMENT_SPEC ""
74 #endif
75
76 #undef ASM_CPU_SPEC
77 #define ASM_CPU_SPEC "%(asm_cpu_default) " ASM_XBRACE_COMMENT_SPEC
78
79 /* Don't include ASM_PIC_SPEC. While the Solaris 10+ assembler accepts -K PIC,
80 it gives many warnings:
81 Absolute relocation is used for symbol "<symbol>"
82 GNU as doesn't recognize -K at all. */
83 #undef ASM_SPEC
84 #define ASM_SPEC ASM_SPEC_BASE
85
86 #define DEFAULT_ARCH32_P !TARGET_64BIT_DEFAULT
87
88 #define ARCH64_SUBDIR "amd64"
89
90 #ifdef USE_GLD
91 /* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
92 follow the Solaris 2 ABI. Prefer them if present. */
93 #ifdef HAVE_LD_SOL2_EMULATION
94 #define ARCH32_EMULATION "elf_i386_sol2"
95 #define ARCH64_EMULATION "elf_x86_64_sol2"
96 #else
97 #define ARCH32_EMULATION "elf_i386"
98 #define ARCH64_EMULATION "elf_x86_64"
99 #endif
100 #endif
101
102 #define ENDFILE_ARCH_SPEC \
103 "%{mpc32:crtprec32.o%s} \
104 %{mpc64:crtprec64.o%s} \
105 %{mpc80:crtprec80.o%s}"
106
107 #define SUBTARGET_CPU_EXTRA_SPECS \
108 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
109 { "asm_cpu", ASM_CPU_SPEC }, \
110 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
111
112 /* Register the Solaris-specific #pragma directives. */
113 #define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
114
115 #undef LOCAL_LABEL_PREFIX
116 #define LOCAL_LABEL_PREFIX "."
117
118 /* The Solaris 10 FCS as doesn't accept "#" comments, while later versions
119 do. */
120 #undef ASM_COMMENT_START
121 #define ASM_COMMENT_START "/"
122
123 /* The 32-bit Solaris assembler does not support .quad. Do not use it. */
124 #ifndef HAVE_AS_IX86_QUAD
125 #undef ASM_QUAD
126 #endif
127
128 /* The native Solaris assembler can't calculate the difference between
129 symbols in different sections, which causes problems for -fPIC jump
130 tables in .rodata. */
131 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
132 #undef JUMP_TABLES_IN_TEXT_SECTION
133 #define JUMP_TABLES_IN_TEXT_SECTION 1
134
135 /* The native Solaris assembler cannot handle the SYMBOL-. syntax, but
136 requires SYMBOL@rel/@rel64 instead. */
137 #define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
138 do { \
139 fputs (integer_asm_op (SIZE, FALSE), FILE); \
140 assemble_name (FILE, LABEL); \
141 fputs (SIZE == 8 ? "@rel64" : "@rel", FILE); \
142 } while (0)
143 #endif
144
145 /* The Solaris assembler wants a .local for non-exported aliases. */
146 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
147 do { \
148 tree id = DECL_ASSEMBLER_NAME (DECL); \
149 ultimate_transparent_alias_target (&id); \
150 const char *declname = IDENTIFIER_POINTER (id); \
151 ASM_OUTPUT_DEF ((FILE), declname, \
152 IDENTIFIER_POINTER (TARGET)); \
153 if (! TREE_PUBLIC (DECL)) \
154 { \
155 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
156 assemble_name ((FILE), declname); \
157 fprintf ((FILE), "\n"); \
158 } \
159 } while (0)
160
161 #ifndef USE_GAS
162 /* The Sun assembler uses .tcomm for TLS common sections. */
163 #define TLS_COMMON_ASM_OP ".tcomm"
164
165 /* Similar to the Sun assembler on SPARC, the native assembler requires
166 TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC,
167 gas doesn't understand this variant. */
168 #undef ASM_DECLARE_OBJECT_NAME
169 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
170 do \
171 { \
172 HOST_WIDE_INT size; \
173 \
174 if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
175 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \
176 else \
177 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
178 \
179 size_directive_output = 0; \
180 if (!flag_inhibit_size_directive \
181 && (DECL) && DECL_SIZE (DECL)) \
182 { \
183 size_directive_output = 1; \
184 size = int_size_in_bytes (TREE_TYPE (DECL)); \
185 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
186 } \
187 \
188 ASM_OUTPUT_LABEL (FILE, NAME); \
189 } \
190 while (0)
191 #endif /* !USE_GAS */
192
193 /* As in sparc/sol2.h, override the default from i386/x86-64.h to work
194 around Sun as TLS bug. */
195 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
196 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
197 do \
198 { \
199 if (TARGET_SUN_TLS \
200 && in_section \
201 && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \
202 switch_to_section (bss_section); \
203 x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); \
204 } \
205 while (0)
206
207 /* Output a simple call for .init/.fini. */
208 #define ASM_OUTPUT_CALL(FILE, FN) \
209 do \
210 { \
211 fprintf (FILE, "\tcall\t"); \
212 ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
213 fprintf (FILE, "\n"); \
214 } \
215 while (0)
216
217 #undef TARGET_ASM_NAMED_SECTION
218 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
219
220 /* Sun as requires "h" flag for large sections, GNU as can do without, but
221 accepts "l". */
222 #ifdef USE_GAS
223 #define MACH_DEP_SECTION_ASM_FLAG 'l'
224 #else
225 #define MACH_DEP_SECTION_ASM_FLAG 'h'
226 #endif
227
228 #ifndef USE_GAS
229 /* Emit COMDAT group signature symbols for Sun as. */
230 #undef TARGET_ASM_FILE_END
231 #define TARGET_ASM_FILE_END solaris_file_end
232 #endif
233
234 /* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so
235 inhibit their creation. Also cf. sparc/sysv4.h. */
236 #ifndef USE_GLD
237 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
238 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
239 #endif
240
241 #ifndef USE_GAS
242 #define LARGECOMM_SECTION_ASM_OP "\t.lbcomm\t"
243 #endif
244
245 #define USE_IX86_FRAME_POINTER 1
246 #define USE_X86_64_FRAME_POINTER 1
247
248 #undef NO_PROFILE_COUNTERS
249
250 #undef MCOUNT_NAME
251 #define MCOUNT_NAME "_mcount"
252
253 /* We do not need NT_VERSION notes. */
254 #undef X86_FILE_START_VERSION_DIRECTIVE
255 #define X86_FILE_START_VERSION_DIRECTIVE false
256
257 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
258 sections, so don't use them. */
259 #ifndef USE_GLD
260 #define USE_HIDDEN_LINKONCE 0
261 #endif