]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* write.h |
2da5c037 | 2 | Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, |
7be1c489 | 3 | 2002, 2003, 2005 Free Software Foundation, Inc. |
252b5132 RH |
4 | |
5 | This file is part of GAS, the GNU Assembler. | |
6 | ||
7 | GAS is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | GAS is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GAS; see the file COPYING. If not, write to the Free | |
4b4da160 NC |
19 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
20 | 02110-1301, USA. */ | |
252b5132 RH |
21 | |
22 | #ifndef __write_h__ | |
23 | #define __write_h__ | |
24 | ||
25 | #ifndef TC_I960 | |
26 | #ifdef hpux | |
27 | #define EXEC_MACHINE_TYPE HP9000S200_ID | |
28 | #endif | |
29 | #endif /* TC_I960 */ | |
30 | ||
252b5132 RH |
31 | /* This is the name of a fake symbol which will never appear in the |
32 | assembler output. S_IS_LOCAL detects it because of the \001. */ | |
7ff0565e | 33 | #ifndef FAKE_LABEL_NAME |
252b5132 | 34 | #define FAKE_LABEL_NAME "L0\001" |
7ff0565e | 35 | #endif |
252b5132 RH |
36 | |
37 | #include "bit_fix.h" | |
38 | ||
39 | /* | |
40 | * FixSs may be built up in any order. | |
41 | */ | |
42 | ||
43 | struct fix | |
44 | { | |
45 | /* These small fields are grouped together for compactness of | |
46 | this structure, and efficiency of access on some architectures. */ | |
47 | ||
48 | /* pc-relative offset adjust (only used by m68k) */ | |
49 | char fx_pcrel_adjust; | |
50 | ||
51 | /* How many bytes are involved? */ | |
52 | unsigned char fx_size; | |
53 | ||
54 | /* Is this a pc-relative relocation? */ | |
55 | unsigned fx_pcrel : 1; | |
56 | ||
57 | /* Is this a relocation to a procedure linkage table entry? If so, | |
58 | some of the reductions we try to apply are invalid. A better way | |
59 | might be to represent PLT entries with different kinds of | |
60 | symbols, and use normal relocations (with undefined symbols); | |
61 | look into it for version 2.6. */ | |
62 | unsigned fx_plt : 1; | |
63 | ||
64 | /* Is this value an immediate displacement? */ | |
65 | /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime. */ | |
66 | unsigned fx_im_disp : 2; | |
67 | ||
68 | /* A bit for the CPU specific code. | |
69 | This probably can be folded into tc_fix_data, below. */ | |
70 | unsigned fx_tcbit : 1; | |
71 | ||
72 | /* Has this relocation already been applied? */ | |
73 | unsigned fx_done : 1; | |
74 | ||
75 | /* Suppress overflow complaints on large addends. This is used | |
76 | in the PowerPC ELF config to allow large addends on the | |
77 | BFD_RELOC_{LO16,HI16,HI16_S} relocations. | |
78 | ||
79 | @@ Can this be determined from BFD? */ | |
80 | unsigned fx_no_overflow : 1; | |
81 | ||
82 | /* The value is signed when checking for overflow. */ | |
83 | unsigned fx_signed : 1; | |
84 | ||
85 | /* Which frag does this fix apply to? */ | |
86 | fragS *fx_frag; | |
87 | ||
88 | /* Where is the first byte to fix up? */ | |
89 | long fx_where; | |
90 | ||
a01b9fa4 | 91 | /* NULL or Symbol whose value we add in. */ |
252b5132 RH |
92 | symbolS *fx_addsy; |
93 | ||
a01b9fa4 | 94 | /* NULL or Symbol whose value we subtract. */ |
252b5132 RH |
95 | symbolS *fx_subsy; |
96 | ||
a01b9fa4 | 97 | /* Absolute number we add in. */ |
252b5132 RH |
98 | valueT fx_offset; |
99 | ||
26346241 AM |
100 | /* The value of dot when the fixup expression was parsed. */ |
101 | addressT fx_dot_value; | |
102 | ||
252b5132 RH |
103 | /* Next fixS in linked list, or NULL. */ |
104 | struct fix *fx_next; | |
105 | ||
106 | /* If NULL, no bitfix's to do. */ | |
107 | /* Only i960-coff and ns32k use this, and i960-coff stores an | |
108 | integer. This can probably be folded into tc_fix_data, below. | |
109 | @@ Alpha also uses it, but only to disable certain relocation | |
110 | processing. */ | |
111 | bit_fixS *fx_bit_fixP; | |
112 | ||
252b5132 | 113 | bfd_reloc_code_real_type fx_r_type; |
252b5132 RH |
114 | |
115 | /* This field is sort of misnamed. It appears to be a sort of random | |
116 | scratch field, for use by the back ends. The main gas code doesn't | |
117 | do anything but initialize it to zero. The use of it does need to | |
118 | be coordinated between the cpu and format files, though. E.g., some | |
119 | coff targets pass the `addend' field from the cpu file via this | |
120 | field. I don't know why the `fx_offset' field above can't be used | |
121 | for that; investigate later and document. KR */ | |
122 | valueT fx_addnumber; | |
123 | ||
124 | /* The location of the instruction which created the reloc, used | |
125 | in error messages. */ | |
126 | char *fx_file; | |
127 | unsigned fx_line; | |
128 | ||
129 | #ifdef USING_CGEN | |
130 | struct { | |
131 | /* CGEN_INSN entry for this instruction. */ | |
132 | const struct cgen_insn *insn; | |
133 | /* Target specific data, usually reloc number. */ | |
134 | int opinfo; | |
135 | } fx_cgen; | |
136 | #endif | |
137 | ||
138 | #ifdef TC_FIX_TYPE | |
139 | /* Location where a backend can attach additional data | |
140 | needed to perform fixups. */ | |
141 | TC_FIX_TYPE tc_fix_data; | |
142 | #endif | |
143 | }; | |
144 | ||
145 | typedef struct fix fixS; | |
146 | ||
e46d99eb | 147 | extern int finalize_syms; |
a161fe53 | 148 | extern symbolS *abs_section_sym; |
26346241 | 149 | extern addressT dot_value; |
252b5132 RH |
150 | extern long string_byte_count; |
151 | extern int section_alignment[]; | |
152 | ||
d7342424 KH |
153 | extern void append (char **charPP, char *fromP, unsigned long length); |
154 | extern void record_alignment (segT seg, int align); | |
155 | extern int get_recorded_alignment (segT seg); | |
156 | extern void subsegs_finish (void); | |
157 | extern void write_object_file (void); | |
158 | extern long relax_frag (segT, fragS *, long); | |
159 | extern int relax_segment (struct frag * seg_frag_root, segT seg_type); | |
d7342424 KH |
160 | extern void number_to_chars_littleendian (char *, valueT, int); |
161 | extern void number_to_chars_bigendian (char *, valueT, int); | |
252b5132 | 162 | extern fixS *fix_new |
d7342424 KH |
163 | (fragS * frag, int where, int size, symbolS * add_symbol, |
164 | offsetT offset, int pcrel, bfd_reloc_code_real_type r_type); | |
252b5132 | 165 | extern fixS *fix_new_exp |
d7342424 KH |
166 | (fragS * frag, int where, int size, expressionS *exp, int pcrel, |
167 | bfd_reloc_code_real_type r_type); | |
d7342424 | 168 | extern void write_print_statistics (FILE *); |
252b5132 RH |
169 | |
170 | #endif /* __write_h__ */ |