home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / gas / config / tc-ppc.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  8KB  |  248 lines

  1. /* tc-ppc.h -- Header file for tc-ppc.c.
  2.    Copyright (C) 1994 Free Software Foundation, Inc.
  3.    Written by Ian Lance Taylor, Cygnus Support.
  4.  
  5.    This file is part of GAS, the GNU Assembler.
  6.  
  7.    GAS is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 2, or (at your option)
  10.    any later version.
  11.  
  12.    GAS is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with GAS; see the file COPYING.  If not, write to
  19.    the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  20.  
  21. #define TC_PPC
  22.  
  23. #ifndef BFD_ASSEMBLER
  24.  #error PowerPC support requires BFD_ASSEMBLER
  25. #endif
  26.  
  27. /* If OBJ_COFF is defined, and TE_PE is not defined, we are assembling
  28.    XCOFF for AIX or PowerMac.  If TE_PE is defined, we are assembling
  29.    COFF for Windows NT.  */
  30.  
  31. #ifdef OBJ_COFF
  32. #ifndef TE_PE
  33. #define OBJ_XCOFF
  34. #endif
  35. #endif
  36.  
  37. /* The target BFD architecture.  */
  38. #define TARGET_ARCH (ppc_arch ())
  39. extern enum bfd_architecture ppc_arch PARAMS ((void));
  40.  
  41. /* Whether or not the target is big endian */
  42. extern int target_big_endian;
  43.  
  44. /* The target BFD format.  */
  45. #ifdef OBJ_COFF
  46. #ifdef TE_PE
  47. #define TARGET_FORMAT (target_big_endian ? "pe-powerpc" : "pe-powerpcle")
  48. #else
  49. #define TARGET_FORMAT "aixcoff-rs6000"
  50. #endif
  51. #endif
  52.  
  53. /* This is used by the Amiga to produce sun3 style a.out objects */
  54. #if defined(OBJ_AOUT) && defined(TE_SUN3) && 0
  55. #define TARGET_FORMAT "a.out-amiga"
  56. #endif
  57.  
  58. /* PowerMac has a BFD slightly different from AIX's.  */
  59. #ifdef TE_POWERMAC
  60. #ifdef TARGET_FORMAT
  61. #undef TARGET_FORMAT
  62. #endif
  63. #define TARGET_FORMAT "xcoff-powermac"
  64. #endif
  65.  
  66. #ifdef OBJ_ELF
  67. #define TARGET_FORMAT (target_big_endian ? "elf32-powerpc" : "elf32-powerpcle")
  68. #endif
  69.  
  70. /* Permit temporary numeric labels.  */
  71. #define LOCAL_LABELS_FB 1
  72.  
  73. /* $ is used to refer to the current location.  */
  74. #define DOLLAR_DOT
  75.  
  76. /* Strings do not use backslash escapes under COFF.  */
  77. #ifdef OBJ_COFF
  78. #define NO_STRING_ESCAPES
  79. #endif
  80.  
  81. /* When using COFF, we determine whether or not to output a symbol
  82.    based on sy_tc.output, not on the name.  */
  83. #ifdef OBJ_XCOFF
  84. #define LOCAL_LABEL(name) 0
  85. #endif
  86. #ifdef OBJ_ELF
  87. /* When using ELF, local labels start with '.'.  */
  88. #define LOCAL_LABEL(name) (name[0] == '.' \
  89.                && (name[1] == 'L' || name[1] == '.'))
  90. #define FAKE_LABEL_NAME ".L0\001"
  91. #define DIFF_EXPR_OK        /* .-foo gets turned into PC relative relocs */
  92. #endif
  93.  
  94. /* Set the endianness we are using.  Default to big endian.  */
  95. #ifndef TARGET_BYTES_BIG_ENDIAN
  96. #ifndef TARGET_BYTES_LITTLE_ENDIAN
  97. #define TARGET_BYTES_BIG_ENDIAN 1
  98. #endif
  99. #endif
  100.  
  101. #ifdef TARGET_BYTES_BIG_ENDIAN
  102. #define PPC_BIG_ENDIAN 1
  103. #else
  104. #define PPC_BIG_ENDIAN 0
  105. #endif
  106.  
  107. /* We don't need to handle .word strangely.  */
  108. #define WORKING_DOT_WORD
  109.  
  110. /* We set the fx_done field appropriately in md_apply_fix.  */
  111. #define TC_HANDLES_FX_DONE
  112.  
  113. #ifdef TE_PE
  114.  
  115. /* Question marks are permitted in symbol names.  */
  116. #define LEX_QM 1
  117.  
  118. /* Don't adjust TOC relocs.  */
  119. #define tc_fix_adjustable(fixp) ppc_pe_fix_adjustable (fixp)
  120. extern int ppc_pe_fix_adjustable PARAMS ((struct fix *));
  121.  
  122. #endif
  123.  
  124. #ifdef OBJ_XCOFF
  125.  
  126. /* Declarations needed when generating XCOFF code.  XCOFF is an
  127.    extension of COFF, used only on the RS/6000.  Rather than create an
  128.    obj-xcoff, we just use obj-coff, and handle the extensions here in
  129.    tc-ppc.  */
  130.  
  131. /* We need to keep some information for symbols.  */
  132. struct ppc_tc_sy
  133. {
  134.   /* We keep a few linked lists of symbols.  */
  135.   struct symbol *next;
  136.   /* Non-zero if the symbol should be output.  The RS/6000 assembler
  137.      only outputs symbols that are external or are mentioned in a
  138.      .globl or .lglobl statement.  */
  139.   int output;
  140.   /* The symbol class.  */
  141.   int class;
  142.   /* The real name, if the symbol was renamed.  */
  143.   char *real_name;
  144.   /* For a csect symbol, the subsegment we are using.  This is zero
  145.      for symbols that are not csects.  */
  146.   subsegT subseg;
  147.   /* For a csect or common symbol, the alignment to use.  */
  148.   int align;
  149.   /* For a function symbol, a symbol whose value is the size.  The
  150.      field is NULL if there is no size.  */
  151.   struct symbol *size;
  152.   /* For a csect symbol, the last symbol which has been defined in
  153.      this csect, or NULL if none have been defined so far.  For a .bs
  154.      symbol, the referenced csect symbol.  */
  155.   struct symbol *within;
  156. };
  157.  
  158. #define TC_SYMFIELD_TYPE struct ppc_tc_sy
  159.  
  160. /* We need an additional auxent for function symbols.  */
  161. #define OBJ_COFF_MAX_AUXENTRIES 2
  162.  
  163. /* Square and curly brackets are permitted in symbol names.  */
  164. #define LEX_BR 3
  165.  
  166. /* Canonicalize the symbol name.  */
  167. #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
  168. extern char *ppc_canonicalize_symbol_name PARAMS ((char *));
  169.  
  170. /* Get the symbol class from the name.  */
  171. #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
  172. extern void ppc_symbol_new_hook PARAMS ((struct symbol *));
  173.  
  174. /* Set the symbol class of a label based on the csect.  */
  175. #define tc_frob_label(sym) ppc_frob_label (sym)
  176. extern void ppc_frob_label PARAMS ((struct symbol *));
  177.  
  178. /* TOC relocs requires special handling.  */
  179. #define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
  180. extern int ppc_fix_adjustable PARAMS ((struct fix *));
  181.  
  182. /* We need to set the section VMA.  */
  183. #define tc_frob_section(sec) ppc_frob_section (sec)
  184. extern void ppc_frob_section PARAMS ((asection *));
  185.  
  186. /* Finish up the symbol.  */
  187. #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
  188. extern int ppc_frob_symbol PARAMS ((struct symbol *));
  189.  
  190. /* Finish up the entire symtab.  */
  191. #define tc_adjust_symtab() ppc_adjust_symtab ()
  192. extern void ppc_adjust_symtab PARAMS ((void));
  193.  
  194. /* Niclas Andersson <nican@ida.liu.se> says this is needed.  */
  195. #define SUB_SEGMENT_ALIGN(SEG) 2
  196.  
  197. #endif /* OBJ_XCOFF */
  198.  
  199. #ifdef OBJ_ELF
  200. /* The name of the global offset table generated by the compiler. Allow
  201.    this to be overridden if need be. */
  202. #ifndef GLOBAL_OFFSET_TABLE_NAME
  203. #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
  204. #endif
  205.  
  206. /* Branch prediction relocations must force relocation */
  207. #define TC_FORCE_RELOCATION_SECTION(FIXP,SEC)                \
  208. ((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN                \
  209.  || (FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRNTAKEN            \
  210.  || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRTAKEN            \
  211.  || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRNTAKEN            \
  212.  || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy && (FIXP)->fx_addsy->bsym    \
  213.      && (FIXP)->fx_addsy->bsym->section != SEC))
  214.  
  215. /* Support for SHF_EXCLUDE and SHT_ORDERED */
  216. extern int ppc_section_letter PARAMS ((int, char **));
  217. extern int ppc_section_type PARAMS ((char **));
  218. extern int ppc_section_word PARAMS ((char **));
  219. extern int ppc_section_flags PARAMS ((int, int, int));
  220.  
  221. #define md_elf_section_letter(LETTER, PTR_MSG)    ppc_section_letter (LETTER, PTR_MSG)
  222. #define md_elf_section_type(PTR_STR)        ppc_section_type (PTR_STR)
  223. #define md_elf_section_word(PTR_STR)        ppc_section_word (PTR_STR)
  224. #define md_elf_section_flags(FLAGS, ATTR, TYPE)    ppc_section_flags (FLAGS, ATTR, TYPE)
  225.  
  226. /* Add extra PPC sections -- Note, for now, make .sbss2 and .PPC.EMB.sbss0 a
  227.    normal section, and not a bss section so that the linker doesn't crater
  228.    when trying to make more than 2 sections.  */
  229. #define ELF_TC_SPECIAL_SECTIONS \
  230.   { ".tags",        SHT_ORDERED,    SHF_ALLOC }, \
  231.   { ".sdata",        SHT_PROGBITS,    SHF_ALLOC + SHF_WRITE }, \
  232.   { ".sbss",        SHT_NOBITS,    SHF_ALLOC + SHF_WRITE }, \
  233.   { ".sdata2",        SHT_PROGBITS,    SHF_ALLOC }, \
  234.   { ".sbss2",        SHT_PROGBITS,    SHF_ALLOC }, \
  235.   { ".PPC.EMB.sdata0",    SHT_PROGBITS,    SHF_ALLOC }, \
  236.   { ".PPC.EMB.sbss0",    SHT_PROGBITS,    SHF_ALLOC },
  237.  
  238. #endif /* OBJ_ELF */
  239.  
  240. /* call md_apply_fix3 with segment instead of md_apply_fix */
  241. #define MD_APPLY_FIX3
  242.  
  243. /* call md_pcrel_from_section, not md_pcrel_from */
  244. #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
  245.  
  246. #define md_operand(x)
  247.  
  248.