Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* write.h |
b3adc24a | 2 | Copyright (C) 1987-2020 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 | 29 | |
0fbc3568 JW |
30 | /* This is a special character that is used to indicate a fake label. |
31 | It must be present in FAKE_LABEL_NAME, although it does not have to | |
32 | be the first character. It must not be a character that would be | |
33 | found in a valid symbol name. | |
34 | ||
35 | Also be aware that the function _bfd_elf_is_local_label_name in | |
36 | bfd/elf.c has an implicit assumption that FAKE_LABEL_CHAR is '\001'. | |
37 | If this is not the case then FAKE_LABEL_NAME must start with ".L" in | |
38 | order for the function to continue working. */ | |
2469b3c5 JW |
39 | #ifndef FAKE_LABEL_CHAR |
40 | #define FAKE_LABEL_CHAR '\001' | |
41 | #endif | |
42 | ||
252b5132 RH |
43 | /* |
44 | * FixSs may be built up in any order. | |
45 | */ | |
46 | ||
47 | struct fix | |
48 | { | |
5bc11336 AM |
49 | /* Next fixS in linked list, or NULL. */ |
50 | struct fix *fx_next; | |
51 | ||
252b5132 RH |
52 | /* These small fields are grouped together for compactness of |
53 | this structure, and efficiency of access on some architectures. */ | |
54 | ||
252b5132 RH |
55 | /* Is this a pc-relative relocation? */ |
56 | unsigned fx_pcrel : 1; | |
57 | ||
252b5132 RH |
58 | /* Has this relocation already been applied? */ |
59 | unsigned fx_done : 1; | |
60 | ||
61 | /* Suppress overflow complaints on large addends. This is used | |
62 | in the PowerPC ELF config to allow large addends on the | |
63 | BFD_RELOC_{LO16,HI16,HI16_S} relocations. | |
64 | ||
65 | @@ Can this be determined from BFD? */ | |
66 | unsigned fx_no_overflow : 1; | |
67 | ||
68 | /* The value is signed when checking for overflow. */ | |
69 | unsigned fx_signed : 1; | |
70 | ||
5bc11336 AM |
71 | /* Some bits for the CPU specific code. */ |
72 | unsigned fx_tcbit : 1; | |
73 | unsigned fx_tcbit2 : 1; | |
74 | ||
75 | /* Spare bits. */ | |
76 | unsigned fx_unused : 10; | |
77 | ||
552c607f | 78 | /* pc-relative offset adjust (only used by some CPU specific code) */ |
5bc11336 | 79 | int fx_pcrel_adjust : 8; |
20ee54e8 AM |
80 | |
81 | /* How many bytes are involved? */ | |
5bc11336 AM |
82 | unsigned fx_size : 8; |
83 | ||
84 | bfd_reloc_code_real_type fx_r_type; | |
20ee54e8 | 85 | |
252b5132 RH |
86 | /* Which frag does this fix apply to? */ |
87 | fragS *fx_frag; | |
88 | ||
90bd3c90 AM |
89 | /* The location within the frag where the fixup occurs. */ |
90 | unsigned long fx_where; | |
252b5132 | 91 | |
a01b9fa4 | 92 | /* NULL or Symbol whose value we add in. */ |
252b5132 RH |
93 | symbolS *fx_addsy; |
94 | ||
a01b9fa4 | 95 | /* NULL or Symbol whose value we subtract. */ |
252b5132 RH |
96 | symbolS *fx_subsy; |
97 | ||
a01b9fa4 | 98 | /* Absolute number we add in. */ |
252b5132 RH |
99 | valueT fx_offset; |
100 | ||
26346241 AM |
101 | /* The value of dot when the fixup expression was parsed. */ |
102 | addressT fx_dot_value; | |
103 | ||
8e723a10 CLT |
104 | /* The frag fx_dot_value is based on. */ |
105 | fragS *fx_dot_frag; | |
106 | ||
252b5132 RH |
107 | /* This field is sort of misnamed. It appears to be a sort of random |
108 | scratch field, for use by the back ends. The main gas code doesn't | |
109 | do anything but initialize it to zero. The use of it does need to | |
110 | be coordinated between the cpu and format files, though. E.g., some | |
111 | coff targets pass the `addend' field from the cpu file via this | |
112 | field. I don't know why the `fx_offset' field above can't be used | |
113 | for that; investigate later and document. KR */ | |
114 | valueT fx_addnumber; | |
115 | ||
116 | /* The location of the instruction which created the reloc, used | |
117 | in error messages. */ | |
3b4dbbbf | 118 | const char *fx_file; |
252b5132 RH |
119 | unsigned fx_line; |
120 | ||
121 | #ifdef USING_CGEN | |
122 | struct { | |
123 | /* CGEN_INSN entry for this instruction. */ | |
124 | const struct cgen_insn *insn; | |
125 | /* Target specific data, usually reloc number. */ | |
126 | int opinfo; | |
280d71bf DB |
127 | /* Which ifield this fixup applies to. */ |
128 | struct cgen_maybe_multi_ifield * field; | |
129 | /* is this field is the MSB field in a set? */ | |
130 | int msb_field_p; | |
252b5132 RH |
131 | } fx_cgen; |
132 | #endif | |
133 | ||
134 | #ifdef TC_FIX_TYPE | |
135 | /* Location where a backend can attach additional data | |
136 | needed to perform fixups. */ | |
137 | TC_FIX_TYPE tc_fix_data; | |
138 | #endif | |
139 | }; | |
140 | ||
141 | typedef struct fix fixS; | |
142 | ||
05e9452c AM |
143 | struct reloc_list |
144 | { | |
145 | struct reloc_list *next; | |
146 | union | |
147 | { | |
148 | struct | |
149 | { | |
150 | symbolS *offset_sym; | |
151 | reloc_howto_type *howto; | |
152 | symbolS *sym; | |
153 | bfd_vma addend; | |
154 | } a; | |
155 | struct | |
156 | { | |
157 | asection *sec; | |
158 | asymbol *s; | |
159 | arelent r; | |
160 | } b; | |
161 | } u; | |
3b4dbbbf | 162 | const char *file; |
05e9452c AM |
163 | unsigned int line; |
164 | }; | |
165 | ||
e46d99eb | 166 | extern int finalize_syms; |
a161fe53 | 167 | extern symbolS *abs_section_sym; |
26346241 | 168 | extern addressT dot_value; |
8e723a10 | 169 | extern fragS *dot_frag; |
05e9452c | 170 | extern struct reloc_list* reloc_list; |
252b5132 | 171 | |
9136aa49 DG |
172 | extern void append (char **, char *, unsigned long); |
173 | extern void record_alignment (segT, unsigned); | |
174 | extern int get_recorded_alignment (segT); | |
d7342424 KH |
175 | extern void write_object_file (void); |
176 | extern long relax_frag (segT, fragS *, long); | |
32638454 | 177 | extern int relax_segment (struct frag *, segT, int); |
d7342424 KH |
178 | extern void number_to_chars_littleendian (char *, valueT, int); |
179 | extern void number_to_chars_bigendian (char *, valueT, int); | |
90bd3c90 AM |
180 | extern fixS *fix_new (fragS *, unsigned long, unsigned long, symbolS *, |
181 | offsetT, int, bfd_reloc_code_real_type); | |
182 | extern fixS *fix_at_start (fragS *, unsigned long, symbolS *, | |
183 | offsetT, int, bfd_reloc_code_real_type); | |
184 | extern fixS *fix_new_exp (fragS *, unsigned long, unsigned long, | |
185 | expressionS *, int, bfd_reloc_code_real_type); | |
d7342424 | 186 | extern void write_print_statistics (FILE *); |
252b5132 RH |
187 | |
188 | #endif /* __write_h__ */ |