1 |
227 |
jeremybenn |
@section @code{typedef bfd}
|
2 |
|
|
A BFD has type @code{bfd}; objects of this type are the
|
3 |
|
|
cornerstone of any application using BFD. Using BFD
|
4 |
|
|
consists of making references though the BFD and to data in the BFD.
|
5 |
|
|
|
6 |
|
|
Here is the structure that defines the type @code{bfd}. It
|
7 |
|
|
contains the major data about the file and pointers
|
8 |
|
|
to the rest of the data.
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
@example
|
12 |
|
|
|
13 |
|
|
enum bfd_direction
|
14 |
|
|
@{
|
15 |
|
|
no_direction = 0,
|
16 |
|
|
read_direction = 1,
|
17 |
|
|
write_direction = 2,
|
18 |
|
|
both_direction = 3
|
19 |
|
|
@};
|
20 |
|
|
|
21 |
|
|
struct bfd
|
22 |
|
|
@{
|
23 |
|
|
/* A unique identifier of the BFD */
|
24 |
|
|
unsigned int id;
|
25 |
|
|
|
26 |
|
|
/* The filename the application opened the BFD with. */
|
27 |
|
|
const char *filename;
|
28 |
|
|
|
29 |
|
|
/* A pointer to the target jump table. */
|
30 |
|
|
const struct bfd_target *xvec;
|
31 |
|
|
|
32 |
|
|
/* The IOSTREAM, and corresponding IO vector that provide access
|
33 |
|
|
to the file backing the BFD. */
|
34 |
|
|
void *iostream;
|
35 |
|
|
const struct bfd_iovec *iovec;
|
36 |
|
|
|
37 |
|
|
/* The caching routines use these to maintain a
|
38 |
|
|
least-recently-used list of BFDs. */
|
39 |
|
|
struct bfd *lru_prev, *lru_next;
|
40 |
|
|
|
41 |
|
|
/* When a file is closed by the caching routines, BFD retains
|
42 |
|
|
state information on the file here... */
|
43 |
|
|
ufile_ptr where;
|
44 |
|
|
|
45 |
|
|
/* File modified time, if mtime_set is TRUE. */
|
46 |
|
|
long mtime;
|
47 |
|
|
|
48 |
|
|
/* Reserved for an unimplemented file locking extension. */
|
49 |
|
|
int ifd;
|
50 |
|
|
|
51 |
|
|
/* The format which belongs to the BFD. (object, core, etc.) */
|
52 |
|
|
bfd_format format;
|
53 |
|
|
|
54 |
|
|
/* The direction with which the BFD was opened. */
|
55 |
|
|
enum bfd_direction direction;
|
56 |
|
|
|
57 |
|
|
/* Format_specific flags. */
|
58 |
|
|
flagword flags;
|
59 |
|
|
|
60 |
|
|
/* Values that may appear in the flags field of a BFD. These also
|
61 |
|
|
appear in the object_flags field of the bfd_target structure, where
|
62 |
|
|
they indicate the set of flags used by that backend (not all flags
|
63 |
|
|
are meaningful for all object file formats) (FIXME: at the moment,
|
64 |
|
|
the object_flags values have mostly just been copied from backend
|
65 |
|
|
to another, and are not necessarily correct). */
|
66 |
|
|
|
67 |
|
|
#define BFD_NO_FLAGS 0x00
|
68 |
|
|
|
69 |
|
|
/* BFD contains relocation entries. */
|
70 |
|
|
#define HAS_RELOC 0x01
|
71 |
|
|
|
72 |
|
|
/* BFD is directly executable. */
|
73 |
|
|
#define EXEC_P 0x02
|
74 |
|
|
|
75 |
|
|
/* BFD has line number information (basically used for F_LNNO in a
|
76 |
|
|
COFF header). */
|
77 |
|
|
#define HAS_LINENO 0x04
|
78 |
|
|
|
79 |
|
|
/* BFD has debugging information. */
|
80 |
|
|
#define HAS_DEBUG 0x08
|
81 |
|
|
|
82 |
|
|
/* BFD has symbols. */
|
83 |
|
|
#define HAS_SYMS 0x10
|
84 |
|
|
|
85 |
|
|
/* BFD has local symbols (basically used for F_LSYMS in a COFF
|
86 |
|
|
header). */
|
87 |
|
|
#define HAS_LOCALS 0x20
|
88 |
|
|
|
89 |
|
|
/* BFD is a dynamic object. */
|
90 |
|
|
#define DYNAMIC 0x40
|
91 |
|
|
|
92 |
|
|
/* Text section is write protected (if D_PAGED is not set, this is
|
93 |
|
|
like an a.out NMAGIC file) (the linker sets this by default, but
|
94 |
|
|
clears it for -r or -N). */
|
95 |
|
|
#define WP_TEXT 0x80
|
96 |
|
|
|
97 |
|
|
/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
|
98 |
|
|
linker sets this by default, but clears it for -r or -n or -N). */
|
99 |
|
|
#define D_PAGED 0x100
|
100 |
|
|
|
101 |
|
|
/* BFD is relaxable (this means that bfd_relax_section may be able to
|
102 |
|
|
do something) (sometimes bfd_relax_section can do something even if
|
103 |
|
|
this is not set). */
|
104 |
|
|
#define BFD_IS_RELAXABLE 0x200
|
105 |
|
|
|
106 |
|
|
/* This may be set before writing out a BFD to request using a
|
107 |
|
|
traditional format. For example, this is used to request that when
|
108 |
|
|
writing out an a.out object the symbols not be hashed to eliminate
|
109 |
|
|
duplicates. */
|
110 |
|
|
#define BFD_TRADITIONAL_FORMAT 0x400
|
111 |
|
|
|
112 |
|
|
/* This flag indicates that the BFD contents are actually cached
|
113 |
|
|
in memory. If this is set, iostream points to a bfd_in_memory
|
114 |
|
|
struct. */
|
115 |
|
|
#define BFD_IN_MEMORY 0x800
|
116 |
|
|
|
117 |
|
|
/* The sections in this BFD specify a memory page. */
|
118 |
|
|
#define HAS_LOAD_PAGE 0x1000
|
119 |
|
|
|
120 |
|
|
/* This BFD has been created by the linker and doesn't correspond
|
121 |
|
|
to any input file. */
|
122 |
|
|
#define BFD_LINKER_CREATED 0x2000
|
123 |
|
|
|
124 |
|
|
/* This may be set before writing out a BFD to request that it
|
125 |
|
|
be written using values for UIDs, GIDs, timestamps, etc. that
|
126 |
|
|
will be consistent from run to run. */
|
127 |
|
|
#define BFD_DETERMINISTIC_OUTPUT 0x4000
|
128 |
|
|
|
129 |
|
|
/* Currently my_archive is tested before adding origin to
|
130 |
|
|
anything. I believe that this can become always an add of
|
131 |
|
|
origin, with origin set to 0 for non archive files. */
|
132 |
|
|
ufile_ptr origin;
|
133 |
|
|
|
134 |
|
|
/* The origin in the archive of the proxy entry. This will
|
135 |
|
|
normally be the same as origin, except for thin archives,
|
136 |
|
|
when it will contain the current offset of the proxy in the
|
137 |
|
|
thin archive rather than the offset of the bfd in its actual
|
138 |
|
|
container. */
|
139 |
|
|
ufile_ptr proxy_origin;
|
140 |
|
|
|
141 |
|
|
/* A hash table for section names. */
|
142 |
|
|
struct bfd_hash_table section_htab;
|
143 |
|
|
|
144 |
|
|
/* Pointer to linked list of sections. */
|
145 |
|
|
struct bfd_section *sections;
|
146 |
|
|
|
147 |
|
|
/* The last section on the section list. */
|
148 |
|
|
struct bfd_section *section_last;
|
149 |
|
|
|
150 |
|
|
/* The number of sections. */
|
151 |
|
|
unsigned int section_count;
|
152 |
|
|
|
153 |
|
|
/* Stuff only useful for object files:
|
154 |
|
|
The start address. */
|
155 |
|
|
bfd_vma start_address;
|
156 |
|
|
|
157 |
|
|
/* Used for input and output. */
|
158 |
|
|
unsigned int symcount;
|
159 |
|
|
|
160 |
|
|
/* Symbol table for output BFD (with symcount entries).
|
161 |
|
|
Also used by the linker to cache input BFD symbols. */
|
162 |
|
|
struct bfd_symbol **outsymbols;
|
163 |
|
|
|
164 |
|
|
/* Used for slurped dynamic symbol tables. */
|
165 |
|
|
unsigned int dynsymcount;
|
166 |
|
|
|
167 |
|
|
/* Pointer to structure which contains architecture information. */
|
168 |
|
|
const struct bfd_arch_info *arch_info;
|
169 |
|
|
|
170 |
|
|
/* Stuff only useful for archives. */
|
171 |
|
|
void *arelt_data;
|
172 |
|
|
struct bfd *my_archive; /* The containing archive BFD. */
|
173 |
|
|
struct bfd *archive_next; /* The next BFD in the archive. */
|
174 |
|
|
struct bfd *archive_head; /* The first BFD in the archive. */
|
175 |
|
|
struct bfd *nested_archives; /* List of nested archive in a flattened
|
176 |
|
|
thin archive. */
|
177 |
|
|
|
178 |
|
|
/* A chain of BFD structures involved in a link. */
|
179 |
|
|
struct bfd *link_next;
|
180 |
|
|
|
181 |
|
|
/* A field used by _bfd_generic_link_add_archive_symbols. This will
|
182 |
|
|
be used only for archive elements. */
|
183 |
|
|
int archive_pass;
|
184 |
|
|
|
185 |
|
|
/* Used by the back end to hold private data. */
|
186 |
|
|
union
|
187 |
|
|
@{
|
188 |
|
|
struct aout_data_struct *aout_data;
|
189 |
|
|
struct artdata *aout_ar_data;
|
190 |
|
|
struct _oasys_data *oasys_obj_data;
|
191 |
|
|
struct _oasys_ar_data *oasys_ar_data;
|
192 |
|
|
struct coff_tdata *coff_obj_data;
|
193 |
|
|
struct pe_tdata *pe_obj_data;
|
194 |
|
|
struct xcoff_tdata *xcoff_obj_data;
|
195 |
|
|
struct ecoff_tdata *ecoff_obj_data;
|
196 |
|
|
struct ieee_data_struct *ieee_data;
|
197 |
|
|
struct ieee_ar_data_struct *ieee_ar_data;
|
198 |
|
|
struct srec_data_struct *srec_data;
|
199 |
|
|
struct verilog_data_struct *verilog_data;
|
200 |
|
|
struct ihex_data_struct *ihex_data;
|
201 |
|
|
struct tekhex_data_struct *tekhex_data;
|
202 |
|
|
struct elf_obj_tdata *elf_obj_data;
|
203 |
|
|
struct nlm_obj_tdata *nlm_obj_data;
|
204 |
|
|
struct bout_data_struct *bout_data;
|
205 |
|
|
struct mmo_data_struct *mmo_data;
|
206 |
|
|
struct sun_core_struct *sun_core_data;
|
207 |
|
|
struct sco5_core_struct *sco5_core_data;
|
208 |
|
|
struct trad_core_struct *trad_core_data;
|
209 |
|
|
struct som_data_struct *som_data;
|
210 |
|
|
struct hpux_core_struct *hpux_core_data;
|
211 |
|
|
struct hppabsd_core_struct *hppabsd_core_data;
|
212 |
|
|
struct sgi_core_struct *sgi_core_data;
|
213 |
|
|
struct lynx_core_struct *lynx_core_data;
|
214 |
|
|
struct osf_core_struct *osf_core_data;
|
215 |
|
|
struct cisco_core_struct *cisco_core_data;
|
216 |
|
|
struct versados_data_struct *versados_data;
|
217 |
|
|
struct netbsd_core_struct *netbsd_core_data;
|
218 |
|
|
struct mach_o_data_struct *mach_o_data;
|
219 |
|
|
struct mach_o_fat_data_struct *mach_o_fat_data;
|
220 |
|
|
struct plugin_data_struct *plugin_data;
|
221 |
|
|
struct bfd_pef_data_struct *pef_data;
|
222 |
|
|
struct bfd_pef_xlib_data_struct *pef_xlib_data;
|
223 |
|
|
struct bfd_sym_data_struct *sym_data;
|
224 |
|
|
void *any;
|
225 |
|
|
@}
|
226 |
|
|
tdata;
|
227 |
|
|
|
228 |
|
|
/* Used by the application to hold private data. */
|
229 |
|
|
void *usrdata;
|
230 |
|
|
|
231 |
|
|
/* Where all the allocated stuff under this BFD goes. This is a
|
232 |
|
|
struct objalloc *, but we use void * to avoid requiring the inclusion
|
233 |
|
|
of objalloc.h. */
|
234 |
|
|
void *memory;
|
235 |
|
|
|
236 |
|
|
/* Is the file descriptor being cached? That is, can it be closed as
|
237 |
|
|
needed, and re-opened when accessed later? */
|
238 |
|
|
unsigned int cacheable : 1;
|
239 |
|
|
|
240 |
|
|
/* Marks whether there was a default target specified when the
|
241 |
|
|
BFD was opened. This is used to select which matching algorithm
|
242 |
|
|
to use to choose the back end. */
|
243 |
|
|
unsigned int target_defaulted : 1;
|
244 |
|
|
|
245 |
|
|
/* ... and here: (``once'' means at least once). */
|
246 |
|
|
unsigned int opened_once : 1;
|
247 |
|
|
|
248 |
|
|
/* Set if we have a locally maintained mtime value, rather than
|
249 |
|
|
getting it from the file each time. */
|
250 |
|
|
unsigned int mtime_set : 1;
|
251 |
|
|
|
252 |
|
|
/* Flag set if symbols from this BFD should not be exported. */
|
253 |
|
|
unsigned int no_export : 1;
|
254 |
|
|
|
255 |
|
|
/* Remember when output has begun, to stop strange things
|
256 |
|
|
from happening. */
|
257 |
|
|
unsigned int output_has_begun : 1;
|
258 |
|
|
|
259 |
|
|
/* Have archive map. */
|
260 |
|
|
unsigned int has_armap : 1;
|
261 |
|
|
|
262 |
|
|
/* Set if this is a thin archive. */
|
263 |
|
|
unsigned int is_thin_archive : 1;
|
264 |
|
|
@};
|
265 |
|
|
|
266 |
|
|
@end example
|
267 |
|
|
@section Error reporting
|
268 |
|
|
Most BFD functions return nonzero on success (check their
|
269 |
|
|
individual documentation for precise semantics). On an error,
|
270 |
|
|
they call @code{bfd_set_error} to set an error condition that callers
|
271 |
|
|
can check by calling @code{bfd_get_error}.
|
272 |
|
|
If that returns @code{bfd_error_system_call}, then check
|
273 |
|
|
@code{errno}.
|
274 |
|
|
|
275 |
|
|
The easiest way to report a BFD error to the user is to
|
276 |
|
|
use @code{bfd_perror}.
|
277 |
|
|
|
278 |
|
|
@subsection Type @code{bfd_error_type}
|
279 |
|
|
The values returned by @code{bfd_get_error} are defined by the
|
280 |
|
|
enumerated type @code{bfd_error_type}.
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
@example
|
284 |
|
|
|
285 |
|
|
typedef enum bfd_error
|
286 |
|
|
@{
|
287 |
|
|
bfd_error_no_error = 0,
|
288 |
|
|
bfd_error_system_call,
|
289 |
|
|
bfd_error_invalid_target,
|
290 |
|
|
bfd_error_wrong_format,
|
291 |
|
|
bfd_error_wrong_object_format,
|
292 |
|
|
bfd_error_invalid_operation,
|
293 |
|
|
bfd_error_no_memory,
|
294 |
|
|
bfd_error_no_symbols,
|
295 |
|
|
bfd_error_no_armap,
|
296 |
|
|
bfd_error_no_more_archived_files,
|
297 |
|
|
bfd_error_malformed_archive,
|
298 |
|
|
bfd_error_file_not_recognized,
|
299 |
|
|
bfd_error_file_ambiguously_recognized,
|
300 |
|
|
bfd_error_no_contents,
|
301 |
|
|
bfd_error_nonrepresentable_section,
|
302 |
|
|
bfd_error_no_debug_section,
|
303 |
|
|
bfd_error_bad_value,
|
304 |
|
|
bfd_error_file_truncated,
|
305 |
|
|
bfd_error_file_too_big,
|
306 |
|
|
bfd_error_on_input,
|
307 |
|
|
bfd_error_invalid_error_code
|
308 |
|
|
@}
|
309 |
|
|
bfd_error_type;
|
310 |
|
|
|
311 |
|
|
@end example
|
312 |
|
|
@findex bfd_get_error
|
313 |
|
|
@subsubsection @code{bfd_get_error}
|
314 |
|
|
@strong{Synopsis}
|
315 |
|
|
@example
|
316 |
|
|
bfd_error_type bfd_get_error (void);
|
317 |
|
|
@end example
|
318 |
|
|
@strong{Description}@*
|
319 |
|
|
Return the current BFD error condition.
|
320 |
|
|
|
321 |
|
|
@findex bfd_set_error
|
322 |
|
|
@subsubsection @code{bfd_set_error}
|
323 |
|
|
@strong{Synopsis}
|
324 |
|
|
@example
|
325 |
|
|
void bfd_set_error (bfd_error_type error_tag, ...);
|
326 |
|
|
@end example
|
327 |
|
|
@strong{Description}@*
|
328 |
|
|
Set the BFD error condition to be @var{error_tag}.
|
329 |
|
|
If @var{error_tag} is bfd_error_on_input, then this function
|
330 |
|
|
takes two more parameters, the input bfd where the error
|
331 |
|
|
occurred, and the bfd_error_type error.
|
332 |
|
|
|
333 |
|
|
@findex bfd_errmsg
|
334 |
|
|
@subsubsection @code{bfd_errmsg}
|
335 |
|
|
@strong{Synopsis}
|
336 |
|
|
@example
|
337 |
|
|
const char *bfd_errmsg (bfd_error_type error_tag);
|
338 |
|
|
@end example
|
339 |
|
|
@strong{Description}@*
|
340 |
|
|
Return a string describing the error @var{error_tag}, or
|
341 |
|
|
the system error if @var{error_tag} is @code{bfd_error_system_call}.
|
342 |
|
|
|
343 |
|
|
@findex bfd_perror
|
344 |
|
|
@subsubsection @code{bfd_perror}
|
345 |
|
|
@strong{Synopsis}
|
346 |
|
|
@example
|
347 |
|
|
void bfd_perror (const char *message);
|
348 |
|
|
@end example
|
349 |
|
|
@strong{Description}@*
|
350 |
|
|
Print to the standard error stream a string describing the
|
351 |
|
|
last BFD error that occurred, or the last system error if
|
352 |
|
|
the last BFD error was a system call failure. If @var{message}
|
353 |
|
|
is non-NULL and non-empty, the error string printed is preceded
|
354 |
|
|
by @var{message}, a colon, and a space. It is followed by a newline.
|
355 |
|
|
|
356 |
|
|
@subsection BFD error handler
|
357 |
|
|
Some BFD functions want to print messages describing the
|
358 |
|
|
problem. They call a BFD error handler function. This
|
359 |
|
|
function may be overridden by the program.
|
360 |
|
|
|
361 |
|
|
The BFD error handler acts like printf.
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
@example
|
365 |
|
|
|
366 |
|
|
typedef void (*bfd_error_handler_type) (const char *, ...);
|
367 |
|
|
|
368 |
|
|
@end example
|
369 |
|
|
@findex bfd_set_error_handler
|
370 |
|
|
@subsubsection @code{bfd_set_error_handler}
|
371 |
|
|
@strong{Synopsis}
|
372 |
|
|
@example
|
373 |
|
|
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
|
374 |
|
|
@end example
|
375 |
|
|
@strong{Description}@*
|
376 |
|
|
Set the BFD error handler function. Returns the previous
|
377 |
|
|
function.
|
378 |
|
|
|
379 |
|
|
@findex bfd_set_error_program_name
|
380 |
|
|
@subsubsection @code{bfd_set_error_program_name}
|
381 |
|
|
@strong{Synopsis}
|
382 |
|
|
@example
|
383 |
|
|
void bfd_set_error_program_name (const char *);
|
384 |
|
|
@end example
|
385 |
|
|
@strong{Description}@*
|
386 |
|
|
Set the program name to use when printing a BFD error. This
|
387 |
|
|
is printed before the error message followed by a colon and
|
388 |
|
|
space. The string must not be changed after it is passed to
|
389 |
|
|
this function.
|
390 |
|
|
|
391 |
|
|
@findex bfd_get_error_handler
|
392 |
|
|
@subsubsection @code{bfd_get_error_handler}
|
393 |
|
|
@strong{Synopsis}
|
394 |
|
|
@example
|
395 |
|
|
bfd_error_handler_type bfd_get_error_handler (void);
|
396 |
|
|
@end example
|
397 |
|
|
@strong{Description}@*
|
398 |
|
|
Return the BFD error handler function.
|
399 |
|
|
|
400 |
|
|
@section Miscellaneous
|
401 |
|
|
|
402 |
|
|
|
403 |
|
|
@subsection Miscellaneous functions
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
@findex bfd_get_reloc_upper_bound
|
407 |
|
|
@subsubsection @code{bfd_get_reloc_upper_bound}
|
408 |
|
|
@strong{Synopsis}
|
409 |
|
|
@example
|
410 |
|
|
long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
|
411 |
|
|
@end example
|
412 |
|
|
@strong{Description}@*
|
413 |
|
|
Return the number of bytes required to store the
|
414 |
|
|
relocation information associated with section @var{sect}
|
415 |
|
|
attached to bfd @var{abfd}. If an error occurs, return -1.
|
416 |
|
|
|
417 |
|
|
@findex bfd_canonicalize_reloc
|
418 |
|
|
@subsubsection @code{bfd_canonicalize_reloc}
|
419 |
|
|
@strong{Synopsis}
|
420 |
|
|
@example
|
421 |
|
|
long bfd_canonicalize_reloc
|
422 |
|
|
(bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
|
423 |
|
|
@end example
|
424 |
|
|
@strong{Description}@*
|
425 |
|
|
Call the back end associated with the open BFD
|
426 |
|
|
@var{abfd} and translate the external form of the relocation
|
427 |
|
|
information attached to @var{sec} into the internal canonical
|
428 |
|
|
form. Place the table into memory at @var{loc}, which has
|
429 |
|
|
been preallocated, usually by a call to
|
430 |
|
|
@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
|
431 |
|
|
-1 on error.
|
432 |
|
|
|
433 |
|
|
The @var{syms} table is also needed for horrible internal magic
|
434 |
|
|
reasons.
|
435 |
|
|
|
436 |
|
|
@findex bfd_set_reloc
|
437 |
|
|
@subsubsection @code{bfd_set_reloc}
|
438 |
|
|
@strong{Synopsis}
|
439 |
|
|
@example
|
440 |
|
|
void bfd_set_reloc
|
441 |
|
|
(bfd *abfd, asection *sec, arelent **rel, unsigned int count);
|
442 |
|
|
@end example
|
443 |
|
|
@strong{Description}@*
|
444 |
|
|
Set the relocation pointer and count within
|
445 |
|
|
section @var{sec} to the values @var{rel} and @var{count}.
|
446 |
|
|
The argument @var{abfd} is ignored.
|
447 |
|
|
|
448 |
|
|
@findex bfd_set_file_flags
|
449 |
|
|
@subsubsection @code{bfd_set_file_flags}
|
450 |
|
|
@strong{Synopsis}
|
451 |
|
|
@example
|
452 |
|
|
bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
|
453 |
|
|
@end example
|
454 |
|
|
@strong{Description}@*
|
455 |
|
|
Set the flag word in the BFD @var{abfd} to the value @var{flags}.
|
456 |
|
|
|
457 |
|
|
Possible errors are:
|
458 |
|
|
@itemize @bullet
|
459 |
|
|
|
460 |
|
|
@item
|
461 |
|
|
@code{bfd_error_wrong_format} - The target bfd was not of object format.
|
462 |
|
|
@item
|
463 |
|
|
@code{bfd_error_invalid_operation} - The target bfd was open for reading.
|
464 |
|
|
@item
|
465 |
|
|
@code{bfd_error_invalid_operation} -
|
466 |
|
|
The flag word contained a bit which was not applicable to the
|
467 |
|
|
type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
|
468 |
|
|
on a BFD format which does not support demand paging.
|
469 |
|
|
@end itemize
|
470 |
|
|
|
471 |
|
|
@findex bfd_get_arch_size
|
472 |
|
|
@subsubsection @code{bfd_get_arch_size}
|
473 |
|
|
@strong{Synopsis}
|
474 |
|
|
@example
|
475 |
|
|
int bfd_get_arch_size (bfd *abfd);
|
476 |
|
|
@end example
|
477 |
|
|
@strong{Description}@*
|
478 |
|
|
Returns the architecture address size, in bits, as determined
|
479 |
|
|
by the object file's format. For ELF, this information is
|
480 |
|
|
included in the header.
|
481 |
|
|
|
482 |
|
|
@strong{Returns}@*
|
483 |
|
|
Returns the arch size in bits if known, @code{-1} otherwise.
|
484 |
|
|
|
485 |
|
|
@findex bfd_get_sign_extend_vma
|
486 |
|
|
@subsubsection @code{bfd_get_sign_extend_vma}
|
487 |
|
|
@strong{Synopsis}
|
488 |
|
|
@example
|
489 |
|
|
int bfd_get_sign_extend_vma (bfd *abfd);
|
490 |
|
|
@end example
|
491 |
|
|
@strong{Description}@*
|
492 |
|
|
Indicates if the target architecture "naturally" sign extends
|
493 |
|
|
an address. Some architectures implicitly sign extend address
|
494 |
|
|
values when they are converted to types larger than the size
|
495 |
|
|
of an address. For instance, bfd_get_start_address() will
|
496 |
|
|
return an address sign extended to fill a bfd_vma when this is
|
497 |
|
|
the case.
|
498 |
|
|
|
499 |
|
|
@strong{Returns}@*
|
500 |
|
|
Returns @code{1} if the target architecture is known to sign
|
501 |
|
|
extend addresses, @code{0} if the target architecture is known to
|
502 |
|
|
not sign extend addresses, and @code{-1} otherwise.
|
503 |
|
|
|
504 |
|
|
@findex bfd_set_start_address
|
505 |
|
|
@subsubsection @code{bfd_set_start_address}
|
506 |
|
|
@strong{Synopsis}
|
507 |
|
|
@example
|
508 |
|
|
bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
|
509 |
|
|
@end example
|
510 |
|
|
@strong{Description}@*
|
511 |
|
|
Make @var{vma} the entry point of output BFD @var{abfd}.
|
512 |
|
|
|
513 |
|
|
@strong{Returns}@*
|
514 |
|
|
Returns @code{TRUE} on success, @code{FALSE} otherwise.
|
515 |
|
|
|
516 |
|
|
@findex bfd_get_gp_size
|
517 |
|
|
@subsubsection @code{bfd_get_gp_size}
|
518 |
|
|
@strong{Synopsis}
|
519 |
|
|
@example
|
520 |
|
|
unsigned int bfd_get_gp_size (bfd *abfd);
|
521 |
|
|
@end example
|
522 |
|
|
@strong{Description}@*
|
523 |
|
|
Return the maximum size of objects to be optimized using the GP
|
524 |
|
|
register under MIPS ECOFF. This is typically set by the @code{-G}
|
525 |
|
|
argument to the compiler, assembler or linker.
|
526 |
|
|
|
527 |
|
|
@findex bfd_set_gp_size
|
528 |
|
|
@subsubsection @code{bfd_set_gp_size}
|
529 |
|
|
@strong{Synopsis}
|
530 |
|
|
@example
|
531 |
|
|
void bfd_set_gp_size (bfd *abfd, unsigned int i);
|
532 |
|
|
@end example
|
533 |
|
|
@strong{Description}@*
|
534 |
|
|
Set the maximum size of objects to be optimized using the GP
|
535 |
|
|
register under ECOFF or MIPS ELF. This is typically set by
|
536 |
|
|
the @code{-G} argument to the compiler, assembler or linker.
|
537 |
|
|
|
538 |
|
|
@findex bfd_scan_vma
|
539 |
|
|
@subsubsection @code{bfd_scan_vma}
|
540 |
|
|
@strong{Synopsis}
|
541 |
|
|
@example
|
542 |
|
|
bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
|
543 |
|
|
@end example
|
544 |
|
|
@strong{Description}@*
|
545 |
|
|
Convert, like @code{strtoul}, a numerical expression
|
546 |
|
|
@var{string} into a @code{bfd_vma} integer, and return that integer.
|
547 |
|
|
(Though without as many bells and whistles as @code{strtoul}.)
|
548 |
|
|
The expression is assumed to be unsigned (i.e., positive).
|
549 |
|
|
If given a @var{base}, it is used as the base for conversion.
|
550 |
|
|
A base of 0 causes the function to interpret the string
|
551 |
|
|
in hex if a leading "0x" or "0X" is found, otherwise
|
552 |
|
|
in octal if a leading zero is found, otherwise in decimal.
|
553 |
|
|
|
554 |
|
|
If the value would overflow, the maximum @code{bfd_vma} value is
|
555 |
|
|
returned.
|
556 |
|
|
|
557 |
|
|
@findex bfd_copy_private_header_data
|
558 |
|
|
@subsubsection @code{bfd_copy_private_header_data}
|
559 |
|
|
@strong{Synopsis}
|
560 |
|
|
@example
|
561 |
|
|
bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
|
562 |
|
|
@end example
|
563 |
|
|
@strong{Description}@*
|
564 |
|
|
Copy private BFD header information from the BFD @var{ibfd} to the
|
565 |
|
|
the BFD @var{obfd}. This copies information that may require
|
566 |
|
|
sections to exist, but does not require symbol tables. Return
|
567 |
|
|
@code{true} on success, @code{false} on error.
|
568 |
|
|
Possible error returns are:
|
569 |
|
|
|
570 |
|
|
@itemize @bullet
|
571 |
|
|
|
572 |
|
|
@item
|
573 |
|
|
@code{bfd_error_no_memory} -
|
574 |
|
|
Not enough memory exists to create private data for @var{obfd}.
|
575 |
|
|
@end itemize
|
576 |
|
|
@example
|
577 |
|
|
#define bfd_copy_private_header_data(ibfd, obfd) \
|
578 |
|
|
BFD_SEND (obfd, _bfd_copy_private_header_data, \
|
579 |
|
|
(ibfd, obfd))
|
580 |
|
|
@end example
|
581 |
|
|
|
582 |
|
|
@findex bfd_copy_private_bfd_data
|
583 |
|
|
@subsubsection @code{bfd_copy_private_bfd_data}
|
584 |
|
|
@strong{Synopsis}
|
585 |
|
|
@example
|
586 |
|
|
bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
|
587 |
|
|
@end example
|
588 |
|
|
@strong{Description}@*
|
589 |
|
|
Copy private BFD information from the BFD @var{ibfd} to the
|
590 |
|
|
the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error.
|
591 |
|
|
Possible error returns are:
|
592 |
|
|
|
593 |
|
|
@itemize @bullet
|
594 |
|
|
|
595 |
|
|
@item
|
596 |
|
|
@code{bfd_error_no_memory} -
|
597 |
|
|
Not enough memory exists to create private data for @var{obfd}.
|
598 |
|
|
@end itemize
|
599 |
|
|
@example
|
600 |
|
|
#define bfd_copy_private_bfd_data(ibfd, obfd) \
|
601 |
|
|
BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
|
602 |
|
|
(ibfd, obfd))
|
603 |
|
|
@end example
|
604 |
|
|
|
605 |
|
|
@findex bfd_merge_private_bfd_data
|
606 |
|
|
@subsubsection @code{bfd_merge_private_bfd_data}
|
607 |
|
|
@strong{Synopsis}
|
608 |
|
|
@example
|
609 |
|
|
bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
|
610 |
|
|
@end example
|
611 |
|
|
@strong{Description}@*
|
612 |
|
|
Merge private BFD information from the BFD @var{ibfd} to the
|
613 |
|
|
the output file BFD @var{obfd} when linking. Return @code{TRUE}
|
614 |
|
|
on success, @code{FALSE} on error. Possible error returns are:
|
615 |
|
|
|
616 |
|
|
@itemize @bullet
|
617 |
|
|
|
618 |
|
|
@item
|
619 |
|
|
@code{bfd_error_no_memory} -
|
620 |
|
|
Not enough memory exists to create private data for @var{obfd}.
|
621 |
|
|
@end itemize
|
622 |
|
|
@example
|
623 |
|
|
#define bfd_merge_private_bfd_data(ibfd, obfd) \
|
624 |
|
|
BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
|
625 |
|
|
(ibfd, obfd))
|
626 |
|
|
@end example
|
627 |
|
|
|
628 |
|
|
@findex bfd_set_private_flags
|
629 |
|
|
@subsubsection @code{bfd_set_private_flags}
|
630 |
|
|
@strong{Synopsis}
|
631 |
|
|
@example
|
632 |
|
|
bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
|
633 |
|
|
@end example
|
634 |
|
|
@strong{Description}@*
|
635 |
|
|
Set private BFD flag information in the BFD @var{abfd}.
|
636 |
|
|
Return @code{TRUE} on success, @code{FALSE} on error. Possible error
|
637 |
|
|
returns are:
|
638 |
|
|
|
639 |
|
|
@itemize @bullet
|
640 |
|
|
|
641 |
|
|
@item
|
642 |
|
|
@code{bfd_error_no_memory} -
|
643 |
|
|
Not enough memory exists to create private data for @var{obfd}.
|
644 |
|
|
@end itemize
|
645 |
|
|
@example
|
646 |
|
|
#define bfd_set_private_flags(abfd, flags) \
|
647 |
|
|
BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
|
648 |
|
|
@end example
|
649 |
|
|
|
650 |
|
|
@findex Other functions
|
651 |
|
|
@subsubsection @code{Other functions}
|
652 |
|
|
@strong{Description}@*
|
653 |
|
|
The following functions exist but have not yet been documented.
|
654 |
|
|
@example
|
655 |
|
|
#define bfd_sizeof_headers(abfd, info) \
|
656 |
|
|
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
|
657 |
|
|
|
658 |
|
|
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
|
659 |
|
|
BFD_SEND (abfd, _bfd_find_nearest_line, \
|
660 |
|
|
(abfd, sec, syms, off, file, func, line))
|
661 |
|
|
|
662 |
|
|
#define bfd_find_line(abfd, syms, sym, file, line) \
|
663 |
|
|
BFD_SEND (abfd, _bfd_find_line, \
|
664 |
|
|
(abfd, syms, sym, file, line))
|
665 |
|
|
|
666 |
|
|
#define bfd_find_inliner_info(abfd, file, func, line) \
|
667 |
|
|
BFD_SEND (abfd, _bfd_find_inliner_info, \
|
668 |
|
|
(abfd, file, func, line))
|
669 |
|
|
|
670 |
|
|
#define bfd_debug_info_start(abfd) \
|
671 |
|
|
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
|
672 |
|
|
|
673 |
|
|
#define bfd_debug_info_end(abfd) \
|
674 |
|
|
BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
|
675 |
|
|
|
676 |
|
|
#define bfd_debug_info_accumulate(abfd, section) \
|
677 |
|
|
BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
|
678 |
|
|
|
679 |
|
|
#define bfd_stat_arch_elt(abfd, stat) \
|
680 |
|
|
BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
|
681 |
|
|
|
682 |
|
|
#define bfd_update_armap_timestamp(abfd) \
|
683 |
|
|
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
|
684 |
|
|
|
685 |
|
|
#define bfd_set_arch_mach(abfd, arch, mach)\
|
686 |
|
|
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
|
687 |
|
|
|
688 |
|
|
#define bfd_relax_section(abfd, section, link_info, again) \
|
689 |
|
|
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
690 |
|
|
|
691 |
|
|
#define bfd_gc_sections(abfd, link_info) \
|
692 |
|
|
BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
|
693 |
|
|
|
694 |
|
|
#define bfd_merge_sections(abfd, link_info) \
|
695 |
|
|
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
|
696 |
|
|
|
697 |
|
|
#define bfd_is_group_section(abfd, sec) \
|
698 |
|
|
BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
|
699 |
|
|
|
700 |
|
|
#define bfd_discard_group(abfd, sec) \
|
701 |
|
|
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
|
702 |
|
|
|
703 |
|
|
#define bfd_link_hash_table_create(abfd) \
|
704 |
|
|
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
705 |
|
|
|
706 |
|
|
#define bfd_link_hash_table_free(abfd, hash) \
|
707 |
|
|
BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
|
708 |
|
|
|
709 |
|
|
#define bfd_link_add_symbols(abfd, info) \
|
710 |
|
|
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
|
711 |
|
|
|
712 |
|
|
#define bfd_link_just_syms(abfd, sec, info) \
|
713 |
|
|
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
|
714 |
|
|
|
715 |
|
|
#define bfd_final_link(abfd, info) \
|
716 |
|
|
BFD_SEND (abfd, _bfd_final_link, (abfd, info))
|
717 |
|
|
|
718 |
|
|
#define bfd_free_cached_info(abfd) \
|
719 |
|
|
BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
|
720 |
|
|
|
721 |
|
|
#define bfd_get_dynamic_symtab_upper_bound(abfd) \
|
722 |
|
|
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
|
723 |
|
|
|
724 |
|
|
#define bfd_print_private_bfd_data(abfd, file)\
|
725 |
|
|
BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
|
726 |
|
|
|
727 |
|
|
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
|
728 |
|
|
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
|
729 |
|
|
|
730 |
|
|
#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
|
731 |
|
|
BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
|
732 |
|
|
dyncount, dynsyms, ret))
|
733 |
|
|
|
734 |
|
|
#define bfd_get_dynamic_reloc_upper_bound(abfd) \
|
735 |
|
|
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
|
736 |
|
|
|
737 |
|
|
#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
|
738 |
|
|
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
|
739 |
|
|
|
740 |
|
|
extern bfd_byte *bfd_get_relocated_section_contents
|
741 |
|
|
(bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
|
742 |
|
|
bfd_boolean, asymbol **);
|
743 |
|
|
|
744 |
|
|
@end example
|
745 |
|
|
|
746 |
|
|
@findex bfd_alt_mach_code
|
747 |
|
|
@subsubsection @code{bfd_alt_mach_code}
|
748 |
|
|
@strong{Synopsis}
|
749 |
|
|
@example
|
750 |
|
|
bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
|
751 |
|
|
@end example
|
752 |
|
|
@strong{Description}@*
|
753 |
|
|
When more than one machine code number is available for the
|
754 |
|
|
same machine type, this function can be used to switch between
|
755 |
|
|
the preferred one (alternative == 0) and any others. Currently,
|
756 |
|
|
only ELF supports this feature, with up to two alternate
|
757 |
|
|
machine codes.
|
758 |
|
|
|
759 |
|
|
|
760 |
|
|
@example
|
761 |
|
|
struct bfd_preserve
|
762 |
|
|
@{
|
763 |
|
|
void *marker;
|
764 |
|
|
void *tdata;
|
765 |
|
|
flagword flags;
|
766 |
|
|
const struct bfd_arch_info *arch_info;
|
767 |
|
|
struct bfd_section *sections;
|
768 |
|
|
struct bfd_section *section_last;
|
769 |
|
|
unsigned int section_count;
|
770 |
|
|
struct bfd_hash_table section_htab;
|
771 |
|
|
@};
|
772 |
|
|
|
773 |
|
|
@end example
|
774 |
|
|
@findex bfd_preserve_save
|
775 |
|
|
@subsubsection @code{bfd_preserve_save}
|
776 |
|
|
@strong{Synopsis}
|
777 |
|
|
@example
|
778 |
|
|
bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
|
779 |
|
|
@end example
|
780 |
|
|
@strong{Description}@*
|
781 |
|
|
When testing an object for compatibility with a particular
|
782 |
|
|
target back-end, the back-end object_p function needs to set
|
783 |
|
|
up certain fields in the bfd on successfully recognizing the
|
784 |
|
|
object. This typically happens in a piecemeal fashion, with
|
785 |
|
|
failures possible at many points. On failure, the bfd is
|
786 |
|
|
supposed to be restored to its initial state, which is
|
787 |
|
|
virtually impossible. However, restoring a subset of the bfd
|
788 |
|
|
state works in practice. This function stores the subset and
|
789 |
|
|
reinitializes the bfd.
|
790 |
|
|
|
791 |
|
|
@findex bfd_preserve_restore
|
792 |
|
|
@subsubsection @code{bfd_preserve_restore}
|
793 |
|
|
@strong{Synopsis}
|
794 |
|
|
@example
|
795 |
|
|
void bfd_preserve_restore (bfd *, struct bfd_preserve *);
|
796 |
|
|
@end example
|
797 |
|
|
@strong{Description}@*
|
798 |
|
|
This function restores bfd state saved by bfd_preserve_save.
|
799 |
|
|
If MARKER is non-NULL in struct bfd_preserve then that block
|
800 |
|
|
and all subsequently bfd_alloc'd memory is freed.
|
801 |
|
|
|
802 |
|
|
@findex bfd_preserve_finish
|
803 |
|
|
@subsubsection @code{bfd_preserve_finish}
|
804 |
|
|
@strong{Synopsis}
|
805 |
|
|
@example
|
806 |
|
|
void bfd_preserve_finish (bfd *, struct bfd_preserve *);
|
807 |
|
|
@end example
|
808 |
|
|
@strong{Description}@*
|
809 |
|
|
This function should be called when the bfd state saved by
|
810 |
|
|
bfd_preserve_save is no longer needed. ie. when the back-end
|
811 |
|
|
object_p function returns with success.
|
812 |
|
|
|
813 |
|
|
@findex bfd_emul_get_maxpagesize
|
814 |
|
|
@subsubsection @code{bfd_emul_get_maxpagesize}
|
815 |
|
|
@strong{Synopsis}
|
816 |
|
|
@example
|
817 |
|
|
bfd_vma bfd_emul_get_maxpagesize (const char *);
|
818 |
|
|
@end example
|
819 |
|
|
@strong{Description}@*
|
820 |
|
|
Returns the maximum page size, in bytes, as determined by
|
821 |
|
|
emulation.
|
822 |
|
|
|
823 |
|
|
@strong{Returns}@*
|
824 |
|
|
Returns the maximum page size in bytes for ELF, 0 otherwise.
|
825 |
|
|
|
826 |
|
|
@findex bfd_emul_set_maxpagesize
|
827 |
|
|
@subsubsection @code{bfd_emul_set_maxpagesize}
|
828 |
|
|
@strong{Synopsis}
|
829 |
|
|
@example
|
830 |
|
|
void bfd_emul_set_maxpagesize (const char *, bfd_vma);
|
831 |
|
|
@end example
|
832 |
|
|
@strong{Description}@*
|
833 |
|
|
For ELF, set the maximum page size for the emulation. It is
|
834 |
|
|
a no-op for other formats.
|
835 |
|
|
|
836 |
|
|
@findex bfd_emul_get_commonpagesize
|
837 |
|
|
@subsubsection @code{bfd_emul_get_commonpagesize}
|
838 |
|
|
@strong{Synopsis}
|
839 |
|
|
@example
|
840 |
|
|
bfd_vma bfd_emul_get_commonpagesize (const char *);
|
841 |
|
|
@end example
|
842 |
|
|
@strong{Description}@*
|
843 |
|
|
Returns the common page size, in bytes, as determined by
|
844 |
|
|
emulation.
|
845 |
|
|
|
846 |
|
|
@strong{Returns}@*
|
847 |
|
|
Returns the common page size in bytes for ELF, 0 otherwise.
|
848 |
|
|
|
849 |
|
|
@findex bfd_emul_set_commonpagesize
|
850 |
|
|
@subsubsection @code{bfd_emul_set_commonpagesize}
|
851 |
|
|
@strong{Synopsis}
|
852 |
|
|
@example
|
853 |
|
|
void bfd_emul_set_commonpagesize (const char *, bfd_vma);
|
854 |
|
|
@end example
|
855 |
|
|
@strong{Description}@*
|
856 |
|
|
For ELF, set the common page size for the emulation. It is
|
857 |
|
|
a no-op for other formats.
|
858 |
|
|
|
859 |
|
|
@findex bfd_demangle
|
860 |
|
|
@subsubsection @code{bfd_demangle}
|
861 |
|
|
@strong{Synopsis}
|
862 |
|
|
@example
|
863 |
|
|
char *bfd_demangle (bfd *, const char *, int);
|
864 |
|
|
@end example
|
865 |
|
|
@strong{Description}@*
|
866 |
|
|
Wrapper around cplus_demangle. Strips leading underscores and
|
867 |
|
|
other such chars that would otherwise confuse the demangler.
|
868 |
|
|
If passed a g++ v3 ABI mangled name, returns a buffer allocated
|
869 |
|
|
with malloc holding the demangled name. Returns NULL otherwise
|
870 |
|
|
and on memory alloc failure.
|
871 |
|
|
|