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 / write.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  6KB  |  187 lines

  1. /* write.h
  2.    Copyright (C) 1987, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
  3.  
  4.    This file is part of GAS, the GNU Assembler.
  5.  
  6.    GAS is free software; you can redistribute it and/or modify
  7.    it under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2, or (at your option)
  9.    any later version.
  10.  
  11.    GAS is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with GAS; see the file COPYING.  If not, write to
  18.    the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  19.  
  20. #ifndef TC_I960
  21. #ifdef hpux
  22. #define EXEC_MACHINE_TYPE HP9000S200_ID
  23. #endif
  24. #endif /* TC_I960 */
  25.  
  26. #ifndef LOCAL_LABEL
  27. #define LOCAL_LABEL(name) (name [0] == 'L' )
  28. #endif /* LOCAL_LABEL */
  29.  
  30. #ifndef FAKE_LABEL_NAME
  31. #define FAKE_LABEL_NAME "L0\001"
  32. #endif
  33.  
  34. #define S_LOCAL_NAME(s) (LOCAL_LABEL(S_GET_NAME(s)))
  35.  
  36. #include "bit_fix.h"
  37.  
  38. /*
  39.  * FixSs may be built up in any order.
  40.  */
  41.  
  42. struct fix
  43. {
  44.   /* These small fields are grouped together for compactness of
  45.      this structure, and efficiency of access on some architectures.  */
  46.  
  47.   /* pc-relative offset adjust */
  48.   char fx_pcrel_adjust;
  49.  
  50.   /* How many bytes are involved? */
  51.   unsigned char fx_size;
  52.  
  53.   /* Is this a pc-relative relocation?  */
  54.   unsigned fx_pcrel : 1;
  55.  
  56.   /* Is this a relocation to a procedure linkage table entry?  If so,
  57.      some of the reductions we try to apply are invalid.  A better way
  58.      might be to represent PLT entries with different kinds of
  59.      symbols, and use normal relocations (with undefined symbols);
  60.      look into it for version 2.6.  */
  61.   unsigned fx_plt : 1;
  62.  
  63.   /* Is this value an immediate displacement?  */
  64.   /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime.  */
  65.   unsigned fx_im_disp : 2;
  66.  
  67.   /* A bit for the CPU specific code.
  68.      This probably can be folded into tc_fix_data, below.  */
  69.   unsigned fx_tcbit : 1;
  70.  
  71.   /* Has this relocation already been applied?  */
  72.   unsigned fx_done : 1;
  73.  
  74.   /* Suppress overflow complaints on large addends.  This is used
  75.      in the PowerPC ELF config to allow large addends on the
  76.      BFD_RELOC_{LO16,HI16,HI16_S} relocations.
  77.  
  78.      @@ Can this be determined from BFD?  */
  79.   unsigned fx_no_overflow : 1;
  80.  
  81.   /* Which frag does this fix apply to?  */
  82.   fragS *fx_frag;
  83.  
  84.   /* Where is the first byte to fix up?  */
  85.   long fx_where;
  86.  
  87.   /* NULL or Symbol whose value we add in. */
  88.   symbolS *fx_addsy;
  89.  
  90.   /* NULL or Symbol whose value we subtract. */
  91.   symbolS *fx_subsy;
  92.  
  93.   /* Absolute number we add in. */
  94.   valueT fx_offset;
  95.  
  96.   /* Next fixS in linked list, or NULL.  */
  97.   struct fix *fx_next;
  98.  
  99.   /* If NULL, no bitfix's to do.  */
  100.   /* Only i960-coff and ns32k use this, and i960-coff stores an
  101.      integer.  This can probably be folded into tc_fix_data, below.
  102.      @@ Alpha also uses it, but only to disable certain relocation
  103.      processing.  */
  104.   bit_fixS *fx_bit_fixP;
  105.  
  106. #ifdef BFD_ASSEMBLER
  107.   bfd_reloc_code_real_type fx_r_type;
  108. #else
  109. #ifdef NEED_FX_R_TYPE
  110.   /* Hack for machines where the type of reloc can't be
  111.      worked out by looking at how big it is.  */
  112.   int fx_r_type;
  113. #endif
  114. #endif
  115.  
  116.   /* This field is sort of misnamed.  It appears to be a sort of random
  117.      scratch field, for use by the back ends.  The main gas code doesn't
  118.      do anything but initialize it to zero.  The use of it does need to
  119.      be coordinated between the cpu and format files, though.  E.g., some
  120.      coff targets pass the `addend' field from the cpu file via this
  121.      field.  I don't know why the `fx_offset' field above can't be used
  122.      for that; investigate later and document. KR  */
  123.   valueT fx_addnumber;
  124.  
  125.   /* The location of the instruction which created the reloc, used
  126.      in error messages.  */
  127.   char *fx_file;
  128.   unsigned fx_line;
  129.  
  130. #ifdef TC_FIX_TYPE
  131.   /* Location where a backend can attach additional data
  132.      needed to perform fixups.  */
  133.   TC_FIX_TYPE tc_fix_data;
  134. #endif
  135. };
  136.  
  137. typedef struct fix fixS;
  138.  
  139. #ifndef BFD_ASSEMBLER
  140. extern char *next_object_file_charP;
  141.  
  142. #ifndef MANY_SEGMENTS
  143. COMMON fixS *text_fix_root, *text_fix_tail;    /* Chains fixSs. */
  144. COMMON fixS *data_fix_root, *data_fix_tail;    /* Chains fixSs. */
  145. COMMON fixS *bss_fix_root, *bss_fix_tail;    /* Chains fixSs. */
  146. extern struct frag *text_last_frag;        /* Last frag in segment. */
  147. extern struct frag *data_last_frag;        /* Last frag in segment. */
  148. #endif
  149. COMMON fixS **seg_fix_rootP, **seg_fix_tailP;    /* -> one of above. */
  150. #endif
  151.  
  152. extern long string_byte_count;
  153. extern int section_alignment[];
  154.  
  155. extern bit_fixS *bit_fix_new
  156.   PARAMS ((int size, int offset, long base_type, long base_adj, long min,
  157.        long max, long add));
  158. extern void append PARAMS ((char **charPP, char *fromP, unsigned long length));
  159. extern void record_alignment PARAMS ((segT seg, int align));
  160. extern void write_object_file PARAMS ((void));
  161. extern void relax_segment
  162.   PARAMS ((struct frag * seg_frag_root, segT seg_type));
  163.  
  164. extern void number_to_chars_littleendian PARAMS ((char *, valueT, int));
  165. extern void number_to_chars_bigendian    PARAMS ((char *, valueT, int));
  166.  
  167. #ifdef BFD_ASSEMBLER
  168. extern fixS *fix_new
  169.   PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
  170.        offsetT offset, int pcrel, bfd_reloc_code_real_type r_type,
  171.        int baserel));
  172. extern fixS *fix_new_exp
  173.   PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
  174.        bfd_reloc_code_real_type r_type, int baserel));
  175. #else
  176. extern fixS *fix_new
  177.   PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
  178.        offsetT offset, int pcrel, int r_type, int baserel));
  179. extern fixS *fix_new_exp
  180.   PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
  181.        int r_type, int baserel));
  182. #endif
  183.  
  184. extern void write_print_statistics PARAMS ((FILE *));
  185.  
  186. /* end of write.h */
  187.