1 /* Target definitions for GCC for Intel 80386 running Solaris 2
2 Copyright (C) 1993-2015 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)
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 /* Old versions of the Solaris assembler can not handle the difference of
25 labels in different sections, so force DW_EH_PE_datarel if so. */
26 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
27 #undef ASM_PREFERRED_EH_DATA_FORMAT
28 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
29 (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0) \
30 | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
31 : DW_EH_PE_datarel)) \
35 /* The Solaris linker will not merge a read-only .eh_frame section
36 with a read-write .eh_frame section. None of the encodings used
37 with non-PIC code require runtime relocations. In 64-bit mode,
38 since there is no backwards compatibility issue, we use a read-only
39 section for .eh_frame. In 32-bit mode, we use a writable .eh_frame
40 section in order to be compatible with G++ for Solaris x86. */
41 #undef EH_TABLES_CAN_BE_READ_ONLY
42 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
44 /* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
47 #define TARGET_SUN_TLS 1
49 /* Solaris 2/Intel as chokes on #line directives before Solaris 10. */
51 #define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
53 /* GNU as understands --32 and --64, but the native Solaris
54 assembler requires -xarch=generic or -xarch=generic64 instead. */
56 #define ASM_CPU32_DEFAULT_SPEC "--32"
57 #define ASM_CPU64_DEFAULT_SPEC "--64"
59 #define ASM_CPU32_DEFAULT_SPEC "-xarch=generic"
60 #define ASM_CPU64_DEFAULT_SPEC "-xarch=generic64"
64 #define ASM_CPU_SPEC "%(asm_cpu_default)"
66 /* Don't include ASM_PIC_SPEC. While the Solaris 10+ assembler accepts -K PIC,
67 it gives many warnings:
68 Absolute relocation is used for symbol "<symbol>"
69 GNU as doesn't recognize -K at all. */
71 #define ASM_SPEC ASM_SPEC_BASE
73 #define DEFAULT_ARCH32_P !TARGET_64BIT_DEFAULT
75 #define ARCH64_SUBDIR "amd64"
78 /* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
79 follow the Solaris 2 ABI. Prefer them if present. */
80 #ifdef HAVE_LD_SOL2_EMULATION
81 #define ARCH32_EMULATION "elf_i386_sol2"
82 #define ARCH64_EMULATION "elf_x86_64_sol2"
84 #define ARCH32_EMULATION "elf_i386"
85 #define ARCH64_EMULATION "elf_x86_64"
90 #define ENDFILE_SPEC \
91 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
92 %{mpc32:crtprec32.o%s} \
93 %{mpc64:crtprec64.o%s} \
94 %{mpc80:crtprec80.o%s} \
97 #define SUBTARGET_CPU_EXTRA_SPECS \
98 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
99 { "asm_cpu", ASM_CPU_SPEC }, \
100 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
102 /* Register the Solaris-specific #pragma directives. */
103 #define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
105 #undef LOCAL_LABEL_PREFIX
106 #define LOCAL_LABEL_PREFIX "."
108 /* The Solaris 10 FCS as doesn't accept "#" comments, while later versions
110 #undef ASM_COMMENT_START
111 #define ASM_COMMENT_START "/"
113 /* The 32-bit Solaris assembler does not support .quad. Do not use it. */
114 #ifndef HAVE_AS_IX86_QUAD
118 /* The native Solaris assembler can't calculate the difference between
119 symbols in different sections, which causes problems for -fPIC jump
120 tables in .rodata. */
121 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
122 #undef JUMP_TABLES_IN_TEXT_SECTION
123 #define JUMP_TABLES_IN_TEXT_SECTION 1
125 /* The native Solaris assembler cannot handle the SYMBOL-. syntax, but
126 requires SYMBOL@rel/@rel64 instead. */
127 #define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
129 fputs (integer_asm_op (SIZE, FALSE), FILE); \
130 assemble_name (FILE, LABEL); \
131 fputs (SIZE == 8 ? "@rel64" : "@rel", FILE); \
135 /* The Solaris assembler wants a .local for non-exported aliases. */
136 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
138 const char *declname = \
139 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
140 ASM_OUTPUT_DEF ((FILE), declname, \
141 IDENTIFIER_POINTER (TARGET)); \
142 if (! TREE_PUBLIC (DECL)) \
144 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
145 assemble_name ((FILE), declname); \
146 fprintf ((FILE), "\n"); \
151 /* The Sun assembler uses .tcomm for TLS common sections. */
152 #define TLS_COMMON_ASM_OP ".tcomm"
154 /* Similar to the Sun assembler on SPARC, the native assembler requires
155 TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC,
156 gas doesn't understand this variant. */
157 #undef ASM_DECLARE_OBJECT_NAME
158 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
161 HOST_WIDE_INT size; \
163 if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
164 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \
166 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
168 size_directive_output = 0; \
169 if (!flag_inhibit_size_directive \
170 && (DECL) && DECL_SIZE (DECL)) \
172 size_directive_output = 1; \
173 size = int_size_in_bytes (TREE_TYPE (DECL)); \
174 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
177 ASM_OUTPUT_LABEL (FILE, NAME); \
180 #endif /* !USE_GAS */
182 /* As in sparc/sol2.h, override the default from i386/x86-64.h to work
183 around Sun as TLS bug. */
184 #undef ASM_OUTPUT_ALIGNED_COMMON
185 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
190 && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \
191 switch_to_section (bss_section); \
192 x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); \
196 /* Output a simple call for .init/.fini. */
197 #define ASM_OUTPUT_CALL(FILE, FN) \
200 fprintf (FILE, "\tcall\t"); \
201 ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
202 fprintf (FILE, "\n"); \
206 #undef TARGET_ASM_NAMED_SECTION
207 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
210 /* Emit COMDAT group signature symbols for Sun as. */
211 #undef TARGET_ASM_FILE_END
212 #define TARGET_ASM_FILE_END solaris_file_end
215 /* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so
216 inhibit their creation. Also cf. sparc/sysv4.h. */
218 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
219 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
222 #define USE_IX86_FRAME_POINTER 1
223 #define USE_X86_64_FRAME_POINTER 1
225 #undef NO_PROFILE_COUNTERS
228 #define MCOUNT_NAME "_mcount"
230 /* We do not need NT_VERSION notes. */
231 #undef X86_FILE_START_VERSION_DIRECTIVE
232 #define X86_FILE_START_VERSION_DIRECTIVE false
234 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
235 sections, so don't use them. */
237 #define USE_HIDDEN_LINKONCE 0