* x86-tune-sched.c (ix86_adjust_cost): Fix Zen support.
[official-gcc.git] / gcc / config / i386 / sol2.h
blob61733603fa21b4c5de4683620960d1993ebd6423
1 /* Target definitions for GCC for Intel 80386 running Solaris 2
2 Copyright (C) 1993-2017 Free Software Foundation, Inc.
3 Contributed by Fred Fish (fnf@cygnus.com).
5 This file is part of GCC.
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.
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.
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/>. */
21 #define SUBTARGET_OPTIMIZATION_OPTIONS \
22 { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 }
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)
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
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)
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
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)"
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
68 #undef ASM_CPU_SPEC
69 #define ASM_CPU_SPEC "%(asm_cpu_default)"
71 /* Don't include ASM_PIC_SPEC. While the Solaris 10+ assembler accepts -K PIC,
72 it gives many warnings:
73 Absolute relocation is used for symbol "<symbol>"
74 GNU as doesn't recognize -K at all. */
75 #undef ASM_SPEC
76 #define ASM_SPEC ASM_SPEC_BASE
78 #define DEFAULT_ARCH32_P !TARGET_64BIT_DEFAULT
80 #define ARCH64_SUBDIR "amd64"
82 #ifdef USE_GLD
83 /* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
84 follow the Solaris 2 ABI. Prefer them if present. */
85 #ifdef HAVE_LD_SOL2_EMULATION
86 #define ARCH32_EMULATION "elf_i386_sol2"
87 #define ARCH64_EMULATION "elf_x86_64_sol2"
88 #else
89 #define ARCH32_EMULATION "elf_i386"
90 #define ARCH64_EMULATION "elf_x86_64"
91 #endif
92 #endif
94 #define ENDFILE_ARCH_SPEC \
95 "%{mpc32:crtprec32.o%s} \
96 %{mpc64:crtprec64.o%s} \
97 %{mpc80:crtprec80.o%s}"
99 #define SUBTARGET_CPU_EXTRA_SPECS \
100 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
101 { "asm_cpu", ASM_CPU_SPEC }, \
102 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
104 /* Register the Solaris-specific #pragma directives. */
105 #define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
107 #undef LOCAL_LABEL_PREFIX
108 #define LOCAL_LABEL_PREFIX "."
110 /* The Solaris 10 FCS as doesn't accept "#" comments, while later versions
111 do. */
112 #undef ASM_COMMENT_START
113 #define ASM_COMMENT_START "/"
115 /* The 32-bit Solaris assembler does not support .quad. Do not use it. */
116 #ifndef HAVE_AS_IX86_QUAD
117 #undef ASM_QUAD
118 #endif
120 /* The native Solaris assembler can't calculate the difference between
121 symbols in different sections, which causes problems for -fPIC jump
122 tables in .rodata. */
123 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
124 #undef JUMP_TABLES_IN_TEXT_SECTION
125 #define JUMP_TABLES_IN_TEXT_SECTION 1
127 /* The native Solaris assembler cannot handle the SYMBOL-. syntax, but
128 requires SYMBOL@rel/@rel64 instead. */
129 #define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
130 do { \
131 fputs (integer_asm_op (SIZE, FALSE), FILE); \
132 assemble_name (FILE, LABEL); \
133 fputs (SIZE == 8 ? "@rel64" : "@rel", FILE); \
134 } while (0)
135 #endif
137 /* The Solaris assembler wants a .local for non-exported aliases. */
138 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
139 do { \
140 tree id = DECL_ASSEMBLER_NAME (DECL); \
141 ultimate_transparent_alias_target (&id); \
142 const char *declname = IDENTIFIER_POINTER (id); \
143 ASM_OUTPUT_DEF ((FILE), declname, \
144 IDENTIFIER_POINTER (TARGET)); \
145 if (! TREE_PUBLIC (DECL)) \
147 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
148 assemble_name ((FILE), declname); \
149 fprintf ((FILE), "\n"); \
151 } while (0)
153 #ifndef USE_GAS
154 /* The Sun assembler uses .tcomm for TLS common sections. */
155 #define TLS_COMMON_ASM_OP ".tcomm"
157 /* Similar to the Sun assembler on SPARC, the native assembler requires
158 TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC,
159 gas doesn't understand this variant. */
160 #undef ASM_DECLARE_OBJECT_NAME
161 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
162 do \
164 HOST_WIDE_INT size; \
166 if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
167 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \
168 else \
169 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
171 size_directive_output = 0; \
172 if (!flag_inhibit_size_directive \
173 && (DECL) && DECL_SIZE (DECL)) \
175 size_directive_output = 1; \
176 size = int_size_in_bytes (TREE_TYPE (DECL)); \
177 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
180 ASM_OUTPUT_LABEL (FILE, NAME); \
182 while (0)
183 #endif /* !USE_GAS */
185 /* As in sparc/sol2.h, override the default from i386/x86-64.h to work
186 around Sun as TLS bug. */
187 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
188 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
189 do \
191 if (TARGET_SUN_TLS \
192 && in_section \
193 && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \
194 switch_to_section (bss_section); \
195 x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); \
197 while (0)
199 /* Output a simple call for .init/.fini. */
200 #define ASM_OUTPUT_CALL(FILE, FN) \
201 do \
203 fprintf (FILE, "\tcall\t"); \
204 ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
205 fprintf (FILE, "\n"); \
207 while (0)
209 #undef TARGET_ASM_NAMED_SECTION
210 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
212 /* Sun as requires "h" flag for large sections, GNU as can do without, but
213 accepts "l". */
214 #ifdef USE_GAS
215 #define MACH_DEP_SECTION_ASM_FLAG 'l'
216 #else
217 #define MACH_DEP_SECTION_ASM_FLAG 'h'
218 #endif
220 #ifndef USE_GAS
221 /* Emit COMDAT group signature symbols for Sun as. */
222 #undef TARGET_ASM_FILE_END
223 #define TARGET_ASM_FILE_END solaris_file_end
224 #endif
226 /* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so
227 inhibit their creation. Also cf. sparc/sysv4.h. */
228 #ifndef USE_GLD
229 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
230 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
231 #endif
233 #ifndef USE_GAS
234 #define LARGECOMM_SECTION_ASM_OP "\t.lbcomm\t"
235 #endif
237 #define USE_IX86_FRAME_POINTER 1
238 #define USE_X86_64_FRAME_POINTER 1
240 #undef NO_PROFILE_COUNTERS
242 #undef MCOUNT_NAME
243 #define MCOUNT_NAME "_mcount"
245 /* We do not need NT_VERSION notes. */
246 #undef X86_FILE_START_VERSION_DIRECTIVE
247 #define X86_FILE_START_VERSION_DIRECTIVE false
249 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
250 sections, so don't use them. */
251 #ifndef USE_GLD
252 #define USE_HIDDEN_LINKONCE 0
253 #endif