]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/sol2.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / i386 / sol2.h
CommitLineData
a805d35f 1/* Target definitions for GCC for Intel 80386 running Solaris 2
85ec4feb 2 Copyright (C) 1993-2018 Free Software Foundation, Inc.
7d4ea832 3 Contributed by Fred Fish (fnf@cygnus.com).
266f9541 4
a805d35f 5This file is part of GCC.
266f9541 6
a805d35f 7GCC is free software; you can redistribute it and/or modify
266f9541 8it under the terms of the GNU General Public License as published by
2f83c7d6 9the Free Software Foundation; either version 3, or (at your option)
266f9541
JW
10any later version.
11
a805d35f 12GCC is distributed in the hope that it will be useful,
266f9541
JW
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
2f83c7d6
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
266f9541 20
2cf03b11
RO
21#define SUBTARGET_OPTIMIZATION_OPTIONS \
22 { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 }
7ecfa34f 23
41604008
RO
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
a8e68029 29/* Old versions of the Solaris assembler can not handle the difference of
8117ef98
RO
30 labels in different sections, so force DW_EH_PE_datarel if so. */
31#ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
c1911346
RO
32#undef ASM_PREFERRED_EH_DATA_FORMAT
33#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
a8e68029
DJ
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)) \
c1911346 37 : DW_EH_PE_absptr)
8117ef98 38#endif
c1911346 39
1a35e62d
MM
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
7ecfa34f
RO
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
7ecfa34f 54/* Solaris 2/Intel as chokes on #line directives before Solaris 10. */
ebf3718c 55#undef CPP_SPEC
48137d59 56#define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
68d69835 57
2cf03b11
RO
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
8c2e5ecf
RO
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
2cf03b11 76#undef ASM_CPU_SPEC
8c2e5ecf 77#define ASM_CPU_SPEC "%(asm_cpu_default) " ASM_XBRACE_COMMENT_SPEC
fbdd5d87 78
2cf03b11
RO
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>"
7ecfa34f 82 GNU as doesn't recognize -K at all. */
8433a25e 83#undef ASM_SPEC
fcf7471a 84#define ASM_SPEC ASM_SPEC_BASE
8433a25e 85
2cf03b11
RO
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
df2a1cc4
RO
102#define ENDFILE_ARCH_SPEC \
103 "%{mpc32:crtprec32.o%s} \
b3fe1584 104 %{mpc64:crtprec64.o%s} \
df2a1cc4 105 %{mpc80:crtprec80.o%s}"
b3fe1584 106
7ecfa34f
RO
107#define SUBTARGET_CPU_EXTRA_SPECS \
108 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
fbdd5d87
RO
109 { "asm_cpu", ASM_CPU_SPEC }, \
110 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
7ecfa34f 111
7ecfa34f
RO
112/* Register the Solaris-specific #pragma directives. */
113#define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
62481348
JC
114
115#undef LOCAL_LABEL_PREFIX
116#define LOCAL_LABEL_PREFIX "."
60ffc997 117
2cf03b11
RO
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
a8e68029 123/* The 32-bit Solaris assembler does not support .quad. Do not use it. */
ed104137 124#ifndef HAVE_AS_IX86_QUAD
60ffc997 125#undef ASM_QUAD
a8e68029 126#endif
25178498 127
2cf03b11
RO
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
25178498
JJ
145/* The Solaris assembler wants a .local for non-exported aliases. */
146#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
147 do { \
b01e88e5
IE
148 tree id = DECL_ASSEMBLER_NAME (DECL); \
149 ultimate_transparent_alias_target (&id); \
150 const char *declname = IDENTIFIER_POINTER (id); \
25178498
JJ
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)
07a43492 160
7ecfa34f 161#ifndef USE_GAS
f1c26cad
RO
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. */
f1c26cad
RO
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)
7ecfa34f 191#endif /* !USE_GAS */
e2b4f103 192
2cf03b11
RO
193/* As in sparc/sol2.h, override the default from i386/x86-64.h to work
194 around Sun as TLS bug. */
901f29c8
RO
195#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
196#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
2cf03b11
RO
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); \
901f29c8 203 x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); \
2cf03b11
RO
204 } \
205 while (0)
206
07a43492 207/* Output a simple call for .init/.fini. */
dbdd0cf3
MM
208#define ASM_OUTPUT_CALL(FILE, FN) \
209 do \
210 { \
211 fprintf (FILE, "\tcall\t"); \
6b3c42ae 212 ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
dbdd0cf3
MM
213 fprintf (FILE, "\n"); \
214 } \
215 while (0)
81e4cf35 216
2ca48caa
RO
217#undef TARGET_ASM_NAMED_SECTION
218#define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
219
b2eb4ed5
RO
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
b6193c94
RO
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
feffaec4
RO
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
901f29c8
RO
241#ifndef USE_GAS
242#define LARGECOMM_SECTION_ASM_OP "\t.lbcomm\t"
243#endif
244
2cf03b11
RO
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
81e4cf35
MM
253/* We do not need NT_VERSION notes. */
254#undef X86_FILE_START_VERSION_DIRECTIVE
255#define X86_FILE_START_VERSION_DIRECTIVE false
0adcf178
RO
256
257/* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
258 sections, so don't use them. */
7ecfa34f 259#ifndef USE_GLD
0adcf178
RO
260#define USE_HIDDEN_LINKONCE 0
261#endif