Back to index

cell-binutils  2.17cvs20070401
tc-sparc.h
Go to the documentation of this file.
00001 /* tc-sparc.h - Macros and type defines for the sparc.
00002    Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
00003    1999, 2000, 2001, 2002, 2003, 2005, 2007
00004    Free Software Foundation, Inc.
00005 
00006    This file is part of GAS, the GNU Assembler.
00007 
00008    GAS is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as
00010    published by the Free Software Foundation; either version 2,
00011    or (at your option) any later version.
00012 
00013    GAS is distributed in the hope that it will be useful, but
00014    WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
00016    the GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public
00019    License along with GAS; see the file COPYING.  If not, write
00020    to the Free Software Foundation, 51 Franklin Street - Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 #ifndef TC_SPARC
00024 #define TC_SPARC 1
00025 
00026 struct frag;
00027 
00028 /* This is used to set the default value for `target_big_endian'.  */
00029 #define TARGET_BYTES_BIG_ENDIAN 1
00030 
00031 #define LOCAL_LABELS_FB 1
00032 
00033 #define TARGET_ARCH bfd_arch_sparc
00034 
00035 #ifdef TE_FreeBSD
00036 #define ELF_TARGET_FORMAT   "elf32-sparc-freebsd"
00037 #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd"
00038 #endif
00039 
00040 #ifndef ELF_TARGET_FORMAT
00041 #define ELF_TARGET_FORMAT   "elf32-sparc"
00042 #endif
00043 
00044 #ifndef ELF64_TARGET_FORMAT
00045 #define ELF64_TARGET_FORMAT "elf64-sparc"
00046 #endif
00047 
00048 extern const char *sparc_target_format PARAMS ((void));
00049 #define TARGET_FORMAT sparc_target_format ()
00050 
00051 #define RELOC_EXPANSION_POSSIBLE
00052 #define MAX_RELOC_EXPANSION 2
00053 
00054 /* Make it unconditional and check if -EL is valid after option parsing */
00055 #define SPARC_BIENDIAN
00056 
00057 #define WORKING_DOT_WORD
00058 
00059 #define md_convert_frag(b,s,f) \
00060   as_fatal (_("sparc convert_frag\n"))
00061 #define md_estimate_size_before_relax(f,s) \
00062   (as_fatal (_("estimate_size_before_relax called")), 1)
00063 
00064 #define LISTING_HEADER "SPARC GAS "
00065 
00066 extern int sparc_pic_code;
00067 
00068 /* We require .word, et. al., to be aligned correctly.  */
00069 #define md_cons_align(nbytes) sparc_cons_align (nbytes)
00070 extern void sparc_cons_align PARAMS ((int));
00071 
00072 #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
00073 extern void sparc_handle_align PARAMS ((struct frag *));
00074 
00075 #define MAX_MEM_FOR_RS_ALIGN_CODE  (3 + 4 + 4)
00076 
00077 /* I know that "call 0" fails in sparc-coff if this doesn't return 1.  I
00078    don't know about other relocation types, or other formats, yet.  */
00079 #ifdef OBJ_COFF
00080 #define TC_FORCE_RELOCATION_ABS(FIX)             \
00081   ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2     \
00082    || TC_FORCE_RELOCATION (FIX))
00083 
00084 #define RELOC_REQUIRES_SYMBOL
00085 #endif
00086 
00087 #ifdef OBJ_AOUT
00088 /* This expression evaluates to true if the relocation is for a local
00089    object for which we still want to do the relocation at runtime.
00090    False if we are willing to perform this relocation while building
00091    the .o file.  */
00092 
00093 #define TC_FORCE_RELOCATION_LOCAL(FIX)           \
00094   (!(FIX)->fx_pcrel                       \
00095    || (sparc_pic_code                            \
00096        && S_IS_EXTERNAL ((FIX)->fx_addsy))       \
00097    || TC_FORCE_RELOCATION (FIX))
00098 #endif
00099 
00100 #ifdef OBJ_ELF
00101 /* Don't turn certain relocs into relocations against sections.  This
00102    is required for the dynamic linker to operate properly.  When
00103    generating PIC, we need to keep any non PC relative reloc.  The PIC
00104    part of this test must be parallel to the code in tc_gen_reloc which
00105    converts relocations to GOT relocations.  */
00106 #define tc_fix_adjustable(FIX)                                        \
00107   ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT                       \
00108    && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY               \
00109    && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22                 \
00110        || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64)             \
00111    && (! sparc_pic_code                                               \
00112        || ((FIX)->fx_r_type != BFD_RELOC_HI22                         \
00113           && (FIX)->fx_r_type != BFD_RELOC_LO10                \
00114           && (FIX)->fx_r_type != BFD_RELOC_SPARC13                    \
00115           && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2        \
00116               || !generic_force_reloc (FIX))                          \
00117           && ((FIX)->fx_pcrel                                         \
00118               || ((FIX)->fx_subsy != NULL                      \
00119                  && (S_GET_SEGMENT ((FIX)->fx_subsy)                  \
00120                      == S_GET_SEGMENT ((FIX)->fx_addsy)))             \
00121               || S_IS_LOCAL ((FIX)->fx_addsy)))))
00122 
00123 /* Values passed to md_apply_fix don't include the symbol value.  */
00124 #define MD_APPLY_SYM_VALUE(FIX) 0
00125 
00126 /* Finish up the entire symtab.  */
00127 #define tc_adjust_symtab() sparc_adjust_symtab ()
00128 extern void sparc_adjust_symtab PARAMS ((void));
00129 #endif
00130 
00131 #ifdef OBJ_AOUT
00132 /* When generating PIC code, we must not adjust any reloc which will
00133    turn into a reloc against the global offset table, nor any reloc
00134    which we will need if a symbol is overridden.  */
00135 #define tc_fix_adjustable(FIX)                                        \
00136   (! sparc_pic_code                                            \
00137    || ((FIX)->fx_pcrel                                                \
00138        && ((FIX)->fx_addsy == NULL                             \
00139           || (! S_IS_EXTERNAL ((FIX)->fx_addsy)                \
00140               && ! S_IS_WEAK ((FIX)->fx_addsy))))                     \
00141    || (FIX)->fx_r_type == BFD_RELOC_16                                \
00142    || (FIX)->fx_r_type == BFD_RELOC_32)
00143 #endif
00144 
00145 #define elf_tc_final_processing sparc_elf_final_processing
00146 extern void sparc_elf_final_processing PARAMS ((void));
00147 
00148 #define md_operand(x)
00149 
00150 extern void sparc_md_end PARAMS ((void));
00151 #define md_end() sparc_md_end ()
00152 
00153 #endif
00154 
00155 #ifdef OBJ_ELF
00156 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES)
00157 extern void sparc_cons PARAMS ((expressionS *, int));
00158 #endif
00159 
00160 #define TC_CONS_FIX_NEW cons_fix_new_sparc
00161 extern void cons_fix_new_sparc
00162   PARAMS ((struct frag *, int, unsigned int, struct expressionS *));
00163 
00164 #define TC_FIX_TYPE  valueT
00165 
00166 #define TC_INIT_FIX_DATA(X)               \
00167   do                                      \
00168      {                                    \
00169        (X)->tc_fix_data = 0;                     \
00170      }                                    \
00171   while (0)
00172 
00173 #define TC_FIX_DATA_PRINT(FILE, FIX)                                  \
00174   do                                                           \
00175     {                                                          \
00176       fprintf ((FILE), "addend2=%ld\n",                               \
00177              (unsigned long) (FIX)->tc_fix_data);                     \
00178     }                                                          \
00179   while (0)
00180 
00181 #define TARGET_USE_CFIPOP 1
00182 
00183 #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
00184 extern void sparc_cfi_frame_initial_instructions PARAMS ((void));
00185 
00186 #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
00187 extern int sparc_regname_to_dw2regnum PARAMS ((char *regname));
00188 
00189 #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
00190 extern void sparc_cfi_emit_pcrel_expr PARAMS ((expressionS *, unsigned int));
00191 
00192 extern int sparc_cie_data_alignment;
00193 
00194 #define DWARF2_LINE_MIN_INSN_LENGTH     4
00195 #define DWARF2_DEFAULT_RETURN_COLUMN    15
00196 #define DWARF2_CIE_DATA_ALIGNMENT       sparc_cie_data_alignment
00197 
00198 /* end of tc-sparc.h */