daily update
[binutils/dougsmingw.git] / gas / write.h
blob8303f1be98b6548e4e30a326f042f78e07aed7f5
1 /* write.h
2 Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
3 2002, 2003, 2005, 2006, 2007
4 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 02110-1301, USA. */
23 #ifndef __write_h__
24 #define __write_h__
26 /* This is the name of a fake symbol which will never appear in the
27 assembler output. S_IS_LOCAL detects it because of the \001. */
28 #ifndef FAKE_LABEL_NAME
29 #define FAKE_LABEL_NAME "L0\001"
30 #endif
32 #include "bit_fix.h"
35 * FixSs may be built up in any order.
38 struct fix
40 /* These small fields are grouped together for compactness of
41 this structure, and efficiency of access on some architectures. */
43 /* Is this a pc-relative relocation? */
44 unsigned fx_pcrel : 1;
46 /* Is this value an immediate displacement? */
47 /* Only used on ns32k; merge it into TC_FIX_TYPE sometime. */
48 unsigned fx_im_disp : 2;
50 /* Some bits for the CPU specific code. */
51 unsigned fx_tcbit : 1;
52 unsigned fx_tcbit2 : 1;
54 /* Has this relocation already been applied? */
55 unsigned fx_done : 1;
57 /* Suppress overflow complaints on large addends. This is used
58 in the PowerPC ELF config to allow large addends on the
59 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
61 @@ Can this be determined from BFD? */
62 unsigned fx_no_overflow : 1;
64 /* The value is signed when checking for overflow. */
65 unsigned fx_signed : 1;
67 /* pc-relative offset adjust (only used by m68k and m68hc11) */
68 char fx_pcrel_adjust;
70 /* How many bytes are involved? */
71 unsigned char fx_size;
73 /* Which frag does this fix apply to? */
74 fragS *fx_frag;
76 /* Where is the first byte to fix up? */
77 long fx_where;
79 /* NULL or Symbol whose value we add in. */
80 symbolS *fx_addsy;
82 /* NULL or Symbol whose value we subtract. */
83 symbolS *fx_subsy;
85 /* Absolute number we add in. */
86 valueT fx_offset;
88 /* The value of dot when the fixup expression was parsed. */
89 addressT fx_dot_value;
91 /* Next fixS in linked list, or NULL. */
92 struct fix *fx_next;
94 /* If NULL, no bitfix's to do. */
95 /* Only i960-coff and ns32k use this, and i960-coff stores an
96 integer. This can probably be folded into tc_fix_data, below.
97 @@ Alpha also uses it, but only to disable certain relocation
98 processing. */
99 bit_fixS *fx_bit_fixP;
101 bfd_reloc_code_real_type fx_r_type;
103 /* This field is sort of misnamed. It appears to be a sort of random
104 scratch field, for use by the back ends. The main gas code doesn't
105 do anything but initialize it to zero. The use of it does need to
106 be coordinated between the cpu and format files, though. E.g., some
107 coff targets pass the `addend' field from the cpu file via this
108 field. I don't know why the `fx_offset' field above can't be used
109 for that; investigate later and document. KR */
110 valueT fx_addnumber;
112 /* The location of the instruction which created the reloc, used
113 in error messages. */
114 char *fx_file;
115 unsigned fx_line;
117 #ifdef USING_CGEN
118 struct {
119 /* CGEN_INSN entry for this instruction. */
120 const struct cgen_insn *insn;
121 /* Target specific data, usually reloc number. */
122 int opinfo;
123 /* Which ifield this fixup applies to. */
124 struct cgen_maybe_multi_ifield * field;
125 /* is this field is the MSB field in a set? */
126 int msb_field_p;
127 } fx_cgen;
128 #endif
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
137 typedef struct fix fixS;
139 struct reloc_list
141 struct reloc_list *next;
142 union
144 struct
146 symbolS *offset_sym;
147 reloc_howto_type *howto;
148 symbolS *sym;
149 bfd_vma addend;
150 } a;
151 struct
153 asection *sec;
154 asymbol *s;
155 arelent r;
156 } b;
157 } u;
158 char *file;
159 unsigned int line;
162 extern int finalize_syms;
163 extern symbolS *abs_section_sym;
164 extern addressT dot_value;
165 extern struct reloc_list* reloc_list;
167 extern void append (char **charPP, char *fromP, unsigned long length);
168 extern void record_alignment (segT seg, int align);
169 extern int get_recorded_alignment (segT seg);
170 extern void subsegs_finish (void);
171 extern void write_object_file (void);
172 extern long relax_frag (segT, fragS *, long);
173 extern int relax_segment (struct frag *, segT, int);
174 extern void number_to_chars_littleendian (char *, valueT, int);
175 extern void number_to_chars_bigendian (char *, valueT, int);
176 extern fixS *fix_new
177 (fragS * frag, int where, int size, symbolS * add_symbol,
178 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
179 extern fixS *fix_at_start
180 (fragS * frag, int size, symbolS * add_symbol,
181 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
182 extern fixS *fix_new_exp
183 (fragS * frag, int where, int size, expressionS *exp, int pcrel,
184 bfd_reloc_code_real_type r_type);
185 extern void write_print_statistics (FILE *);
187 #endif /* __write_h__ */