Back to index

cell-binutils  2.17cvs20070401
write.h
Go to the documentation of this file.
00001 /* write.h
00002    Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
00003    2002, 2003, 2005, 2006, 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 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 #ifndef __write_h__
00024 #define __write_h__
00025 
00026 #ifndef TC_I960
00027 #ifdef hpux
00028 #define EXEC_MACHINE_TYPE HP9000S200_ID
00029 #endif
00030 #endif /* TC_I960 */
00031 
00032 /* This is the name of a fake symbol which will never appear in the
00033    assembler output.  S_IS_LOCAL detects it because of the \001.  */
00034 #ifndef FAKE_LABEL_NAME
00035 #define FAKE_LABEL_NAME "L0\001"
00036 #endif
00037 
00038 #include "bit_fix.h"
00039 
00040 /*
00041  * FixSs may be built up in any order.
00042  */
00043 
00044 struct fix
00045 {
00046   /* These small fields are grouped together for compactness of
00047      this structure, and efficiency of access on some architectures.  */
00048 
00049   /* Is this a pc-relative relocation?  */
00050   unsigned fx_pcrel : 1;
00051 
00052   /* Is this value an immediate displacement?  */
00053   /* Only used on ns32k; merge it into TC_FIX_TYPE sometime.  */
00054   unsigned fx_im_disp : 2;
00055 
00056   /* Some bits for the CPU specific code.  */
00057   unsigned fx_tcbit : 1;
00058   unsigned fx_tcbit2 : 1;
00059 
00060   /* Has this relocation already been applied?  */
00061   unsigned fx_done : 1;
00062 
00063   /* Suppress overflow complaints on large addends.  This is used
00064      in the PowerPC ELF config to allow large addends on the
00065      BFD_RELOC_{LO16,HI16,HI16_S} relocations.
00066 
00067      @@ Can this be determined from BFD?  */
00068   unsigned fx_no_overflow : 1;
00069 
00070   /* The value is signed when checking for overflow.  */
00071   unsigned fx_signed : 1;
00072 
00073   /* pc-relative offset adjust (only used by m68k and m68hc11) */
00074   char fx_pcrel_adjust;
00075 
00076   /* How many bytes are involved? */
00077   unsigned char fx_size;
00078 
00079   /* Which frag does this fix apply to?  */
00080   fragS *fx_frag;
00081 
00082   /* Where is the first byte to fix up?  */
00083   long fx_where;
00084 
00085   /* NULL or Symbol whose value we add in.  */
00086   symbolS *fx_addsy;
00087 
00088   /* NULL or Symbol whose value we subtract.  */
00089   symbolS *fx_subsy;
00090 
00091   /* Absolute number we add in.  */
00092   valueT fx_offset;
00093 
00094   /* The value of dot when the fixup expression was parsed.  */
00095   addressT fx_dot_value;
00096 
00097   /* Next fixS in linked list, or NULL.  */
00098   struct fix *fx_next;
00099 
00100   /* If NULL, no bitfix's to do.  */
00101   /* Only i960-coff and ns32k use this, and i960-coff stores an
00102      integer.  This can probably be folded into tc_fix_data, below.
00103      @@ Alpha also uses it, but only to disable certain relocation
00104      processing.  */
00105   bit_fixS *fx_bit_fixP;
00106 
00107   bfd_reloc_code_real_type fx_r_type;
00108 
00109   /* This field is sort of misnamed.  It appears to be a sort of random
00110      scratch field, for use by the back ends.  The main gas code doesn't
00111      do anything but initialize it to zero.  The use of it does need to
00112      be coordinated between the cpu and format files, though.  E.g., some
00113      coff targets pass the `addend' field from the cpu file via this
00114      field.  I don't know why the `fx_offset' field above can't be used
00115      for that; investigate later and document. KR  */
00116   valueT fx_addnumber;
00117 
00118   /* The location of the instruction which created the reloc, used
00119      in error messages.  */
00120   char *fx_file;
00121   unsigned fx_line;
00122 
00123 #ifdef USING_CGEN
00124   struct {
00125     /* CGEN_INSN entry for this instruction.  */
00126     const struct cgen_insn *insn;
00127     /* Target specific data, usually reloc number.  */
00128     int opinfo;
00129     /* Which ifield this fixup applies to. */
00130     struct cgen_maybe_multi_ifield * field;
00131     /* is this field is the MSB field in a set? */
00132     int msb_field_p;
00133   } fx_cgen;
00134 #endif
00135 
00136 #ifdef TC_FIX_TYPE
00137   /* Location where a backend can attach additional data
00138      needed to perform fixups.  */
00139   TC_FIX_TYPE tc_fix_data;
00140 #endif
00141 };
00142 
00143 typedef struct fix fixS;
00144 
00145 struct reloc_list
00146 {
00147   struct reloc_list *next;
00148   union
00149   {
00150     struct
00151     {
00152       symbolS *offset_sym;
00153       reloc_howto_type *howto;
00154       symbolS *sym;
00155       bfd_vma addend;
00156     } a;
00157     struct
00158     {
00159       asection *sec;
00160       asymbol *s;
00161       arelent r;
00162     } b;
00163   } u;
00164   char *file;
00165   unsigned int line;
00166 };
00167 
00168 extern int finalize_syms;
00169 extern symbolS *abs_section_sym;
00170 extern addressT dot_value;
00171 extern long string_byte_count;
00172 extern int section_alignment[];
00173 extern struct reloc_list* reloc_list;
00174 
00175 extern void append (char **charPP, char *fromP, unsigned long length);
00176 extern void record_alignment (segT seg, int align);
00177 extern int get_recorded_alignment (segT seg);
00178 extern void subsegs_finish (void);
00179 extern void write_object_file (void);
00180 extern long relax_frag (segT, fragS *, long);
00181 extern int relax_segment (struct frag *, segT, int);
00182 extern void number_to_chars_littleendian (char *, valueT, int);
00183 extern void number_to_chars_bigendian (char *, valueT, int);
00184 extern fixS *fix_new
00185   (fragS * frag, int where, int size, symbolS * add_symbol,
00186    offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
00187 extern fixS *fix_new_exp
00188   (fragS * frag, int where, int size, expressionS *exp, int pcrel,
00189    bfd_reloc_code_real_type r_type);
00190 extern void write_print_statistics (FILE *);
00191 
00192 #endif /* __write_h__ */