* write.c (subsegs_finish): New function, broken out of
[deliverable/binutils-gdb.git] / gas / write.h
1 /* write.h
2 Copyright (C) 1987, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
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
8 the Free Software Foundation; either version 2, or (at your option)
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
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
20
21 #ifndef TC_I960
22 #ifdef hpux
23 #define EXEC_MACHINE_TYPE HP9000S200_ID
24 #endif
25 #endif /* TC_I960 */
26
27 #ifndef BFD_ASSEMBLER
28
29 #ifndef LOCAL_LABEL
30 #define LOCAL_LABEL(name) (name [0] == 'L' )
31 #endif
32
33 #define S_LOCAL_NAME(s) (LOCAL_LABEL (S_GET_NAME (s)))
34
35 #endif /* ! BFD_ASSEMBLER */
36
37 /* This is the name of a fake symbol which will never appear in the
38 assembler output. S_IS_LOCAL detects it because of the \001. */
39 #define FAKE_LABEL_NAME "L0\001"
40
41 #include "bit_fix.h"
42
43 /*
44 * FixSs may be built up in any order.
45 */
46
47 struct fix
48 {
49 /* These small fields are grouped together for compactness of
50 this structure, and efficiency of access on some architectures. */
51
52 /* pc-relative offset adjust */
53 char fx_pcrel_adjust;
54
55 /* How many bytes are involved? */
56 unsigned char fx_size;
57
58 /* Is this a pc-relative relocation? */
59 unsigned fx_pcrel : 1;
60
61 /* Is this a relocation to a procedure linkage table entry? If so,
62 some of the reductions we try to apply are invalid. A better way
63 might be to represent PLT entries with different kinds of
64 symbols, and use normal relocations (with undefined symbols);
65 look into it for version 2.6. */
66 unsigned fx_plt : 1;
67
68 /* Is this value an immediate displacement? */
69 /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime. */
70 unsigned fx_im_disp : 2;
71
72 /* A bit for the CPU specific code.
73 This probably can be folded into tc_fix_data, below. */
74 unsigned fx_tcbit : 1;
75
76 /* Has this relocation already been applied? */
77 unsigned fx_done : 1;
78
79 /* Suppress overflow complaints on large addends. This is used
80 in the PowerPC ELF config to allow large addends on the
81 BFD_RELOC_{LO16,HI16,HI16_S} relocations.
82
83 @@ Can this be determined from BFD? */
84 unsigned fx_no_overflow : 1;
85
86 /* The value is signed when checking for overflow. */
87 unsigned fx_signed : 1;
88
89 /* Which frag does this fix apply to? */
90 fragS *fx_frag;
91
92 /* Where is the first byte to fix up? */
93 long fx_where;
94
95 /* NULL or Symbol whose value we add in. */
96 symbolS *fx_addsy;
97
98 /* NULL or Symbol whose value we subtract. */
99 symbolS *fx_subsy;
100
101 /* Absolute number we add in. */
102 valueT fx_offset;
103
104 /* Next fixS in linked list, or NULL. */
105 struct fix *fx_next;
106
107 /* If NULL, no bitfix's to do. */
108 /* Only i960-coff and ns32k use this, and i960-coff stores an
109 integer. This can probably be folded into tc_fix_data, below.
110 @@ Alpha also uses it, but only to disable certain relocation
111 processing. */
112 bit_fixS *fx_bit_fixP;
113
114 #ifdef BFD_ASSEMBLER
115 bfd_reloc_code_real_type fx_r_type;
116 #else
117 #ifdef NEED_FX_R_TYPE
118 /* Hack for machines where the type of reloc can't be
119 worked out by looking at how big it is. */
120 int fx_r_type;
121 #endif
122 #endif
123
124 /* This field is sort of misnamed. It appears to be a sort of random
125 scratch field, for use by the back ends. The main gas code doesn't
126 do anything but initialize it to zero. The use of it does need to
127 be coordinated between the cpu and format files, though. E.g., some
128 coff targets pass the `addend' field from the cpu file via this
129 field. I don't know why the `fx_offset' field above can't be used
130 for that; investigate later and document. KR */
131 valueT fx_addnumber;
132
133 /* The location of the instruction which created the reloc, used
134 in error messages. */
135 char *fx_file;
136 unsigned fx_line;
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
147 #ifndef BFD_ASSEMBLER
148 extern char *next_object_file_charP;
149
150 #ifndef MANY_SEGMENTS
151 COMMON fixS *text_fix_root, *text_fix_tail; /* Chains fixSs. */
152 COMMON fixS *data_fix_root, *data_fix_tail; /* Chains fixSs. */
153 COMMON fixS *bss_fix_root, *bss_fix_tail; /* Chains fixSs. */
154 extern struct frag *text_last_frag; /* Last frag in segment. */
155 extern struct frag *data_last_frag; /* Last frag in segment. */
156 #endif
157 COMMON fixS **seg_fix_rootP, **seg_fix_tailP; /* -> one of above. */
158 #endif
159
160 extern long string_byte_count;
161 extern int section_alignment[];
162
163 extern bit_fixS *bit_fix_new
164 PARAMS ((int size, int offset, long base_type, long base_adj, long min,
165 long max, long add));
166 extern void append PARAMS ((char **charPP, char *fromP, unsigned long length));
167 extern void record_alignment PARAMS ((segT seg, int align));
168 extern void subsegs_finish PARAMS ((void));
169 extern void write_object_file PARAMS ((void));
170 extern long relax_frag PARAMS ((fragS *, long));
171 extern void relax_segment
172 PARAMS ((struct frag * seg_frag_root, segT seg_type));
173
174 extern void number_to_chars_littleendian PARAMS ((char *, valueT, int));
175 extern void number_to_chars_bigendian PARAMS ((char *, valueT, int));
176
177 #ifdef BFD_ASSEMBLER
178 extern fixS *fix_new
179 PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
180 offsetT offset, int pcrel, bfd_reloc_code_real_type r_type));
181 extern fixS *fix_new_exp
182 PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
183 bfd_reloc_code_real_type r_type));
184 #else
185 extern fixS *fix_new
186 PARAMS ((fragS * frag, int where, int size, symbolS * add_symbol,
187 offsetT offset, int pcrel, int r_type));
188 extern fixS *fix_new_exp
189 PARAMS ((fragS * frag, int where, int size, expressionS *exp, int pcrel,
190 int r_type));
191 #endif
192
193 extern void write_print_statistics PARAMS ((FILE *));
194
195 /* end of write.h */
This page took 0.03506 seconds and 5 git commands to generate.