1 |
104 |
markom |
@section Targets
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
@strong{Description}@*
|
5 |
|
|
Each port of BFD to a different machine requries the creation
|
6 |
|
|
of a target back end. All the back end provides to the root
|
7 |
|
|
part of BFD is a structure containing pointers to functions
|
8 |
|
|
which perform certain low level operations on files. BFD
|
9 |
|
|
translates the applications's requests through a pointer into
|
10 |
|
|
calls to the back end routines.
|
11 |
|
|
|
12 |
|
|
When a file is opened with @code{bfd_openr}, its format and
|
13 |
|
|
target are unknown. BFD uses various mechanisms to determine
|
14 |
|
|
how to interpret the file. The operations performed are:
|
15 |
|
|
|
16 |
|
|
@itemize @bullet
|
17 |
|
|
|
18 |
|
|
@item
|
19 |
|
|
Create a BFD by calling the internal routine
|
20 |
|
|
@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the
|
21 |
|
|
target string supplied to @code{bfd_openr} and the new BFD pointer.
|
22 |
|
|
|
23 |
|
|
@item
|
24 |
|
|
If a null target string was provided to @code{bfd_find_target},
|
25 |
|
|
look up the environment variable @code{GNUTARGET} and use
|
26 |
|
|
that as the target string.
|
27 |
|
|
|
28 |
|
|
@item
|
29 |
|
|
If the target string is still @code{NULL}, or the target string is
|
30 |
|
|
@code{default}, then use the first item in the target vector
|
31 |
|
|
as the target type, and set @code{target_defaulted} in the BFD to
|
32 |
|
|
cause @code{bfd_check_format} to loop through all the targets.
|
33 |
|
|
@xref{bfd_target}. @xref{Formats}.
|
34 |
|
|
|
35 |
|
|
@item
|
36 |
|
|
Otherwise, inspect the elements in the target vector
|
37 |
|
|
one by one, until a match on target name is found. When found,
|
38 |
|
|
use it.
|
39 |
|
|
|
40 |
|
|
@item
|
41 |
|
|
Otherwise return the error @code{bfd_error_invalid_target} to
|
42 |
|
|
@code{bfd_openr}.
|
43 |
|
|
|
44 |
|
|
@item
|
45 |
|
|
@code{bfd_openr} attempts to open the file using
|
46 |
|
|
@code{bfd_open_file}, and returns the BFD.
|
47 |
|
|
@end itemize
|
48 |
|
|
Once the BFD has been opened and the target selected, the file
|
49 |
|
|
format may be determined. This is done by calling
|
50 |
|
|
@code{bfd_check_format} on the BFD with a suggested format.
|
51 |
|
|
If @code{target_defaulted} has been set, each possible target
|
52 |
|
|
type is tried to see if it recognizes the specified format.
|
53 |
|
|
@code{bfd_check_format} returns @code{true} when the caller guesses right.
|
54 |
|
|
@menu
|
55 |
|
|
* bfd_target::
|
56 |
|
|
@end menu
|
57 |
|
|
|
58 |
|
|
@node bfd_target, , Targets, Targets
|
59 |
|
|
|
60 |
|
|
@subsection bfd_target
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
@strong{Description}@*
|
64 |
|
|
This structure contains everything that BFD knows about a
|
65 |
|
|
target. It includes things like its byte order, name, and which
|
66 |
|
|
routines to call to do various operations.
|
67 |
|
|
|
68 |
|
|
Every BFD points to a target structure with its @code{xvec}
|
69 |
|
|
member.
|
70 |
|
|
|
71 |
|
|
The macros below are used to dispatch to functions through the
|
72 |
|
|
@code{bfd_target} vector. They are used in a number of macros further
|
73 |
|
|
down in @file{bfd.h}, and are also used when calling various
|
74 |
|
|
routines by hand inside the BFD implementation. The @var{arglist}
|
75 |
|
|
argument must be parenthesized; it contains all the arguments
|
76 |
|
|
to the called function.
|
77 |
|
|
|
78 |
|
|
They make the documentation (more) unpleasant to read, so if
|
79 |
|
|
someone wants to fix this and not break the above, please do.
|
80 |
|
|
@example
|
81 |
|
|
#define BFD_SEND(bfd, message, arglist) \
|
82 |
|
|
((*((bfd)->xvec->message)) arglist)
|
83 |
|
|
|
84 |
|
|
#ifdef DEBUG_BFD_SEND
|
85 |
|
|
#undef BFD_SEND
|
86 |
|
|
#define BFD_SEND(bfd, message, arglist) \
|
87 |
|
|
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
88 |
|
|
((*((bfd)->xvec->message)) arglist) : \
|
89 |
|
|
(bfd_assert (__FILE__,__LINE__), NULL))
|
90 |
|
|
#endif
|
91 |
|
|
@end example
|
92 |
|
|
For operations which index on the BFD format:
|
93 |
|
|
@example
|
94 |
|
|
#define BFD_SEND_FMT(bfd, message, arglist) \
|
95 |
|
|
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
|
96 |
|
|
|
97 |
|
|
#ifdef DEBUG_BFD_SEND
|
98 |
|
|
#undef BFD_SEND_FMT
|
99 |
|
|
#define BFD_SEND_FMT(bfd, message, arglist) \
|
100 |
|
|
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
101 |
|
|
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
|
102 |
|
|
(bfd_assert (__FILE__,__LINE__), NULL))
|
103 |
|
|
#endif
|
104 |
|
|
@end example
|
105 |
|
|
This is the structure which defines the type of BFD this is. The
|
106 |
|
|
@code{xvec} member of the struct @code{bfd} itself points here. Each
|
107 |
|
|
module that implements access to a different target under BFD,
|
108 |
|
|
defines one of these.
|
109 |
|
|
|
110 |
|
|
FIXME, these names should be rationalised with the names of
|
111 |
|
|
the entry points which call them. Too bad we can't have one
|
112 |
|
|
macro to define them both!
|
113 |
|
|
@example
|
114 |
|
|
enum bfd_flavour @{
|
115 |
|
|
bfd_target_unknown_flavour,
|
116 |
|
|
bfd_target_aout_flavour,
|
117 |
|
|
bfd_target_coff_flavour,
|
118 |
|
|
bfd_target_ecoff_flavour,
|
119 |
|
|
bfd_target_elf_flavour,
|
120 |
|
|
bfd_target_ieee_flavour,
|
121 |
|
|
bfd_target_nlm_flavour,
|
122 |
|
|
bfd_target_oasys_flavour,
|
123 |
|
|
bfd_target_tekhex_flavour,
|
124 |
|
|
bfd_target_srec_flavour,
|
125 |
|
|
bfd_target_ihex_flavour,
|
126 |
|
|
bfd_target_som_flavour,
|
127 |
|
|
bfd_target_os9k_flavour,
|
128 |
|
|
bfd_target_versados_flavour,
|
129 |
|
|
bfd_target_msdos_flavour,
|
130 |
|
|
bfd_target_ovax_flavour,
|
131 |
|
|
bfd_target_evax_flavour
|
132 |
|
|
@};
|
133 |
|
|
|
134 |
|
|
enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};
|
135 |
|
|
|
136 |
|
|
/* Forward declaration. */
|
137 |
|
|
typedef struct bfd_link_info _bfd_link_info;
|
138 |
|
|
|
139 |
|
|
typedef struct bfd_target
|
140 |
|
|
@{
|
141 |
|
|
@end example
|
142 |
|
|
Identifies the kind of target, e.g., SunOS4, Ultrix, etc.
|
143 |
|
|
@example
|
144 |
|
|
char *name;
|
145 |
|
|
@end example
|
146 |
|
|
The "flavour" of a back end is a general indication about the contents
|
147 |
|
|
of a file.
|
148 |
|
|
@example
|
149 |
|
|
enum bfd_flavour flavour;
|
150 |
|
|
@end example
|
151 |
|
|
The order of bytes within the data area of a file.
|
152 |
|
|
@example
|
153 |
|
|
enum bfd_endian byteorder;
|
154 |
|
|
@end example
|
155 |
|
|
The order of bytes within the header parts of a file.
|
156 |
|
|
@example
|
157 |
|
|
enum bfd_endian header_byteorder;
|
158 |
|
|
@end example
|
159 |
|
|
A mask of all the flags which an executable may have set -
|
160 |
|
|
from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}.
|
161 |
|
|
@example
|
162 |
|
|
flagword object_flags;
|
163 |
|
|
@end example
|
164 |
|
|
A mask of all the flags which a section may have set - from
|
165 |
|
|
the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}.
|
166 |
|
|
@example
|
167 |
|
|
flagword section_flags;
|
168 |
|
|
@end example
|
169 |
|
|
The character normally found at the front of a symbol
|
170 |
|
|
(if any), perhaps `_'.
|
171 |
|
|
@example
|
172 |
|
|
char symbol_leading_char;
|
173 |
|
|
@end example
|
174 |
|
|
The pad character for file names within an archive header.
|
175 |
|
|
@example
|
176 |
|
|
char ar_pad_char;
|
177 |
|
|
@end example
|
178 |
|
|
The maximum number of characters in an archive header.
|
179 |
|
|
@example
|
180 |
|
|
unsigned short ar_max_namelen;
|
181 |
|
|
@end example
|
182 |
|
|
Entries for byte swapping for data. These are different from the other
|
183 |
|
|
entry points, since they don't take a BFD asthe first argument.
|
184 |
|
|
Certain other handlers could do the same.
|
185 |
|
|
@example
|
186 |
|
|
bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
|
187 |
|
|
bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
|
188 |
|
|
void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
189 |
|
|
bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
|
190 |
|
|
bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
|
191 |
|
|
void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
192 |
|
|
bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
|
193 |
|
|
bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
|
194 |
|
|
void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
195 |
|
|
@end example
|
196 |
|
|
Byte swapping for the headers
|
197 |
|
|
@example
|
198 |
|
|
bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
|
199 |
|
|
bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
|
200 |
|
|
void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
201 |
|
|
bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
|
202 |
|
|
bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
|
203 |
|
|
void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
204 |
|
|
bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
|
205 |
|
|
bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
|
206 |
|
|
void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
207 |
|
|
@end example
|
208 |
|
|
Format dependent routines: these are vectors of entry points
|
209 |
|
|
within the target vector structure, one for each format to check.
|
210 |
|
|
|
211 |
|
|
Check the format of a file being read. Return a @code{bfd_target *} or zero.
|
212 |
|
|
@example
|
213 |
|
|
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
|
214 |
|
|
@end example
|
215 |
|
|
Set the format of a file being written.
|
216 |
|
|
@example
|
217 |
|
|
boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
|
218 |
|
|
@end example
|
219 |
|
|
Write cached information into a file being written, at @code{bfd_close}.
|
220 |
|
|
@example
|
221 |
|
|
boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
|
222 |
|
|
@end example
|
223 |
|
|
The general target vector. These vectors are initialized using the
|
224 |
|
|
BFD_JUMP_TABLE macros.
|
225 |
|
|
@example
|
226 |
|
|
|
227 |
|
|
/* Generic entry points. */
|
228 |
|
|
#define BFD_JUMP_TABLE_GENERIC(NAME)\
|
229 |
|
|
CAT(NAME,_close_and_cleanup),\
|
230 |
|
|
CAT(NAME,_bfd_free_cached_info),\
|
231 |
|
|
CAT(NAME,_new_section_hook),\
|
232 |
|
|
CAT(NAME,_get_section_contents),\
|
233 |
|
|
CAT(NAME,_get_section_contents_in_window)
|
234 |
|
|
|
235 |
|
|
/* Called when the BFD is being closed to do any necessary cleanup. */
|
236 |
|
|
boolean (*_close_and_cleanup) PARAMS ((bfd *));
|
237 |
|
|
/* Ask the BFD to free all cached information. */
|
238 |
|
|
boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
|
239 |
|
|
/* Called when a new section is created. */
|
240 |
|
|
boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
|
241 |
|
|
/* Read the contents of a section. */
|
242 |
|
|
boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
|
243 |
|
|
file_ptr, bfd_size_type));
|
244 |
|
|
boolean (*_bfd_get_section_contents_in_window)
|
245 |
|
|
PARAMS ((bfd *, sec_ptr, bfd_window *,
|
246 |
|
|
file_ptr, bfd_size_type));
|
247 |
|
|
|
248 |
|
|
/* Entry points to copy private data. */
|
249 |
|
|
#define BFD_JUMP_TABLE_COPY(NAME)\
|
250 |
|
|
CAT(NAME,_bfd_copy_private_bfd_data),\
|
251 |
|
|
CAT(NAME,_bfd_merge_private_bfd_data),\
|
252 |
|
|
CAT(NAME,_bfd_copy_private_section_data),\
|
253 |
|
|
CAT(NAME,_bfd_copy_private_symbol_data),\
|
254 |
|
|
CAT(NAME,_bfd_set_private_flags),\
|
255 |
|
|
CAT(NAME,_bfd_print_private_bfd_data)\
|
256 |
|
|
/* Called to copy BFD general private data from one object file
|
257 |
|
|
to another. */
|
258 |
|
|
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
|
259 |
|
|
/* Called to merge BFD general private data from one object file
|
260 |
|
|
to a common output file when linking. */
|
261 |
|
|
boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
|
262 |
|
|
/* Called to copy BFD private section data from one object file
|
263 |
|
|
to another. */
|
264 |
|
|
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
|
265 |
|
|
bfd *, sec_ptr));
|
266 |
|
|
/* Called to copy BFD private symbol data from one symbol
|
267 |
|
|
to another. */
|
268 |
|
|
boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
|
269 |
|
|
bfd *, asymbol *));
|
270 |
|
|
/* Called to set private backend flags */
|
271 |
|
|
boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
|
272 |
|
|
|
273 |
|
|
/* Called to print private BFD data */
|
274 |
|
|
boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
|
275 |
|
|
|
276 |
|
|
/* Core file entry points. */
|
277 |
|
|
#define BFD_JUMP_TABLE_CORE(NAME)\
|
278 |
|
|
CAT(NAME,_core_file_failing_command),\
|
279 |
|
|
CAT(NAME,_core_file_failing_signal),\
|
280 |
|
|
CAT(NAME,_core_file_matches_executable_p)
|
281 |
|
|
char * (*_core_file_failing_command) PARAMS ((bfd *));
|
282 |
|
|
int (*_core_file_failing_signal) PARAMS ((bfd *));
|
283 |
|
|
boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
|
284 |
|
|
|
285 |
|
|
/* Archive entry points. */
|
286 |
|
|
#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
|
287 |
|
|
CAT(NAME,_slurp_armap),\
|
288 |
|
|
CAT(NAME,_slurp_extended_name_table),\
|
289 |
|
|
CAT(NAME,_construct_extended_name_table),\
|
290 |
|
|
CAT(NAME,_truncate_arname),\
|
291 |
|
|
CAT(NAME,_write_armap),\
|
292 |
|
|
CAT(NAME,_read_ar_hdr),\
|
293 |
|
|
CAT(NAME,_openr_next_archived_file),\
|
294 |
|
|
CAT(NAME,_get_elt_at_index),\
|
295 |
|
|
CAT(NAME,_generic_stat_arch_elt),\
|
296 |
|
|
CAT(NAME,_update_armap_timestamp)
|
297 |
|
|
boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
|
298 |
|
|
boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
|
299 |
|
|
boolean (*_bfd_construct_extended_name_table)
|
300 |
|
|
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
301 |
|
|
void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
|
302 |
|
|
boolean (*write_armap) PARAMS ((bfd *arch,
|
303 |
|
|
unsigned int elength,
|
304 |
|
|
struct orl *map,
|
305 |
|
|
unsigned int orl_count,
|
306 |
|
|
int stridx));
|
307 |
|
|
PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
|
308 |
|
|
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
|
309 |
|
|
#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
|
310 |
|
|
bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
|
311 |
|
|
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
|
312 |
|
|
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
|
313 |
|
|
|
314 |
|
|
/* Entry points used for symbols. */
|
315 |
|
|
#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
|
316 |
|
|
CAT(NAME,_get_symtab_upper_bound),\
|
317 |
|
|
CAT(NAME,_get_symtab),\
|
318 |
|
|
CAT(NAME,_make_empty_symbol),\
|
319 |
|
|
CAT(NAME,_print_symbol),\
|
320 |
|
|
CAT(NAME,_get_symbol_info),\
|
321 |
|
|
CAT(NAME,_bfd_is_local_label_name),\
|
322 |
|
|
CAT(NAME,_get_lineno),\
|
323 |
|
|
CAT(NAME,_find_nearest_line),\
|
324 |
|
|
CAT(NAME,_bfd_make_debug_symbol),\
|
325 |
|
|
CAT(NAME,_read_minisymbols),\
|
326 |
|
|
CAT(NAME,_minisymbol_to_symbol)
|
327 |
|
|
long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
328 |
|
|
long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
329 |
|
|
struct symbol_cache_entry **));
|
330 |
|
|
struct symbol_cache_entry *
|
331 |
|
|
(*_bfd_make_empty_symbol) PARAMS ((bfd *));
|
332 |
|
|
void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
|
333 |
|
|
struct symbol_cache_entry *,
|
334 |
|
|
bfd_print_symbol_type));
|
335 |
|
|
#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
|
336 |
|
|
void (*_bfd_get_symbol_info) PARAMS ((bfd *,
|
337 |
|
|
struct symbol_cache_entry *,
|
338 |
|
|
symbol_info *));
|
339 |
|
|
#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
|
340 |
|
|
boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
|
341 |
|
|
|
342 |
|
|
alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
|
343 |
|
|
boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
|
344 |
|
|
struct sec *section, struct symbol_cache_entry **symbols,
|
345 |
|
|
bfd_vma offset, CONST char **file, CONST char **func,
|
346 |
|
|
unsigned int *line));
|
347 |
|
|
/* Back-door to allow format-aware applications to create debug symbols
|
348 |
|
|
while using BFD for everything else. Currently used by the assembler
|
349 |
|
|
when creating COFF files. */
|
350 |
|
|
asymbol * (*_bfd_make_debug_symbol) PARAMS ((
|
351 |
|
|
bfd *abfd,
|
352 |
|
|
void *ptr,
|
353 |
|
|
unsigned long size));
|
354 |
|
|
#define bfd_read_minisymbols(b, d, m, s) \
|
355 |
|
|
BFD_SEND (b, _read_minisymbols, (b, d, m, s))
|
356 |
|
|
long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
|
357 |
|
|
unsigned int *));
|
358 |
|
|
#define bfd_minisymbol_to_symbol(b, d, m, f) \
|
359 |
|
|
BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
|
360 |
|
|
asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
|
361 |
|
|
asymbol *));
|
362 |
|
|
|
363 |
|
|
/* Routines for relocs. */
|
364 |
|
|
#define BFD_JUMP_TABLE_RELOCS(NAME)\
|
365 |
|
|
CAT(NAME,_get_reloc_upper_bound),\
|
366 |
|
|
CAT(NAME,_canonicalize_reloc),\
|
367 |
|
|
CAT(NAME,_bfd_reloc_type_lookup)
|
368 |
|
|
long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
369 |
|
|
long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
370 |
|
|
struct symbol_cache_entry **));
|
371 |
|
|
/* See documentation on reloc types. */
|
372 |
|
|
reloc_howto_type *
|
373 |
|
|
(*reloc_type_lookup) PARAMS ((bfd *abfd,
|
374 |
|
|
bfd_reloc_code_real_type code));
|
375 |
|
|
|
376 |
|
|
/* Routines used when writing an object file. */
|
377 |
|
|
#define BFD_JUMP_TABLE_WRITE(NAME)\
|
378 |
|
|
CAT(NAME,_set_arch_mach),\
|
379 |
|
|
CAT(NAME,_set_section_contents)
|
380 |
|
|
boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
|
381 |
|
|
unsigned long));
|
382 |
|
|
boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
|
383 |
|
|
file_ptr, bfd_size_type));
|
384 |
|
|
|
385 |
|
|
/* Routines used by the linker. */
|
386 |
|
|
#define BFD_JUMP_TABLE_LINK(NAME)\
|
387 |
|
|
CAT(NAME,_sizeof_headers),\
|
388 |
|
|
CAT(NAME,_bfd_get_relocated_section_contents),\
|
389 |
|
|
CAT(NAME,_bfd_relax_section),\
|
390 |
|
|
CAT(NAME,_bfd_link_hash_table_create),\
|
391 |
|
|
CAT(NAME,_bfd_link_add_symbols),\
|
392 |
|
|
CAT(NAME,_bfd_final_link),\
|
393 |
|
|
CAT(NAME,_bfd_link_split_section),\
|
394 |
|
|
CAT(NAME,_bfd_gc_sections)
|
395 |
|
|
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
|
396 |
|
|
bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
|
397 |
|
|
struct bfd_link_info *, struct bfd_link_order *,
|
398 |
|
|
bfd_byte *data, boolean relocateable,
|
399 |
|
|
struct symbol_cache_entry **));
|
400 |
|
|
|
401 |
|
|
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
|
402 |
|
|
struct bfd_link_info *, boolean *again));
|
403 |
|
|
|
404 |
|
|
/* Create a hash table for the linker. Different backends store
|
405 |
|
|
different information in this table. */
|
406 |
|
|
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
|
407 |
|
|
|
408 |
|
|
/* Add symbols from this object file into the hash table. */
|
409 |
|
|
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
|
410 |
|
|
|
411 |
|
|
/* Do a link based on the link_order structures attached to each
|
412 |
|
|
section of the BFD. */
|
413 |
|
|
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
|
414 |
|
|
|
415 |
|
|
/* Should this section be split up into smaller pieces during linking. */
|
416 |
|
|
boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
|
417 |
|
|
|
418 |
|
|
/* Remove sections that are not referenced from the output. */
|
419 |
|
|
boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
|
420 |
|
|
|
421 |
|
|
/* Routines to handle dynamic symbols and relocs. */
|
422 |
|
|
#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
|
423 |
|
|
CAT(NAME,_get_dynamic_symtab_upper_bound),\
|
424 |
|
|
CAT(NAME,_canonicalize_dynamic_symtab),\
|
425 |
|
|
CAT(NAME,_get_dynamic_reloc_upper_bound),\
|
426 |
|
|
CAT(NAME,_canonicalize_dynamic_reloc)
|
427 |
|
|
/* Get the amount of memory required to hold the dynamic symbols. */
|
428 |
|
|
long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
|
429 |
|
|
/* Read in the dynamic symbols. */
|
430 |
|
|
long (*_bfd_canonicalize_dynamic_symtab)
|
431 |
|
|
PARAMS ((bfd *, struct symbol_cache_entry **));
|
432 |
|
|
/* Get the amount of memory required to hold the dynamic relocs. */
|
433 |
|
|
long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
|
434 |
|
|
/* Read in the dynamic relocs. */
|
435 |
|
|
long (*_bfd_canonicalize_dynamic_reloc)
|
436 |
|
|
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
|
437 |
|
|
|
438 |
|
|
@end example
|
439 |
|
|
A pointer to an alternative bfd_target in case the current one is not
|
440 |
|
|
satisfactory. This can happen when the target cpu supports both big
|
441 |
|
|
and little endian code, and target chosen by the linker has the wrong
|
442 |
|
|
endianness. The function open_output() in ld/ldlang.c uses this field
|
443 |
|
|
to find an alternative output format that is suitable.
|
444 |
|
|
@example
|
445 |
|
|
/* Opposite endian version of this target. */
|
446 |
|
|
const struct bfd_target * alternative_target;
|
447 |
|
|
|
448 |
|
|
@end example
|
449 |
|
|
Data for use by back-end routines, which isn't generic enough to belong
|
450 |
|
|
in this structure.
|
451 |
|
|
@example
|
452 |
|
|
PTR backend_data;
|
453 |
|
|
|
454 |
|
|
@} bfd_target;
|
455 |
|
|
@end example
|
456 |
|
|
|
457 |
|
|
@findex bfd_set_default_target
|
458 |
|
|
@subsubsection @code{bfd_set_default_target}
|
459 |
|
|
@strong{Synopsis}
|
460 |
|
|
@example
|
461 |
|
|
boolean bfd_set_default_target (const char *name);
|
462 |
|
|
@end example
|
463 |
|
|
@strong{Description}@*
|
464 |
|
|
Set the default target vector to use when recognizing a BFD.
|
465 |
|
|
This takes the name of the target, which may be a BFD target
|
466 |
|
|
name or a configuration triplet.
|
467 |
|
|
|
468 |
|
|
@findex bfd_find_target
|
469 |
|
|
@subsubsection @code{bfd_find_target}
|
470 |
|
|
@strong{Synopsis}
|
471 |
|
|
@example
|
472 |
|
|
const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);
|
473 |
|
|
@end example
|
474 |
|
|
@strong{Description}@*
|
475 |
|
|
Return a pointer to the transfer vector for the object target
|
476 |
|
|
named @var{target_name}. If @var{target_name} is @code{NULL}, choose the
|
477 |
|
|
one in the environment variable @code{GNUTARGET}; if that is null or not
|
478 |
|
|
defined, then choose the first entry in the target list.
|
479 |
|
|
Passing in the string "default" or setting the environment
|
480 |
|
|
variable to "default" will cause the first entry in the target
|
481 |
|
|
list to be returned, and "target_defaulted" will be set in the
|
482 |
|
|
BFD. This causes @code{bfd_check_format} to loop over all the
|
483 |
|
|
targets to find the one that matches the file being read.
|
484 |
|
|
|
485 |
|
|
@findex bfd_target_list
|
486 |
|
|
@subsubsection @code{bfd_target_list}
|
487 |
|
|
@strong{Synopsis}
|
488 |
|
|
@example
|
489 |
|
|
const char **bfd_target_list(void);
|
490 |
|
|
@end example
|
491 |
|
|
@strong{Description}@*
|
492 |
|
|
Return a freshly malloced NULL-terminated
|
493 |
|
|
vector of the names of all the valid BFD targets. Do not
|
494 |
|
|
modify the names.
|
495 |
|
|
|
496 |
|
|
@findex bfd_seach_for_target
|
497 |
|
|
@subsubsection @code{bfd_seach_for_target}
|
498 |
|
|
@strong{Synopsis}
|
499 |
|
|
@example
|
500 |
|
|
const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
|
501 |
|
|
@end example
|
502 |
|
|
@strong{Description}@*
|
503 |
|
|
Return a pointer to the first transfer vector in the list of
|
504 |
|
|
transfer vectors maintained by BFD that produces a non-zero
|
505 |
|
|
result when passed to the function @var{search_func}. The
|
506 |
|
|
parameter @var{data} is passed, unexamined, to the search
|
507 |
|
|
function.
|
508 |
|
|
|