Only redefine ASM_PREFERRED_EH_DATA_FORMAT if necessary on Solaris/x86
[official-gcc.git] / gcc / config / i386 / sol2.h
blob6676941f67aa023b88a601c2feff827fd92e530d
1 /* Target definitions for GCC for Intel 80386 running Solaris 2
2 Copyright (C) 1993-2014 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 /* 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)
28 /* Old versions of the Solaris assembler can not handle the difference of
29 labels in different sections, so force DW_EH_PE_datarel if so. */
30 #ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
31 #undef ASM_PREFERRED_EH_DATA_FORMAT
32 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
33 (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0) \
34 | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
35 : DW_EH_PE_datarel)) \
36 : DW_EH_PE_absptr)
37 #endif
39 /* The Solaris linker will not merge a read-only .eh_frame section
40 with a read-write .eh_frame section. None of the encodings used
41 with non-PIC code require runtime relocations. In 64-bit mode,
42 since there is no backwards compatibility issue, we use a read-only
43 section for .eh_frame. In 32-bit mode, we use a writable .eh_frame
44 section in order to be compatible with G++ for Solaris x86. */
45 #undef EH_TABLES_CAN_BE_READ_ONLY
46 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
48 /* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
49 syntax. */
50 #undef TARGET_SUN_TLS
51 #define TARGET_SUN_TLS 1
53 #undef SIZE_TYPE
54 #define SIZE_TYPE "unsigned int"
56 #undef PTRDIFF_TYPE
57 #define PTRDIFF_TYPE "int"
59 /* Solaris 2/Intel as chokes on #line directives before Solaris 10. */
60 #undef CPP_SPEC
61 #define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
63 #define ASM_CPU_DEFAULT_SPEC ""
65 #define ASM_CPU_SPEC ""
67 /* Don't include ASM_PIC_SPEC. While the Solaris 9 assembler accepts
68 -K PIC, it gives many warnings:
69 R_386_32 relocation is used for symbol "<symbol>"
70 GNU as doesn't recognize -K at all. */
71 #undef ASM_SPEC
72 #define ASM_SPEC ASM_SPEC_BASE
74 #undef ENDFILE_SPEC
75 #define ENDFILE_SPEC \
76 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
77 %{mpc32:crtprec32.o%s} \
78 %{mpc64:crtprec64.o%s} \
79 %{mpc80:crtprec80.o%s} \
80 crtend.o%s crtn.o%s"
82 #define SUBTARGET_CPU_EXTRA_SPECS \
83 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
84 { "asm_cpu", ASM_CPU_SPEC }, \
85 { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
87 #undef SUBTARGET_EXTRA_SPECS
88 #define SUBTARGET_EXTRA_SPECS \
89 { "startfile_arch", STARTFILE_ARCH_SPEC }, \
90 { "link_arch", LINK_ARCH_SPEC }, \
91 SUBTARGET_CPU_EXTRA_SPECS
93 /* Register the Solaris-specific #pragma directives. */
94 #define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
96 #undef LOCAL_LABEL_PREFIX
97 #define LOCAL_LABEL_PREFIX "."
99 /* The 32-bit Solaris assembler does not support .quad. Do not use it. */
100 #ifndef HAVE_AS_IX86_QUAD
101 #undef ASM_QUAD
102 #endif
104 /* The Solaris assembler wants a .local for non-exported aliases. */
105 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
106 do { \
107 const char *declname = \
108 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
109 ASM_OUTPUT_DEF ((FILE), declname, \
110 IDENTIFIER_POINTER (TARGET)); \
111 if (! TREE_PUBLIC (DECL)) \
113 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
114 assemble_name ((FILE), declname); \
115 fprintf ((FILE), "\n"); \
117 } while (0)
119 #ifndef USE_GAS
120 /* The Sun assembler uses .tcomm for TLS common sections. */
121 #define TLS_COMMON_ASM_OP ".tcomm"
123 /* Similar to the Sun assembler on SPARC, the native assembler requires
124 TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC,
125 gas doesn't understand this variant. */
126 #undef ASM_DECLARE_OBJECT_NAME
127 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
128 do \
130 HOST_WIDE_INT size; \
132 if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
133 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \
134 else \
135 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
137 size_directive_output = 0; \
138 if (!flag_inhibit_size_directive \
139 && (DECL) && DECL_SIZE (DECL)) \
141 size_directive_output = 1; \
142 size = int_size_in_bytes (TREE_TYPE (DECL)); \
143 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
146 ASM_OUTPUT_LABEL (FILE, NAME); \
148 while (0)
149 #endif /* !USE_GAS */
151 /* Output a simple call for .init/.fini. */
152 #define ASM_OUTPUT_CALL(FILE, FN) \
153 do \
155 fprintf (FILE, "\tcall\t"); \
156 ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
157 fprintf (FILE, "\n"); \
159 while (0)
161 #undef TARGET_ASM_NAMED_SECTION
162 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
164 #ifndef USE_GAS
165 /* Emit COMDAT group signature symbols for Sun as. */
166 #undef TARGET_ASM_FILE_END
167 #define TARGET_ASM_FILE_END solaris_file_end
168 #endif
170 /* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so
171 inhibit their creation. Also cf. sparc/sysv4.h. */
172 #ifndef USE_GLD
173 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
174 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
175 #endif
177 /* We do not need NT_VERSION notes. */
178 #undef X86_FILE_START_VERSION_DIRECTIVE
179 #define X86_FILE_START_VERSION_DIRECTIVE false
181 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
182 sections, so don't use them. */
183 #ifndef USE_GLD
184 #define USE_HIDDEN_LINKONCE 0
185 #endif
187 /* Put all *tf routines in libgcc. */
188 #undef LIBGCC2_HAS_TF_MODE
189 #define LIBGCC2_HAS_TF_MODE 1
190 #define LIBGCC2_TF_CEXT q
191 #define TF_SIZE 113