1 /* Target definitions for GCC for Intel 80386 running Solaris 2 2 Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 3 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 Contributed by Fred Fish (fnf@cygnus.com). 5 6 This file is part of GCC. 7 8 GCC is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3, or (at your option) 11 any later version. 12 13 GCC is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with GCC; see the file COPYING3. If not see 20 <http://www.gnu.org/licenses/>. */ 21 22 /* The Solaris 2.0 x86 linker botches alignment of code sections. 23 It tries to align to a 16 byte boundary by padding with 0x00000090 24 ints, rather than 0x90 bytes (nop). This generates trash in the 25 ".init" section since the contribution from crtbegin.o is only 7 26 bytes. The linker pads it to 16 bytes with a single 0x90 byte, and 27 two 0x00000090 ints, which generates a segmentation violation when 28 executed. This macro forces the assembler to do the padding, since 29 it knows what it is doing. */ 30 #define FORCE_CODE_SECTION_ALIGN asm(ALIGN_ASM_OP "16"); 31 32 /* Old versions of the Solaris assembler can not handle the difference of 33 labels in different sections, so force DW_EH_PE_datarel. */ 34 #undef ASM_PREFERRED_EH_DATA_FORMAT 35 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ 36 (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0) \ 37 | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4 \ 38 : DW_EH_PE_datarel)) \ 39 : DW_EH_PE_absptr) 40 41 /* The Solaris linker will not merge a read-only .eh_frame section 42 with a read-write .eh_frame section. None of the encodings used 43 with non-PIC code require runtime relocations. In 64-bit mode, 44 since there is no backwards compatibility issue, we use a read-only 45 section for .eh_frame. In 32-bit mode, we use a writable .eh_frame 46 section in order to be compatible with G++ for Solaris x86. */ 47 #undef EH_TABLES_CAN_BE_READ_ONLY 48 #define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT) 49 50 /* Solaris 2/Intel as chokes on #line directives. */ 51 #undef CPP_SPEC 52 #define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)" 53 54 /* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler 55 gives many warnings: R_386_32 relocation is used for symbol ".text". */ 56 #undef ASM_SPEC 57 #define ASM_SPEC "\ 58 %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ 59 %(asm_cpu) \ 60 " 61 62 #define ASM_CPU_SPEC "" 63 64 #undef SUBTARGET_EXTRA_SPECS 65 #define SUBTARGET_EXTRA_SPECS \ 66 { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \ 67 { "asm_cpu", ASM_CPU_SPEC }, \ 68 { "startfile_arch", STARTFILE_ARCH_SPEC }, \ 69 { "link_arch", LINK_ARCH_SPEC } 70 71 #undef LOCAL_LABEL_PREFIX 72 #define LOCAL_LABEL_PREFIX "." 73 74 /* The 32-bit Solaris assembler does not support .quad. Do not use it. */ 75 #ifndef HAVE_AS_IX86_QUAD 76 #undef ASM_QUAD 77 #endif 78 79 /* The Solaris assembler wants a .local for non-exported aliases. */ 80 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \ 81 do { \ 82 const char *declname = \ 83 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ 84 ASM_OUTPUT_DEF ((FILE), declname, \ 85 IDENTIFIER_POINTER (TARGET)); \ 86 if (! TREE_PUBLIC (DECL)) \ 87 { \ 88 fprintf ((FILE), "%s", LOCAL_ASM_OP); \ 89 assemble_name ((FILE), declname); \ 90 fprintf ((FILE), "\n"); \ 91 } \ 92 } while (0) 93 94 /* Follow Sun requirements for TLS code sequences and use Sun assembler TLS 95 syntax. */ 96 #undef TARGET_SUN_TLS 97 #define TARGET_SUN_TLS 1 98 99 /* The Sun assembler uses .tcomm for TLS common sections. */ 100 #define TLS_COMMON_ASM_OP ".tcomm" 101 102 /* Similar to the Sun assembler on SPARC, the native assembler requires 103 TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC, 104 gas doesn't understand this variant. */ 105 #ifndef USE_GAS 106 #undef ASM_DECLARE_OBJECT_NAME 107 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 108 do \ 109 { \ 110 HOST_WIDE_INT size; \ 111 \ 112 if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \ 113 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \ 114 else \ 115 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ 116 \ 117 size_directive_output = 0; \ 118 if (!flag_inhibit_size_directive \ 119 && (DECL) && DECL_SIZE (DECL)) \ 120 { \ 121 size_directive_output = 1; \ 122 size = int_size_in_bytes (TREE_TYPE (DECL)); \ 123 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ 124 } \ 125 \ 126 ASM_OUTPUT_LABEL (FILE, NAME); \ 127 } \ 128 while (0) 129 #endif 130 131 /* The Solaris assembler cannot grok .stabd directives. */ 132 #undef NO_DBX_BNSYM_ENSYM 133 #define NO_DBX_BNSYM_ENSYM 1 134 135 /* Solaris-specific #pragmas are implemented on top of attributes. Hook in 136 the bits from config/sol2.c. */ 137 #define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes 138 #define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE 139 140 /* Register the Solaris-specific #pragma directives. */ 141 #define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas () 142 143 #undef SUBTARGET_RETURN_IN_MEMORY 144 #define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \ 145 ix86_solaris_return_in_memory (TYPE, FNTYPE) 146 147 /* Output a simple call for .init/.fini. */ 148 #define ASM_OUTPUT_CALL(FILE, FN) \ 149 do \ 150 { \ 151 fprintf (FILE, "\tcall\t"); \ 152 print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \ 153 fprintf (FILE, "\n"); \ 154 } \ 155 while (0) 156 157 /* We do not need NT_VERSION notes. */ 158 #undef X86_FILE_START_VERSION_DIRECTIVE 159 #define X86_FILE_START_VERSION_DIRECTIVE false 160 161 /* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce 162 sections, so don't use them. */ 163 #ifndef TARGET_GNU_LD 164 #define USE_HIDDEN_LINKONCE 0 165 #endif 166 167 /* Put all *tf routines in libgcc. */ 168 #undef LIBGCC2_HAS_TF_MODE 169 #define LIBGCC2_HAS_TF_MODE 1 170 #define LIBGCC2_TF_CEXT q 171 #define TF_SIZE 113 172 173 #define MD_UNWIND_SUPPORT "config/i386/sol2-unwind.h" 174