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). 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 3, or (at your option) 10any later version. 11 12GCC is distributed in the hope that it will be useful, 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 18along 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#undef ASM_CPU_SPEC 69#define ASM_CPU_SPEC "%(asm_cpu_default)" 70 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 77 78#define DEFAULT_ARCH32_P !TARGET_64BIT_DEFAULT 79 80#define ARCH64_SUBDIR "amd64" 81 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 93 94#define ENDFILE_ARCH_SPEC \ 95 "%{mpc32:crtprec32.o%s} \ 96 %{mpc64:crtprec64.o%s} \ 97 %{mpc80:crtprec80.o%s}" 98 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 }, \ 103 104/* Register the Solaris-specific #pragma directives. */ 105#define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas () 106 107#undef LOCAL_LABEL_PREFIX 108#define LOCAL_LABEL_PREFIX "." 109 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 "/" 114 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 119 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 126 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 136 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)) \ 146 { \ 147 fprintf ((FILE), "%s", LOCAL_ASM_OP); \ 148 assemble_name ((FILE), declname); \ 149 fprintf ((FILE), "\n"); \ 150 } \ 151 } while (0) 152 153#ifndef USE_GAS 154/* The Sun assembler uses .tcomm for TLS common sections. */ 155#define TLS_COMMON_ASM_OP ".tcomm" 156 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 \ 163 { \ 164 HOST_WIDE_INT size; \ 165 \ 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"); \ 170 \ 171 size_directive_output = 0; \ 172 if (!flag_inhibit_size_directive \ 173 && (DECL) && DECL_SIZE (DECL)) \ 174 { \ 175 size_directive_output = 1; \ 176 size = int_size_in_bytes (TREE_TYPE (DECL)); \ 177 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ 178 } \ 179 \ 180 ASM_OUTPUT_LABEL (FILE, NAME); \ 181 } \ 182 while (0) 183#endif /* !USE_GAS */ 184 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_COMMON 188#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ 189 do \ 190 { \ 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_common (FILE, NAME, SIZE, ALIGN); \ 196 } \ 197 while (0) 198 199/* Output a simple call for .init/.fini. */ 200#define ASM_OUTPUT_CALL(FILE, FN) \ 201 do \ 202 { \ 203 fprintf (FILE, "\tcall\t"); \ 204 ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \ 205 fprintf (FILE, "\n"); \ 206 } \ 207 while (0) 208 209#undef TARGET_ASM_NAMED_SECTION 210#define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section 211 212#ifndef USE_GAS 213/* Emit COMDAT group signature symbols for Sun as. */ 214#undef TARGET_ASM_FILE_END 215#define TARGET_ASM_FILE_END solaris_file_end 216#endif 217 218/* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so 219 inhibit their creation. Also cf. sparc/sysv4.h. */ 220#ifndef USE_GLD 221#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\"" 222#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" 223#endif 224 225#define USE_IX86_FRAME_POINTER 1 226#define USE_X86_64_FRAME_POINTER 1 227 228#undef NO_PROFILE_COUNTERS 229 230#undef MCOUNT_NAME 231#define MCOUNT_NAME "_mcount" 232 233/* We do not need NT_VERSION notes. */ 234#undef X86_FILE_START_VERSION_DIRECTIVE 235#define X86_FILE_START_VERSION_DIRECTIVE false 236 237/* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce 238 sections, so don't use them. */ 239#ifndef USE_GLD 240#define USE_HIDDEN_LINKONCE 0 241#endif 242