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