Back to index

cell-binutils  2.17cvs20070401
tc-ppc.h
Go to the documentation of this file.
00001 /* tc-ppc.h -- Header file for tc-ppc.c.
00002    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
00003    2004, 2005, 2006 Free Software Foundation, Inc.
00004    Written by Ian Lance Taylor, Cygnus Support.
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 published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    GAS is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with GAS; see the file COPYING.  If not, write to the Free
00020    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00021    02110-1301, USA.  */
00022 
00023 #define TC_PPC
00024 
00025 struct fix;
00026 
00027 /* Set the endianness we are using.  Default to big endian.  */
00028 #ifndef TARGET_BYTES_BIG_ENDIAN
00029 #define TARGET_BYTES_BIG_ENDIAN 1
00030 #endif
00031 
00032 /* If OBJ_COFF is defined, and TE_PE is not defined, we are assembling
00033    XCOFF for AIX or PowerMac.  If TE_PE is defined, we are assembling
00034    COFF for Windows NT.  */
00035 
00036 #ifdef OBJ_COFF
00037 #ifndef TE_PE
00038 #define OBJ_XCOFF
00039 #endif
00040 #endif
00041 
00042 /* The target BFD architecture.  */
00043 #define TARGET_ARCH (ppc_arch ())
00044 #define TARGET_MACH (ppc_mach ())
00045 extern enum bfd_architecture ppc_arch PARAMS ((void));
00046 extern unsigned long ppc_mach PARAMS ((void));
00047 
00048 /* Whether or not the target is big endian */
00049 extern int target_big_endian;
00050 
00051 /* The target BFD format.  */
00052 #define TARGET_FORMAT (ppc_target_format ())
00053 extern char *ppc_target_format PARAMS ((void));
00054 
00055 /* Permit temporary numeric labels.  */
00056 #define LOCAL_LABELS_FB 1
00057 
00058 /* $ is used to refer to the current location.  */
00059 #define DOLLAR_DOT
00060 
00061 /* Strings do not use backslash escapes under COFF.  */
00062 #ifdef OBJ_COFF
00063 #define NO_STRING_ESCAPES
00064 #endif
00065 
00066 #ifdef OBJ_ELF
00067 #define DIFF_EXPR_OK        /* foo-. gets turned into PC relative relocs */
00068 #endif
00069 
00070 #if TARGET_BYTES_BIG_ENDIAN
00071 #define PPC_BIG_ENDIAN 1
00072 #else
00073 #define PPC_BIG_ENDIAN 0
00074 #endif
00075 
00076 /* We don't need to handle .word strangely.  */
00077 #define WORKING_DOT_WORD
00078 
00079 #define MAX_MEM_FOR_RS_ALIGN_CODE 4
00080 #define HANDLE_ALIGN(FRAGP)                                    \
00081   if ((FRAGP)->fr_type == rs_align_code)                       \
00082     ppc_handle_align (FRAGP);
00083 
00084 extern void ppc_handle_align (struct frag *);
00085 
00086 #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
00087 
00088 #define md_frag_check(FRAGP) \
00089   if ((FRAGP)->has_code                                               \
00090       && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 3) != 0)              \
00091     as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line,                 \
00092                 _("instruction address is not a multiple of 4"));
00093 
00094 #ifdef TE_PE
00095 
00096 /* Question marks are permitted in symbol names.  */
00097 #define LEX_QM 1
00098 
00099 /* Don't adjust TOC relocs.  */
00100 #define tc_fix_adjustable(FIX) ppc_pe_fix_adjustable (FIX)
00101 extern int ppc_pe_fix_adjustable PARAMS ((struct fix *));
00102 
00103 #endif
00104 
00105 #ifdef OBJ_XCOFF
00106 
00107 /* Declarations needed when generating XCOFF code.  XCOFF is an
00108    extension of COFF, used only on the RS/6000.  Rather than create an
00109    obj-xcoff, we just use obj-coff, and handle the extensions here in
00110    tc-ppc.  */
00111 
00112 /* We need to keep some information for symbols.  */
00113 struct ppc_tc_sy
00114 {
00115   /* We keep a few linked lists of symbols.  */
00116   symbolS *next;
00117   /* Non-zero if the symbol should be output.  The RS/6000 assembler
00118      only outputs symbols that are external or are mentioned in a
00119      .globl or .lglobl statement.  */
00120   int output;
00121   /* The symbol class.  */
00122   int class;
00123   /* The real name, if the symbol was renamed.  */
00124   char *real_name;
00125   /* For a csect symbol, the subsegment we are using.  This is zero
00126      for symbols that are not csects.  */
00127   subsegT subseg;
00128   /* For a csect or common symbol, the alignment to use.  */
00129   int align;
00130   /* For a function symbol, a symbol whose value is the size.  The
00131      field is NULL if there is no size.  */
00132   symbolS *size;
00133   /* For a csect symbol, the last symbol which has been defined in
00134      this csect, or NULL if none have been defined so far.  For a .bs
00135      symbol, the referenced csect symbol.  */
00136   symbolS *within;
00137 };
00138 
00139 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
00140 
00141 /* We need an additional auxent for function symbols.  */
00142 #define OBJ_COFF_MAX_AUXENTRIES 2
00143 
00144 /* Square and curly brackets are permitted in symbol names.  */
00145 #define LEX_BR 3
00146 
00147 /* Canonicalize the symbol name.  */
00148 #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
00149 extern char *ppc_canonicalize_symbol_name PARAMS ((char *));
00150 
00151 /* Get the symbol class from the name.  */
00152 #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
00153 extern void ppc_symbol_new_hook PARAMS ((symbolS *));
00154 
00155 /* Set the symbol class of a label based on the csect.  */
00156 #define tc_frob_label(sym) ppc_frob_label (sym)
00157 extern void ppc_frob_label PARAMS ((symbolS *));
00158 
00159 /* TOC relocs requires special handling.  */
00160 #define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX)
00161 extern int ppc_fix_adjustable PARAMS ((struct fix *));
00162 
00163 /* We need to set the section VMA.  */
00164 #define tc_frob_section(sec) ppc_frob_section (sec)
00165 extern void ppc_frob_section PARAMS ((asection *));
00166 
00167 /* Finish up the symbol.  */
00168 #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
00169 extern int ppc_frob_symbol PARAMS ((symbolS *));
00170 
00171 /* Finish up the entire symtab.  */
00172 #define tc_adjust_symtab() ppc_adjust_symtab ()
00173 extern void ppc_adjust_symtab PARAMS ((void));
00174 
00175 /* We also need to copy, in particular, the class of the symbol,
00176    over what obj-coff would otherwise have copied.  */
00177 #define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src)                   \
00178 do {                                                    \
00179   if (SF_GET_GET_SEGMENT (dest))                        \
00180     S_SET_SEGMENT (dest, S_GET_SEGMENT (src));                 \
00181   symbol_get_tc (dest)->size = symbol_get_tc (src)->size;      \
00182   symbol_get_tc (dest)->align = symbol_get_tc (src)->align;    \
00183   symbol_get_tc (dest)->class = symbol_get_tc (src)->class;    \
00184   symbol_get_tc (dest)->within = symbol_get_tc (src)->within;  \
00185 } while (0)
00186 
00187 #endif /* OBJ_XCOFF */
00188 
00189 extern const char       ppc_symbol_chars[];
00190 #define tc_symbol_chars ppc_symbol_chars
00191 
00192 #ifdef OBJ_ELF
00193 
00194 /* Support for SHF_EXCLUDE and SHT_ORDERED */
00195 extern int ppc_section_letter PARAMS ((int, char **));
00196 extern int ppc_section_type PARAMS ((char *, size_t));
00197 extern int ppc_section_word PARAMS ((char *, size_t));
00198 extern int ppc_section_flags PARAMS ((int, int, int));
00199 
00200 #define md_elf_section_letter(LETTER, PTR_MSG)   ppc_section_letter (LETTER, PTR_MSG)
00201 #define md_elf_section_type(STR, LEN)            ppc_section_type (STR, LEN)
00202 #define md_elf_section_word(STR, LEN)            ppc_section_word (STR, LEN)
00203 #define md_elf_section_flags(FLAGS, ATTR, TYPE)  ppc_section_flags (FLAGS, ATTR, TYPE)
00204 
00205 #define tc_comment_chars ppc_comment_chars
00206 extern const char *ppc_comment_chars;
00207 
00208 /* Keep relocations relative to the GOT, or non-PC relative.  */
00209 #define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX)
00210 extern int ppc_fix_adjustable PARAMS ((struct fix *));
00211 
00212 /* Values passed to md_apply_fix don't include symbol values.  */
00213 #define MD_APPLY_SYM_VALUE(FIX) 0
00214 
00215 #define tc_frob_file_before_adjust ppc_frob_file_before_adjust
00216 extern void ppc_frob_file_before_adjust PARAMS ((void));
00217 
00218 #endif /* OBJ_ELF */
00219 
00220 #if defined (OBJ_ELF) || defined (OBJ_XCOFF)
00221 #define TC_FORCE_RELOCATION(FIX) ppc_force_relocation (FIX)
00222 extern int ppc_force_relocation PARAMS ((struct fix *));
00223 #endif
00224 
00225 /* call md_pcrel_from_section, not md_pcrel_from */
00226 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
00227 extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
00228 
00229 #define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp)
00230 extern int ppc_parse_name PARAMS ((const char *, struct expressionS *));
00231 
00232 #define md_operand(x)
00233 
00234 #define md_cleanup() ppc_cleanup ()
00235  extern void ppc_cleanup PARAMS ((void));
00236 
00237 #define TARGET_USE_CFIPOP 1
00238 
00239 #define tc_cfi_frame_initial_instructions ppc_cfi_frame_initial_instructions
00240 extern void ppc_cfi_frame_initial_instructions PARAMS ((void));
00241 
00242 #define tc_regname_to_dw2regnum tc_ppc_regname_to_dw2regnum
00243 extern int tc_ppc_regname_to_dw2regnum PARAMS ((char *regname));
00244 
00245 extern int ppc_cie_data_alignment;
00246 
00247 #define DWARF2_LINE_MIN_INSN_LENGTH     4
00248 #define DWARF2_DEFAULT_RETURN_COLUMN    0x41
00249 #define DWARF2_CIE_DATA_ALIGNMENT       ppc_cie_data_alignment