* doc/as.texinfo (Reloc): Document.
[deliverable/binutils-gdb.git] / gas / write.h
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.
5
6 This file is part of GAS, the GNU Assembler.
7
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 2, or (at your option)
11 any later version.
12
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.
17
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. */
22
23 #ifndef __write_h__
24 #define __write_h__
25
26 #ifndef TC_I960
27 #ifdef hpux
28 #define EXEC_MACHINE_TYPE HP9000S200_ID
29 #endif
30 #endif /* TC_I960 */
31
32 /* This is the name of a fake symbol which will never appear in the
33 assembler output. S_IS_LOCAL detects it because of the \001. */
34 #ifndef FAKE_LABEL_NAME
35 #define FAKE_LABEL_NAME "L0\001"
36 #endif
37
38 #include "bit_fix.h"
39
40 /*
41 * FixSs may be built up in any order.
42 */
43
44 struct fix
45 {
46 /* These small fields are grouped together for compactness of
47 this structure, and efficiency of access on some architectures. */
48
49 /* Is this a pc-relative relocation? */
50 unsigned fx_pcrel : 1;
51
52 /* Is this value an immediate displacement? */
53 /* Only used on ns32k; merge it into TC_FIX_TYPE sometime. */
54 unsigned fx_im_disp : 2;
55
56 /* Some bits for the CPU specific code. */
57 unsigned fx_tcbit : 1;
58 unsigned fx_tcbit2 : 1;
59
60 /* Has this relocation already been applied? */
61 unsigned fx_done : 1;
62
63 /* Suppress overflow complaints on large addends. This is used
64 in the PowerPC ELF config to allow large addends on the
65 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
66
67 @@ Can this be determined from BFD? */
68 unsigned fx_no_overflow : 1;
69
70 /* The value is signed when checking for overflow. */
71 unsigned fx_signed : 1;
72
73 /* pc-relative offset adjust (only used by m68k and m68hc11) */
74 char fx_pcrel_adjust;
75
76 /* How many bytes are involved? */
77 unsigned char fx_size;
78
79 /* Which frag does this fix apply to? */
80 fragS *fx_frag;
81
82 /* Where is the first byte to fix up? */
83 long fx_where;
84
85 /* NULL or Symbol whose value we add in. */
86 symbolS *fx_addsy;
87
88 /* NULL or Symbol whose value we subtract. */
89 symbolS *fx_subsy;
90
91 /* Absolute number we add in. */
92 valueT fx_offset;
93
94 /* The value of dot when the fixup expression was parsed. */
95 addressT fx_dot_value;
96
97 /* Next fixS in linked list, or NULL. */
98 struct fix *fx_next;
99
100 /* If NULL, no bitfix's to do. */
101 /* Only i960-coff and ns32k use this, and i960-coff stores an
102 integer. This can probably be folded into tc_fix_data, below.
103 @@ Alpha also uses it, but only to disable certain relocation
104 processing. */
105 bit_fixS *fx_bit_fixP;
106
107 bfd_reloc_code_real_type fx_r_type;
108
109 /* This field is sort of misnamed. It appears to be a sort of random
110 scratch field, for use by the back ends. The main gas code doesn't
111 do anything but initialize it to zero. The use of it does need to
112 be coordinated between the cpu and format files, though. E.g., some
113 coff targets pass the `addend' field from the cpu file via this
114 field. I don't know why the `fx_offset' field above can't be used
115 for that; investigate later and document. KR */
116 valueT fx_addnumber;
117
118 /* The location of the instruction which created the reloc, used
119 in error messages. */
120 char *fx_file;
121 unsigned fx_line;
122
123 #ifdef USING_CGEN
124 struct {
125 /* CGEN_INSN entry for this instruction. */
126 const struct cgen_insn *insn;
127 /* Target specific data, usually reloc number. */
128 int opinfo;
129 /* Which ifield this fixup applies to. */
130 struct cgen_maybe_multi_ifield * field;
131 /* is this field is the MSB field in a set? */
132 int msb_field_p;
133 } fx_cgen;
134 #endif
135
136 #ifdef TC_FIX_TYPE
137 /* Location where a backend can attach additional data
138 needed to perform fixups. */
139 TC_FIX_TYPE tc_fix_data;
140 #endif
141 };
142
143 typedef struct fix fixS;
144
145 struct reloc_list
146 {
147 struct reloc_list *next;
148 union
149 {
150 struct
151 {
152 symbolS *offset_sym;
153 reloc_howto_type *howto;
154 symbolS *sym;
155 bfd_vma addend;
156 } a;
157 struct
158 {
159 asection *sec;
160 asymbol *s;
161 arelent r;
162 } b;
163 } u;
164 char *file;
165 unsigned int line;
166 };
167
168 extern int finalize_syms;
169 extern symbolS *abs_section_sym;
170 extern addressT dot_value;
171 extern long string_byte_count;
172 extern int section_alignment[];
173 extern struct reloc_list* reloc_list;
174
175 extern void append (char **charPP, char *fromP, unsigned long length);
176 extern void record_alignment (segT seg, int align);
177 extern int get_recorded_alignment (segT seg);
178 extern void subsegs_finish (void);
179 extern void write_object_file (void);
180 extern long relax_frag (segT, fragS *, long);
181 extern int relax_segment (struct frag *, segT, int);
182 extern void number_to_chars_littleendian (char *, valueT, int);
183 extern void number_to_chars_bigendian (char *, valueT, int);
184 extern fixS *fix_new
185 (fragS * frag, int where, int size, symbolS * add_symbol,
186 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type);
187 extern fixS *fix_new_exp
188 (fragS * frag, int where, int size, expressionS *exp, int pcrel,
189 bfd_reloc_code_real_type r_type);
190 extern void write_print_statistics (FILE *);
191
192 #endif /* __write_h__ */
This page took 0.036923 seconds and 5 git commands to generate.