sol2.h revision 169690
151694Sroger/* Target definitions for GCC for Intel 80386 running Solaris 2 251694Sroger Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 351694Sroger 2004 451694Sroger Free Software Foundation, Inc. 551694Sroger Contributed by Fred Fish (fnf@cygnus.com). 651694Sroger 751694SrogerThis file is part of GCC. 851694Sroger 951694SrogerGCC is free software; you can redistribute it and/or modify 1051694Srogerit under the terms of the GNU General Public License as published by 1152593Srogerthe Free Software Foundation; either version 2, or (at your option) 1251694Srogerany later version. 1351694Sroger 1451694SrogerGCC is distributed in the hope that it will be useful, 1551694Srogerbut WITHOUT ANY WARRANTY; without even the implied warranty of 16139749SimpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1751694SrogerGNU General Public License for more details. 1851694Sroger 1951694SrogerYou should have received a copy of the GNU General Public License 2051694Srogeralong with GCC; see the file COPYING. If not, write to 2151694Srogerthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 2251694SrogerBoston, MA 02110-1301, USA. */ 2351694Sroger 2451694Sroger/* The Solaris 2.0 x86 linker botches alignment of code sections. 2551694Sroger It tries to align to a 16 byte boundary by padding with 0x00000090 2651694Sroger ints, rather than 0x90 bytes (nop). This generates trash in the 2751694Sroger ".init" section since the contribution from crtbegin.o is only 7 2851694Sroger bytes. The linker pads it to 16 bytes with a single 0x90 byte, and 2951694Sroger two 0x00000090 ints, which generates a segmentation violation when 3051694Sroger executed. This macro forces the assembler to do the padding, since 3151694Sroger it knows what it is doing. */ 3251694Sroger#define FORCE_CODE_SECTION_ALIGN asm(ALIGN_ASM_OP "16"); 3351694Sroger 3451694Sroger/* Old versions of the Solaris assembler can not handle the difference of 3551694Sroger labels in different sections, so force DW_EH_PE_datarel. */ 3651694Sroger#undef ASM_PREFERRED_EH_DATA_FORMAT 3751694Sroger#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ 3851694Sroger (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0) \ 3951694Sroger | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4 \ 4051694Sroger : DW_EH_PE_datarel)) \ 4151694Sroger : DW_EH_PE_absptr) 4251694Sroger 4351694Sroger/* The Solaris linker will not merge a read-only .eh_frame section 4451694Sroger with a read-write .eh_frame section. None of the encodings used 4551694Sroger with non-PIC code require runtime relocations. In 64-bit mode, 4651694Sroger since there is no backwards compatibility issue, we use a read-only 4751694Sroger section for .eh_frame. In 32-bit mode, we use a writable .eh_frame 4851694Sroger section in order to be compatible with G++ for Solaris x86. */ 4951694Sroger#undef EH_TABLES_CAN_BE_READ_ONLY 5051694Sroger#define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT) 5151694Sroger 5251694Sroger/* Solaris 2/Intel as chokes on #line directives. */ 5351694Sroger#undef CPP_SPEC 5451694Sroger#define CPP_SPEC "%{.S:-P} %(cpp_subtarget)" 5551694Sroger 5651694Sroger/* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler 5751694Sroger gives many warnings: R_386_32 relocation is used for symbol ".text". */ 5851694Sroger#undef ASM_SPEC 5951694Sroger#define ASM_SPEC "\ 6051694Sroger%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ 6151694Sroger%(asm_cpu) \ 6251694Sroger" 6351694Sroger 6451694Sroger#define ASM_CPU_SPEC "" 6551694Sroger 6651694Sroger#undef SUBTARGET_EXTRA_SPECS 67118819Salex#define SUBTARGET_EXTRA_SPECS \ 68118819Salex { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \ 69118819Salex { "asm_cpu", ASM_CPU_SPEC }, \ 70118819Salex { "startfile_arch", STARTFILE_ARCH_SPEC }, \ 71118819Salex { "link_arch", LINK_ARCH_SPEC } 72118819Salex 7351694Sroger#undef LOCAL_LABEL_PREFIX 7451694Sroger#define LOCAL_LABEL_PREFIX "." 7551694Sroger 7652593Sroger/* The 32-bit Solaris assembler does not support .quad. Do not use it. */ 7752593Sroger#ifndef TARGET_BI_ARCH 7852593Sroger#undef ASM_QUAD 7952593Sroger#endif 8052593Sroger 8152593Sroger/* The Solaris assembler wants a .local for non-exported aliases. */ 8252593Sroger#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \ 8351694Sroger do { \ 8451694Sroger const char *declname = \ 8551694Sroger IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ 8651694Sroger ASM_OUTPUT_DEF ((FILE), declname, \ 8751694Sroger IDENTIFIER_POINTER (TARGET)); \ 8851694Sroger if (! TREE_PUBLIC (DECL)) \ 8951694Sroger { \ 90 fprintf ((FILE), "%s", LOCAL_ASM_OP); \ 91 assemble_name ((FILE), declname); \ 92 fprintf ((FILE), "\n"); \ 93 } \ 94 } while (0) 95 96/* Solaris-specific #pragmas are implemented on top of attributes. Hook in 97 the bits from config/sol2.c. */ 98#define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes 99#define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE 100 101/* Output a simple call for .init/.fini. */ 102#define ASM_OUTPUT_CALL(FILE, FN) \ 103 do \ 104 { \ 105 fprintf (FILE, "\tcall\t"); \ 106 print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \ 107 fprintf (FILE, "\n"); \ 108 } \ 109 while (0) 110 111/* We do not need NT_VERSION notes. */ 112#undef X86_FILE_START_VERSION_DIRECTIVE 113#define X86_FILE_START_VERSION_DIRECTIVE false 114