| 1 |
@node typedef bfd, Error reporting, BFD front end, BFD front end |
| 2 |
@section @code{typedef bfd} |
| 3 |
A BFD has type @code{bfd}; objects of this type are the |
| 4 |
cornerstone of any application using BFD. Using BFD |
| 5 |
consists of making references though the BFD and to data in the BFD. |
| 6 |
|
| 7 |
Here is the structure that defines the type @code{bfd}. It |
| 8 |
contains the major data about the file and pointers |
| 9 |
to the rest of the data. |
| 10 |
|
| 11 |
|
| 12 |
@example |
| 13 |
|
| 14 |
enum bfd_direction |
| 15 |
@{ |
| 16 |
no_direction = 0, |
| 17 |
read_direction = 1, |
| 18 |
write_direction = 2, |
| 19 |
both_direction = 3 |
| 20 |
@}; |
| 21 |
|
| 22 |
enum bfd_plugin_format |
| 23 |
@{ |
| 24 |
bfd_plugin_unknown = 0, |
| 25 |
bfd_plugin_yes = 1, |
| 26 |
bfd_plugin_no = 2 |
| 27 |
@}; |
| 28 |
|
| 29 |
struct bfd_build_id |
| 30 |
@{ |
| 31 |
bfd_size_type size; |
| 32 |
bfd_byte data[1]; |
| 33 |
@}; |
| 34 |
|
| 35 |
struct bfd |
| 36 |
@{ |
| 37 |
/* The filename the application opened the BFD with. */ |
| 38 |
const char *filename; |
| 39 |
|
| 40 |
/* A pointer to the target jump table. */ |
| 41 |
const struct bfd_target *xvec; |
| 42 |
|
| 43 |
/* The IOSTREAM, and corresponding IO vector that provide access |
| 44 |
to the file backing the BFD. */ |
| 45 |
void *iostream; |
| 46 |
const struct bfd_iovec *iovec; |
| 47 |
|
| 48 |
/* The caching routines use these to maintain a |
| 49 |
least-recently-used list of BFDs. */ |
| 50 |
struct bfd *lru_prev, *lru_next; |
| 51 |
|
| 52 |
/* Track current file position (or current buffer offset for |
| 53 |
in-memory BFDs). When a file is closed by the caching routines, |
| 54 |
BFD retains state information on the file here. */ |
| 55 |
ufile_ptr where; |
| 56 |
|
| 57 |
/* File modified time, if mtime_set is TRUE. */ |
| 58 |
long mtime; |
| 59 |
|
| 60 |
/* A unique identifier of the BFD */ |
| 61 |
unsigned int id; |
| 62 |
|
| 63 |
/* Format_specific flags. */ |
| 64 |
flagword flags; |
| 65 |
|
| 66 |
/* Values that may appear in the flags field of a BFD. These also |
| 67 |
appear in the object_flags field of the bfd_target structure, where |
| 68 |
they indicate the set of flags used by that backend (not all flags |
| 69 |
are meaningful for all object file formats) (FIXME: at the moment, |
| 70 |
the object_flags values have mostly just been copied from backend |
| 71 |
to another, and are not necessarily correct). */ |
| 72 |
|
| 73 |
#define BFD_NO_FLAGS 0x0 |
| 74 |
|
| 75 |
/* BFD contains relocation entries. */ |
| 76 |
#define HAS_RELOC 0x1 |
| 77 |
|
| 78 |
/* BFD is directly executable. */ |
| 79 |
#define EXEC_P 0x2 |
| 80 |
|
| 81 |
/* BFD has line number information (basically used for F_LNNO in a |
| 82 |
COFF header). */ |
| 83 |
#define HAS_LINENO 0x4 |
| 84 |
|
| 85 |
/* BFD has debugging information. */ |
| 86 |
#define HAS_DEBUG 0x08 |
| 87 |
|
| 88 |
/* BFD has symbols. */ |
| 89 |
#define HAS_SYMS 0x10 |
| 90 |
|
| 91 |
/* BFD has local symbols (basically used for F_LSYMS in a COFF |
| 92 |
header). */ |
| 93 |
#define HAS_LOCALS 0x20 |
| 94 |
|
| 95 |
/* BFD is a dynamic object. */ |
| 96 |
#define DYNAMIC 0x40 |
| 97 |
|
| 98 |
/* Text section is write protected (if D_PAGED is not set, this is |
| 99 |
like an a.out NMAGIC file) (the linker sets this by default, but |
| 100 |
clears it for -r or -N). */ |
| 101 |
#define WP_TEXT 0x80 |
| 102 |
|
| 103 |
/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the |
| 104 |
linker sets this by default, but clears it for -r or -n or -N). */ |
| 105 |
#define D_PAGED 0x100 |
| 106 |
|
| 107 |
/* BFD is relaxable (this means that bfd_relax_section may be able to |
| 108 |
do something) (sometimes bfd_relax_section can do something even if |
| 109 |
this is not set). */ |
| 110 |
#define BFD_IS_RELAXABLE 0x200 |
| 111 |
|
| 112 |
/* This may be set before writing out a BFD to request using a |
| 113 |
traditional format. For example, this is used to request that when |
| 114 |
writing out an a.out object the symbols not be hashed to eliminate |
| 115 |
duplicates. */ |
| 116 |
#define BFD_TRADITIONAL_FORMAT 0x400 |
| 117 |
|
| 118 |
/* This flag indicates that the BFD contents are actually cached |
| 119 |
in memory. If this is set, iostream points to a bfd_in_memory |
| 120 |
struct. */ |
| 121 |
#define BFD_IN_MEMORY 0x800 |
| 122 |
|
| 123 |
/* This BFD has been created by the linker and doesn't correspond |
| 124 |
to any input file. */ |
| 125 |
#define BFD_LINKER_CREATED 0x1000 |
| 126 |
|
| 127 |
/* This may be set before writing out a BFD to request that it |
| 128 |
be written using values for UIDs, GIDs, timestamps, etc. that |
| 129 |
will be consistent from run to run. */ |
| 130 |
#define BFD_DETERMINISTIC_OUTPUT 0x2000 |
| 131 |
|
| 132 |
/* Compress sections in this BFD. */ |
| 133 |
#define BFD_COMPRESS 0x4000 |
| 134 |
|
| 135 |
/* Decompress sections in this BFD. */ |
| 136 |
#define BFD_DECOMPRESS 0x8000 |
| 137 |
|
| 138 |
/* BFD is a dummy, for plugins. */ |
| 139 |
#define BFD_PLUGIN 0x10000 |
| 140 |
|
| 141 |
/* Compress sections in this BFD with SHF_COMPRESSED from gABI. */ |
| 142 |
#define BFD_COMPRESS_GABI 0x20000 |
| 143 |
|
| 144 |
/* Convert ELF common symbol type to STT_COMMON or STT_OBJECT in this |
| 145 |
BFD. */ |
| 146 |
#define BFD_CONVERT_ELF_COMMON 0x40000 |
| 147 |
|
| 148 |
/* Use the ELF STT_COMMON type in this BFD. */ |
| 149 |
#define BFD_USE_ELF_STT_COMMON 0x80000 |
| 150 |
|
| 151 |
/* Put pathnames into archives (non-POSIX). */ |
| 152 |
#define BFD_ARCHIVE_FULL_PATH 0x100000 |
| 153 |
|
| 154 |
/* Flags bits to be saved in bfd_preserve_save. */ |
| 155 |
#define BFD_FLAGS_SAVED \ |
| 156 |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ |
| 157 |
| BFD_PLUGIN | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON \ |
| 158 |
| BFD_USE_ELF_STT_COMMON) |
| 159 |
|
| 160 |
/* Flags bits which are for BFD use only. */ |
| 161 |
#define BFD_FLAGS_FOR_BFD_USE_MASK \ |
| 162 |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ |
| 163 |
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \ |
| 164 |
| BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON) |
| 165 |
|
| 166 |
/* The format which belongs to the BFD. (object, core, etc.) */ |
| 167 |
ENUM_BITFIELD (bfd_format) format : 3; |
| 168 |
|
| 169 |
/* The direction with which the BFD was opened. */ |
| 170 |
ENUM_BITFIELD (bfd_direction) direction : 2; |
| 171 |
|
| 172 |
/* Is the file descriptor being cached? That is, can it be closed as |
| 173 |
needed, and re-opened when accessed later? */ |
| 174 |
unsigned int cacheable : 1; |
| 175 |
|
| 176 |
/* Marks whether there was a default target specified when the |
| 177 |
BFD was opened. This is used to select which matching algorithm |
| 178 |
to use to choose the back end. */ |
| 179 |
unsigned int target_defaulted : 1; |
| 180 |
|
| 181 |
/* ... and here: (``once'' means at least once). */ |
| 182 |
unsigned int opened_once : 1; |
| 183 |
|
| 184 |
/* Set if we have a locally maintained mtime value, rather than |
| 185 |
getting it from the file each time. */ |
| 186 |
unsigned int mtime_set : 1; |
| 187 |
|
| 188 |
/* Flag set if symbols from this BFD should not be exported. */ |
| 189 |
unsigned int no_export : 1; |
| 190 |
|
| 191 |
/* Remember when output has begun, to stop strange things |
| 192 |
from happening. */ |
| 193 |
unsigned int output_has_begun : 1; |
| 194 |
|
| 195 |
/* Have archive map. */ |
| 196 |
unsigned int has_armap : 1; |
| 197 |
|
| 198 |
/* Set if this is a thin archive. */ |
| 199 |
unsigned int is_thin_archive : 1; |
| 200 |
|
| 201 |
/* Set if this archive should not cache element positions. */ |
| 202 |
unsigned int no_element_cache : 1; |
| 203 |
|
| 204 |
/* Set if only required symbols should be added in the link hash table for |
| 205 |
this object. Used by VMS linkers. */ |
| 206 |
unsigned int selective_search : 1; |
| 207 |
|
| 208 |
/* Set if this is the linker output BFD. */ |
| 209 |
unsigned int is_linker_output : 1; |
| 210 |
|
| 211 |
/* Set if this is the linker input BFD. */ |
| 212 |
unsigned int is_linker_input : 1; |
| 213 |
|
| 214 |
/* If this is an input for a compiler plug-in library. */ |
| 215 |
ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2; |
| 216 |
|
| 217 |
/* Set if this is a plugin output file. */ |
| 218 |
unsigned int lto_output : 1; |
| 219 |
|
| 220 |
/* Set if this is a slim LTO object not loaded with a compiler plugin. */ |
| 221 |
unsigned int lto_slim_object : 1; |
| 222 |
|
| 223 |
/* Set to dummy BFD created when claimed by a compiler plug-in |
| 224 |
library. */ |
| 225 |
bfd *plugin_dummy_bfd; |
| 226 |
|
| 227 |
/* The offset of this bfd in the file, typically 0 if it is not |
| 228 |
contained in an archive. */ |
| 229 |
ufile_ptr origin; |
| 230 |
|
| 231 |
/* The origin in the archive of the proxy entry. This will |
| 232 |
normally be the same as origin, except for thin archives, |
| 233 |
when it will contain the current offset of the proxy in the |
| 234 |
thin archive rather than the offset of the bfd in its actual |
| 235 |
container. */ |
| 236 |
ufile_ptr proxy_origin; |
| 237 |
|
| 238 |
/* A hash table for section names. */ |
| 239 |
struct bfd_hash_table section_htab; |
| 240 |
|
| 241 |
/* Pointer to linked list of sections. */ |
| 242 |
struct bfd_section *sections; |
| 243 |
|
| 244 |
/* The last section on the section list. */ |
| 245 |
struct bfd_section *section_last; |
| 246 |
|
| 247 |
/* The number of sections. */ |
| 248 |
unsigned int section_count; |
| 249 |
|
| 250 |
/* A field used by _bfd_generic_link_add_archive_symbols. This will |
| 251 |
be used only for archive elements. */ |
| 252 |
int archive_pass; |
| 253 |
|
| 254 |
/* Stuff only useful for object files: |
| 255 |
The start address. */ |
| 256 |
bfd_vma start_address; |
| 257 |
|
| 258 |
/* Symbol table for output BFD (with symcount entries). |
| 259 |
Also used by the linker to cache input BFD symbols. */ |
| 260 |
struct bfd_symbol **outsymbols; |
| 261 |
|
| 262 |
/* Used for input and output. */ |
| 263 |
unsigned int symcount; |
| 264 |
|
| 265 |
/* Used for slurped dynamic symbol tables. */ |
| 266 |
unsigned int dynsymcount; |
| 267 |
|
| 268 |
/* Pointer to structure which contains architecture information. */ |
| 269 |
const struct bfd_arch_info *arch_info; |
| 270 |
|
| 271 |
/* Cached length of file for bfd_get_size. 0 until bfd_get_size is |
| 272 |
called, 1 if stat returns an error or the file size is too large to |
| 273 |
return in ufile_ptr. Both 0 and 1 should be treated as "unknown". */ |
| 274 |
ufile_ptr size; |
| 275 |
|
| 276 |
/* Stuff only useful for archives. */ |
| 277 |
void *arelt_data; |
| 278 |
struct bfd *my_archive; /* The containing archive BFD. */ |
| 279 |
struct bfd *archive_next; /* The next BFD in the archive. */ |
| 280 |
struct bfd *archive_head; /* The first BFD in the archive. */ |
| 281 |
struct bfd *nested_archives; /* List of nested archive in a flattened |
| 282 |
thin archive. */ |
| 283 |
|
| 284 |
union @{ |
| 285 |
/* For input BFDs, a chain of BFDs involved in a link. */ |
| 286 |
struct bfd *next; |
| 287 |
/* For output BFD, the linker hash table. */ |
| 288 |
struct bfd_link_hash_table *hash; |
| 289 |
@} link; |
| 290 |
|
| 291 |
/* Used by the back end to hold private data. */ |
| 292 |
union |
| 293 |
@{ |
| 294 |
struct aout_data_struct *aout_data; |
| 295 |
struct artdata *aout_ar_data; |
| 296 |
struct coff_tdata *coff_obj_data; |
| 297 |
struct pe_tdata *pe_obj_data; |
| 298 |
struct xcoff_tdata *xcoff_obj_data; |
| 299 |
struct ecoff_tdata *ecoff_obj_data; |
| 300 |
struct srec_data_struct *srec_data; |
| 301 |
struct verilog_data_struct *verilog_data; |
| 302 |
struct ihex_data_struct *ihex_data; |
| 303 |
struct tekhex_data_struct *tekhex_data; |
| 304 |
struct elf_obj_tdata *elf_obj_data; |
| 305 |
struct mmo_data_struct *mmo_data; |
| 306 |
struct sun_core_struct *sun_core_data; |
| 307 |
struct sco5_core_struct *sco5_core_data; |
| 308 |
struct trad_core_struct *trad_core_data; |
| 309 |
struct som_data_struct *som_data; |
| 310 |
struct hpux_core_struct *hpux_core_data; |
| 311 |
struct hppabsd_core_struct *hppabsd_core_data; |
| 312 |
struct sgi_core_struct *sgi_core_data; |
| 313 |
struct lynx_core_struct *lynx_core_data; |
| 314 |
struct osf_core_struct *osf_core_data; |
| 315 |
struct cisco_core_struct *cisco_core_data; |
| 316 |
struct versados_data_struct *versados_data; |
| 317 |
struct netbsd_core_struct *netbsd_core_data; |
| 318 |
struct mach_o_data_struct *mach_o_data; |
| 319 |
struct mach_o_fat_data_struct *mach_o_fat_data; |
| 320 |
struct plugin_data_struct *plugin_data; |
| 321 |
struct bfd_pef_data_struct *pef_data; |
| 322 |
struct bfd_pef_xlib_data_struct *pef_xlib_data; |
| 323 |
struct bfd_sym_data_struct *sym_data; |
| 324 |
void *any; |
| 325 |
@} |
| 326 |
tdata; |
| 327 |
|
| 328 |
/* Used by the application to hold private data. */ |
| 329 |
void *usrdata; |
| 330 |
|
| 331 |
/* Where all the allocated stuff under this BFD goes. This is a |
| 332 |
struct objalloc *, but we use void * to avoid requiring the inclusion |
| 333 |
of objalloc.h. */ |
| 334 |
void *memory; |
| 335 |
|
| 336 |
/* For input BFDs, the build ID, if the object has one. */ |
| 337 |
const struct bfd_build_id *build_id; |
| 338 |
@}; |
| 339 |
|
| 340 |
static inline const char * |
| 341 |
bfd_get_filename (const bfd *abfd) |
| 342 |
@{ |
| 343 |
return abfd->filename; |
| 344 |
@} |
| 345 |
|
| 346 |
static inline bfd_boolean |
| 347 |
bfd_get_cacheable (const bfd *abfd) |
| 348 |
@{ |
| 349 |
return abfd->cacheable; |
| 350 |
@} |
| 351 |
|
| 352 |
static inline enum bfd_format |
| 353 |
bfd_get_format (const bfd *abfd) |
| 354 |
@{ |
| 355 |
return abfd->format; |
| 356 |
@} |
| 357 |
|
| 358 |
static inline flagword |
| 359 |
bfd_get_file_flags (const bfd *abfd) |
| 360 |
@{ |
| 361 |
return abfd->flags; |
| 362 |
@} |
| 363 |
|
| 364 |
static inline bfd_vma |
| 365 |
bfd_get_start_address (const bfd *abfd) |
| 366 |
@{ |
| 367 |
return abfd->start_address; |
| 368 |
@} |
| 369 |
|
| 370 |
static inline unsigned int |
| 371 |
bfd_get_symcount (const bfd *abfd) |
| 372 |
@{ |
| 373 |
return abfd->symcount; |
| 374 |
@} |
| 375 |
|
| 376 |
static inline unsigned int |
| 377 |
bfd_get_dynamic_symcount (const bfd *abfd) |
| 378 |
@{ |
| 379 |
return abfd->dynsymcount; |
| 380 |
@} |
| 381 |
|
| 382 |
static inline struct bfd_symbol ** |
| 383 |
bfd_get_outsymbols (const bfd *abfd) |
| 384 |
@{ |
| 385 |
return abfd->outsymbols; |
| 386 |
@} |
| 387 |
|
| 388 |
static inline unsigned int |
| 389 |
bfd_count_sections (const bfd *abfd) |
| 390 |
@{ |
| 391 |
return abfd->section_count; |
| 392 |
@} |
| 393 |
|
| 394 |
static inline bfd_boolean |
| 395 |
bfd_has_map (const bfd *abfd) |
| 396 |
@{ |
| 397 |
return abfd->has_armap; |
| 398 |
@} |
| 399 |
|
| 400 |
static inline bfd_boolean |
| 401 |
bfd_is_thin_archive (const bfd *abfd) |
| 402 |
@{ |
| 403 |
return abfd->is_thin_archive; |
| 404 |
@} |
| 405 |
|
| 406 |
static inline void * |
| 407 |
bfd_usrdata (const bfd *abfd) |
| 408 |
@{ |
| 409 |
return abfd->usrdata; |
| 410 |
@} |
| 411 |
|
| 412 |
/* See note beside bfd_set_section_userdata. */ |
| 413 |
static inline bfd_boolean |
| 414 |
bfd_set_cacheable (bfd * abfd, bfd_boolean val) |
| 415 |
@{ |
| 416 |
abfd->cacheable = val; |
| 417 |
return TRUE; |
| 418 |
@} |
| 419 |
|
| 420 |
static inline void |
| 421 |
bfd_set_thin_archive (bfd *abfd, bfd_boolean val) |
| 422 |
@{ |
| 423 |
abfd->is_thin_archive = val; |
| 424 |
@} |
| 425 |
|
| 426 |
static inline void |
| 427 |
bfd_set_usrdata (bfd *abfd, void *val) |
| 428 |
@{ |
| 429 |
abfd->usrdata = val; |
| 430 |
@} |
| 431 |
|
| 432 |
static inline asection * |
| 433 |
bfd_asymbol_section (const asymbol *sy) |
| 434 |
@{ |
| 435 |
return sy->section; |
| 436 |
@} |
| 437 |
|
| 438 |
static inline bfd_vma |
| 439 |
bfd_asymbol_value (const asymbol *sy) |
| 440 |
@{ |
| 441 |
return sy->section->vma + sy->value; |
| 442 |
@} |
| 443 |
|
| 444 |
static inline const char * |
| 445 |
bfd_asymbol_name (const asymbol *sy) |
| 446 |
@{ |
| 447 |
return sy->name; |
| 448 |
@} |
| 449 |
|
| 450 |
static inline struct bfd * |
| 451 |
bfd_asymbol_bfd (const asymbol *sy) |
| 452 |
@{ |
| 453 |
return sy->the_bfd; |
| 454 |
@} |
| 455 |
|
| 456 |
static inline void |
| 457 |
bfd_set_asymbol_name (asymbol *sy, const char *name) |
| 458 |
@{ |
| 459 |
sy->name = name; |
| 460 |
@} |
| 461 |
|
| 462 |
static inline bfd_size_type |
| 463 |
bfd_get_section_limit_octets (const bfd *abfd, const asection *sec) |
| 464 |
@{ |
| 465 |
if (abfd->direction != write_direction && sec->rawsize != 0) |
| 466 |
return sec->rawsize; |
| 467 |
return sec->size; |
| 468 |
@} |
| 469 |
|
| 470 |
/* Find the address one past the end of SEC. */ |
| 471 |
static inline bfd_size_type |
| 472 |
bfd_get_section_limit (const bfd *abfd, const asection *sec) |
| 473 |
@{ |
| 474 |
return (bfd_get_section_limit_octets (abfd, sec) |
| 475 |
/ bfd_octets_per_byte (abfd, sec)); |
| 476 |
@} |
| 477 |
|
| 478 |
/* Functions to handle insertion and deletion of a bfd's sections. These |
| 479 |
only handle the list pointers, ie. do not adjust section_count, |
| 480 |
target_index etc. */ |
| 481 |
static inline void |
| 482 |
bfd_section_list_remove (bfd *abfd, asection *s) |
| 483 |
@{ |
| 484 |
asection *next = s->next; |
| 485 |
asection *prev = s->prev; |
| 486 |
if (prev) |
| 487 |
prev->next = next; |
| 488 |
else |
| 489 |
abfd->sections = next; |
| 490 |
if (next) |
| 491 |
next->prev = prev; |
| 492 |
else |
| 493 |
abfd->section_last = prev; |
| 494 |
@} |
| 495 |
|
| 496 |
static inline void |
| 497 |
bfd_section_list_append (bfd *abfd, asection *s) |
| 498 |
@{ |
| 499 |
s->next = 0; |
| 500 |
if (abfd->section_last) |
| 501 |
@{ |
| 502 |
s->prev = abfd->section_last; |
| 503 |
abfd->section_last->next = s; |
| 504 |
@} |
| 505 |
else |
| 506 |
@{ |
| 507 |
s->prev = 0; |
| 508 |
abfd->sections = s; |
| 509 |
@} |
| 510 |
abfd->section_last = s; |
| 511 |
@} |
| 512 |
|
| 513 |
static inline void |
| 514 |
bfd_section_list_prepend (bfd *abfd, asection *s) |
| 515 |
@{ |
| 516 |
s->prev = 0; |
| 517 |
if (abfd->sections) |
| 518 |
@{ |
| 519 |
s->next = abfd->sections; |
| 520 |
abfd->sections->prev = s; |
| 521 |
@} |
| 522 |
else |
| 523 |
@{ |
| 524 |
s->next = 0; |
| 525 |
abfd->section_last = s; |
| 526 |
@} |
| 527 |
abfd->sections = s; |
| 528 |
@} |
| 529 |
|
| 530 |
static inline void |
| 531 |
bfd_section_list_insert_after (bfd *abfd, asection *a, asection *s) |
| 532 |
@{ |
| 533 |
asection *next = a->next; |
| 534 |
s->next = next; |
| 535 |
s->prev = a; |
| 536 |
a->next = s; |
| 537 |
if (next) |
| 538 |
next->prev = s; |
| 539 |
else |
| 540 |
abfd->section_last = s; |
| 541 |
@} |
| 542 |
|
| 543 |
static inline void |
| 544 |
bfd_section_list_insert_before (bfd *abfd, asection *b, asection *s) |
| 545 |
@{ |
| 546 |
asection *prev = b->prev; |
| 547 |
s->prev = prev; |
| 548 |
s->next = b; |
| 549 |
b->prev = s; |
| 550 |
if (prev) |
| 551 |
prev->next = s; |
| 552 |
else |
| 553 |
abfd->sections = s; |
| 554 |
@} |
| 555 |
|
| 556 |
static inline bfd_boolean |
| 557 |
bfd_section_removed_from_list (const bfd *abfd, const asection *s) |
| 558 |
@{ |
| 559 |
return s->next ? s->next->prev != s : abfd->section_last != s; |
| 560 |
@} |
| 561 |
|
| 562 |
@end example |
| 563 |
@node Error reporting, Miscellaneous, typedef bfd, BFD front end |
| 564 |
@section Error reporting |
| 565 |
Most BFD functions return nonzero on success (check their |
| 566 |
individual documentation for precise semantics). On an error, |
| 567 |
they call @code{bfd_set_error} to set an error condition that callers |
| 568 |
can check by calling @code{bfd_get_error}. |
| 569 |
If that returns @code{bfd_error_system_call}, then check |
| 570 |
@code{errno}. |
| 571 |
|
| 572 |
The easiest way to report a BFD error to the user is to |
| 573 |
use @code{bfd_perror}. |
| 574 |
|
| 575 |
@subsection Type @code{bfd_error_type} |
| 576 |
The values returned by @code{bfd_get_error} are defined by the |
| 577 |
enumerated type @code{bfd_error_type}. |
| 578 |
|
| 579 |
|
| 580 |
@example |
| 581 |
|
| 582 |
typedef enum bfd_error |
| 583 |
@{ |
| 584 |
bfd_error_no_error = 0, |
| 585 |
bfd_error_system_call, |
| 586 |
bfd_error_invalid_target, |
| 587 |
bfd_error_wrong_format, |
| 588 |
bfd_error_wrong_object_format, |
| 589 |
bfd_error_invalid_operation, |
| 590 |
bfd_error_no_memory, |
| 591 |
bfd_error_no_symbols, |
| 592 |
bfd_error_no_armap, |
| 593 |
bfd_error_no_more_archived_files, |
| 594 |
bfd_error_malformed_archive, |
| 595 |
bfd_error_missing_dso, |
| 596 |
bfd_error_file_not_recognized, |
| 597 |
bfd_error_file_ambiguously_recognized, |
| 598 |
bfd_error_no_contents, |
| 599 |
bfd_error_nonrepresentable_section, |
| 600 |
bfd_error_no_debug_section, |
| 601 |
bfd_error_bad_value, |
| 602 |
bfd_error_file_truncated, |
| 603 |
bfd_error_file_too_big, |
| 604 |
bfd_error_sorry, |
| 605 |
bfd_error_on_input, |
| 606 |
bfd_error_invalid_error_code |
| 607 |
@} |
| 608 |
bfd_error_type; |
| 609 |
|
| 610 |
@end example |
| 611 |
@findex bfd_get_error |
| 612 |
@subsubsection @code{bfd_get_error} |
| 613 |
@strong{Synopsis} |
| 614 |
@example |
| 615 |
bfd_error_type bfd_get_error (void); |
| 616 |
@end example |
| 617 |
@strong{Description}@* |
| 618 |
Return the current BFD error condition. |
| 619 |
|
| 620 |
@findex bfd_set_error |
| 621 |
@subsubsection @code{bfd_set_error} |
| 622 |
@strong{Synopsis} |
| 623 |
@example |
| 624 |
void bfd_set_error (bfd_error_type error_tag); |
| 625 |
@end example |
| 626 |
@strong{Description}@* |
| 627 |
Set the BFD error condition to be @var{error_tag}. |
| 628 |
|
| 629 |
@var{error_tag} must not be bfd_error_on_input. Use |
| 630 |
bfd_set_input_error for input errors instead. |
| 631 |
|
| 632 |
@findex bfd_set_input_error |
| 633 |
@subsubsection @code{bfd_set_input_error} |
| 634 |
@strong{Synopsis} |
| 635 |
@example |
| 636 |
void bfd_set_input_error (bfd *input, bfd_error_type error_tag); |
| 637 |
@end example |
| 638 |
@strong{Description}@* |
| 639 |
Set the BFD error condition to be bfd_error_on_input. |
| 640 |
@var{input} is the input bfd where the error occurred, and |
| 641 |
@var{error_tag} the bfd_error_type error. |
| 642 |
|
| 643 |
@findex bfd_errmsg |
| 644 |
@subsubsection @code{bfd_errmsg} |
| 645 |
@strong{Synopsis} |
| 646 |
@example |
| 647 |
const char *bfd_errmsg (bfd_error_type error_tag); |
| 648 |
@end example |
| 649 |
@strong{Description}@* |
| 650 |
Return a string describing the error @var{error_tag}, or |
| 651 |
the system error if @var{error_tag} is @code{bfd_error_system_call}. |
| 652 |
|
| 653 |
@findex bfd_perror |
| 654 |
@subsubsection @code{bfd_perror} |
| 655 |
@strong{Synopsis} |
| 656 |
@example |
| 657 |
void bfd_perror (const char *message); |
| 658 |
@end example |
| 659 |
@strong{Description}@* |
| 660 |
Print to the standard error stream a string describing the |
| 661 |
last BFD error that occurred, or the last system error if |
| 662 |
the last BFD error was a system call failure. If @var{message} |
| 663 |
is non-NULL and non-empty, the error string printed is preceded |
| 664 |
by @var{message}, a colon, and a space. It is followed by a newline. |
| 665 |
|
| 666 |
@subsection BFD error handler |
| 667 |
Some BFD functions want to print messages describing the |
| 668 |
problem. They call a BFD error handler function. This |
| 669 |
function may be overridden by the program. |
| 670 |
|
| 671 |
The BFD error handler acts like vprintf. |
| 672 |
|
| 673 |
|
| 674 |
@example |
| 675 |
|
| 676 |
typedef void (*bfd_error_handler_type) (const char *, va_list); |
| 677 |
|
| 678 |
@end example |
| 679 |
@findex _bfd_error_handler |
| 680 |
@subsubsection @code{_bfd_error_handler} |
| 681 |
@strong{Synopsis} |
| 682 |
@example |
| 683 |
void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1; |
| 684 |
@end example |
| 685 |
@strong{Description}@* |
| 686 |
This is the default routine to handle BFD error messages. |
| 687 |
Like fprintf (stderr, ...), but also handles some extra format |
| 688 |
specifiers. |
| 689 |
|
| 690 |
%pA section name from section. For group components, prints |
| 691 |
group name too. |
| 692 |
%pB file name from bfd. For archive components, prints |
| 693 |
archive too. |
| 694 |
|
| 695 |
Beware: Only supports a maximum of 9 format arguments. |
| 696 |
|
| 697 |
@findex bfd_set_error_handler |
| 698 |
@subsubsection @code{bfd_set_error_handler} |
| 699 |
@strong{Synopsis} |
| 700 |
@example |
| 701 |
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); |
| 702 |
@end example |
| 703 |
@strong{Description}@* |
| 704 |
Set the BFD error handler function. Returns the previous |
| 705 |
function. |
| 706 |
|
| 707 |
@findex bfd_set_error_program_name |
| 708 |
@subsubsection @code{bfd_set_error_program_name} |
| 709 |
@strong{Synopsis} |
| 710 |
@example |
| 711 |
void bfd_set_error_program_name (const char *); |
| 712 |
@end example |
| 713 |
@strong{Description}@* |
| 714 |
Set the program name to use when printing a BFD error. This |
| 715 |
is printed before the error message followed by a colon and |
| 716 |
space. The string must not be changed after it is passed to |
| 717 |
this function. |
| 718 |
|
| 719 |
@subsection BFD assert handler |
| 720 |
If BFD finds an internal inconsistency, the bfd assert |
| 721 |
handler is called with information on the BFD version, BFD |
| 722 |
source file and line. If this happens, most programs linked |
| 723 |
against BFD are expected to want to exit with an error, or mark |
| 724 |
the current BFD operation as failed, so it is recommended to |
| 725 |
override the default handler, which just calls |
| 726 |
_bfd_error_handler and continues. |
| 727 |
|
| 728 |
|
| 729 |
@example |
| 730 |
|
| 731 |
typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, |
| 732 |
const char *bfd_version, |
| 733 |
const char *bfd_file, |
| 734 |
int bfd_line); |
| 735 |
|
| 736 |
@end example |
| 737 |
@findex bfd_set_assert_handler |
| 738 |
@subsubsection @code{bfd_set_assert_handler} |
| 739 |
@strong{Synopsis} |
| 740 |
@example |
| 741 |
bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type); |
| 742 |
@end example |
| 743 |
@strong{Description}@* |
| 744 |
Set the BFD assert handler function. Returns the previous |
| 745 |
function. |
| 746 |
|
| 747 |
@node Miscellaneous, Memory Usage, Error reporting, BFD front end |
| 748 |
@section Miscellaneous |
| 749 |
|
| 750 |
|
| 751 |
@subsection Miscellaneous functions |
| 752 |
|
| 753 |
|
| 754 |
@findex bfd_get_reloc_upper_bound |
| 755 |
@subsubsection @code{bfd_get_reloc_upper_bound} |
| 756 |
@strong{Synopsis} |
| 757 |
@example |
| 758 |
long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); |
| 759 |
@end example |
| 760 |
@strong{Description}@* |
| 761 |
Return the number of bytes required to store the |
| 762 |
relocation information associated with section @var{sect} |
| 763 |
attached to bfd @var{abfd}. If an error occurs, return -1. |
| 764 |
|
| 765 |
@findex bfd_canonicalize_reloc |
| 766 |
@subsubsection @code{bfd_canonicalize_reloc} |
| 767 |
@strong{Synopsis} |
| 768 |
@example |
| 769 |
long bfd_canonicalize_reloc |
| 770 |
(bfd *abfd, asection *sec, arelent **loc, asymbol **syms); |
| 771 |
@end example |
| 772 |
@strong{Description}@* |
| 773 |
Call the back end associated with the open BFD |
| 774 |
@var{abfd} and translate the external form of the relocation |
| 775 |
information attached to @var{sec} into the internal canonical |
| 776 |
form. Place the table into memory at @var{loc}, which has |
| 777 |
been preallocated, usually by a call to |
| 778 |
@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or |
| 779 |
-1 on error. |
| 780 |
|
| 781 |
The @var{syms} table is also needed for horrible internal magic |
| 782 |
reasons. |
| 783 |
|
| 784 |
@findex bfd_set_reloc |
| 785 |
@subsubsection @code{bfd_set_reloc} |
| 786 |
@strong{Synopsis} |
| 787 |
@example |
| 788 |
void bfd_set_reloc |
| 789 |
(bfd *abfd, asection *sec, arelent **rel, unsigned int count); |
| 790 |
@end example |
| 791 |
@strong{Description}@* |
| 792 |
Set the relocation pointer and count within |
| 793 |
section @var{sec} to the values @var{rel} and @var{count}. |
| 794 |
The argument @var{abfd} is ignored. |
| 795 |
@example |
| 796 |
#define bfd_set_reloc(abfd, asect, location, count) \ |
| 797 |
BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count)) |
| 798 |
@end example |
| 799 |
|
| 800 |
@findex bfd_set_file_flags |
| 801 |
@subsubsection @code{bfd_set_file_flags} |
| 802 |
@strong{Synopsis} |
| 803 |
@example |
| 804 |
bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); |
| 805 |
@end example |
| 806 |
@strong{Description}@* |
| 807 |
Set the flag word in the BFD @var{abfd} to the value @var{flags}. |
| 808 |
|
| 809 |
Possible errors are: |
| 810 |
@itemize @bullet |
| 811 |
|
| 812 |
@item |
| 813 |
@code{bfd_error_wrong_format} - The target bfd was not of object format. |
| 814 |
@item |
| 815 |
@code{bfd_error_invalid_operation} - The target bfd was open for reading. |
| 816 |
@item |
| 817 |
@code{bfd_error_invalid_operation} - |
| 818 |
The flag word contained a bit which was not applicable to the |
| 819 |
type of file. E.g., an attempt was made to set the @code{D_PAGED} bit |
| 820 |
on a BFD format which does not support demand paging. |
| 821 |
@end itemize |
| 822 |
|
| 823 |
@findex bfd_get_arch_size |
| 824 |
@subsubsection @code{bfd_get_arch_size} |
| 825 |
@strong{Synopsis} |
| 826 |
@example |
| 827 |
int bfd_get_arch_size (bfd *abfd); |
| 828 |
@end example |
| 829 |
@strong{Description}@* |
| 830 |
Returns the normalized architecture address size, in bits, as |
| 831 |
determined by the object file's format. By normalized, we mean |
| 832 |
either 32 or 64. For ELF, this information is included in the |
| 833 |
header. Use bfd_arch_bits_per_address for number of bits in |
| 834 |
the architecture address. |
| 835 |
|
| 836 |
@strong{Returns}@* |
| 837 |
Returns the arch size in bits if known, @code{-1} otherwise. |
| 838 |
|
| 839 |
@findex bfd_get_sign_extend_vma |
| 840 |
@subsubsection @code{bfd_get_sign_extend_vma} |
| 841 |
@strong{Synopsis} |
| 842 |
@example |
| 843 |
int bfd_get_sign_extend_vma (bfd *abfd); |
| 844 |
@end example |
| 845 |
@strong{Description}@* |
| 846 |
Indicates if the target architecture "naturally" sign extends |
| 847 |
an address. Some architectures implicitly sign extend address |
| 848 |
values when they are converted to types larger than the size |
| 849 |
of an address. For instance, bfd_get_start_address() will |
| 850 |
return an address sign extended to fill a bfd_vma when this is |
| 851 |
the case. |
| 852 |
|
| 853 |
@strong{Returns}@* |
| 854 |
Returns @code{1} if the target architecture is known to sign |
| 855 |
extend addresses, @code{0} if the target architecture is known to |
| 856 |
not sign extend addresses, and @code{-1} otherwise. |
| 857 |
|
| 858 |
@findex bfd_set_start_address |
| 859 |
@subsubsection @code{bfd_set_start_address} |
| 860 |
@strong{Synopsis} |
| 861 |
@example |
| 862 |
bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); |
| 863 |
@end example |
| 864 |
@strong{Description}@* |
| 865 |
Make @var{vma} the entry point of output BFD @var{abfd}. |
| 866 |
|
| 867 |
@strong{Returns}@* |
| 868 |
Returns @code{TRUE} on success, @code{FALSE} otherwise. |
| 869 |
|
| 870 |
@findex bfd_get_gp_size |
| 871 |
@subsubsection @code{bfd_get_gp_size} |
| 872 |
@strong{Synopsis} |
| 873 |
@example |
| 874 |
unsigned int bfd_get_gp_size (bfd *abfd); |
| 875 |
@end example |
| 876 |
@strong{Description}@* |
| 877 |
Return the maximum size of objects to be optimized using the GP |
| 878 |
register under MIPS ECOFF. This is typically set by the @code{-G} |
| 879 |
argument to the compiler, assembler or linker. |
| 880 |
|
| 881 |
@findex bfd_set_gp_size |
| 882 |
@subsubsection @code{bfd_set_gp_size} |
| 883 |
@strong{Synopsis} |
| 884 |
@example |
| 885 |
void bfd_set_gp_size (bfd *abfd, unsigned int i); |
| 886 |
@end example |
| 887 |
@strong{Description}@* |
| 888 |
Set the maximum size of objects to be optimized using the GP |
| 889 |
register under ECOFF or MIPS ELF. This is typically set by |
| 890 |
the @code{-G} argument to the compiler, assembler or linker. |
| 891 |
|
| 892 |
@findex bfd_scan_vma |
| 893 |
@subsubsection @code{bfd_scan_vma} |
| 894 |
@strong{Synopsis} |
| 895 |
@example |
| 896 |
bfd_vma bfd_scan_vma (const char *string, const char **end, int base); |
| 897 |
@end example |
| 898 |
@strong{Description}@* |
| 899 |
Convert, like @code{strtoul}, a numerical expression |
| 900 |
@var{string} into a @code{bfd_vma} integer, and return that integer. |
| 901 |
(Though without as many bells and whistles as @code{strtoul}.) |
| 902 |
The expression is assumed to be unsigned (i.e., positive). |
| 903 |
If given a @var{base}, it is used as the base for conversion. |
| 904 |
A base of 0 causes the function to interpret the string |
| 905 |
in hex if a leading "0x" or "0X" is found, otherwise |
| 906 |
in octal if a leading zero is found, otherwise in decimal. |
| 907 |
|
| 908 |
If the value would overflow, the maximum @code{bfd_vma} value is |
| 909 |
returned. |
| 910 |
|
| 911 |
@findex bfd_copy_private_header_data |
| 912 |
@subsubsection @code{bfd_copy_private_header_data} |
| 913 |
@strong{Synopsis} |
| 914 |
@example |
| 915 |
bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); |
| 916 |
@end example |
| 917 |
@strong{Description}@* |
| 918 |
Copy private BFD header information from the BFD @var{ibfd} to the |
| 919 |
the BFD @var{obfd}. This copies information that may require |
| 920 |
sections to exist, but does not require symbol tables. Return |
| 921 |
@code{true} on success, @code{false} on error. |
| 922 |
Possible error returns are: |
| 923 |
|
| 924 |
@itemize @bullet |
| 925 |
|
| 926 |
@item |
| 927 |
@code{bfd_error_no_memory} - |
| 928 |
Not enough memory exists to create private data for @var{obfd}. |
| 929 |
@end itemize |
| 930 |
@example |
| 931 |
#define bfd_copy_private_header_data(ibfd, obfd) \ |
| 932 |
BFD_SEND (obfd, _bfd_copy_private_header_data, \ |
| 933 |
(ibfd, obfd)) |
| 934 |
@end example |
| 935 |
|
| 936 |
@findex bfd_copy_private_bfd_data |
| 937 |
@subsubsection @code{bfd_copy_private_bfd_data} |
| 938 |
@strong{Synopsis} |
| 939 |
@example |
| 940 |
bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); |
| 941 |
@end example |
| 942 |
@strong{Description}@* |
| 943 |
Copy private BFD information from the BFD @var{ibfd} to the |
| 944 |
the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error. |
| 945 |
Possible error returns are: |
| 946 |
|
| 947 |
@itemize @bullet |
| 948 |
|
| 949 |
@item |
| 950 |
@code{bfd_error_no_memory} - |
| 951 |
Not enough memory exists to create private data for @var{obfd}. |
| 952 |
@end itemize |
| 953 |
@example |
| 954 |
#define bfd_copy_private_bfd_data(ibfd, obfd) \ |
| 955 |
BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ |
| 956 |
(ibfd, obfd)) |
| 957 |
@end example |
| 958 |
|
| 959 |
@findex bfd_set_private_flags |
| 960 |
@subsubsection @code{bfd_set_private_flags} |
| 961 |
@strong{Synopsis} |
| 962 |
@example |
| 963 |
bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); |
| 964 |
@end example |
| 965 |
@strong{Description}@* |
| 966 |
Set private BFD flag information in the BFD @var{abfd}. |
| 967 |
Return @code{TRUE} on success, @code{FALSE} on error. Possible error |
| 968 |
returns are: |
| 969 |
|
| 970 |
@itemize @bullet |
| 971 |
|
| 972 |
@item |
| 973 |
@code{bfd_error_no_memory} - |
| 974 |
Not enough memory exists to create private data for @var{obfd}. |
| 975 |
@end itemize |
| 976 |
@example |
| 977 |
#define bfd_set_private_flags(abfd, flags) \ |
| 978 |
BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) |
| 979 |
@end example |
| 980 |
|
| 981 |
@findex Other functions |
| 982 |
@subsubsection @code{Other functions} |
| 983 |
@strong{Description}@* |
| 984 |
The following functions exist but have not yet been documented. |
| 985 |
@example |
| 986 |
#define bfd_sizeof_headers(abfd, info) \ |
| 987 |
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) |
| 988 |
|
| 989 |
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ |
| 990 |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
| 991 |
(abfd, syms, sec, off, file, func, line, NULL)) |
| 992 |
|
| 993 |
#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ |
| 994 |
line, disc) \ |
| 995 |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
| 996 |
(abfd, syms, sec, off, file, func, line, disc)) |
| 997 |
|
| 998 |
#define bfd_find_line(abfd, syms, sym, file, line) \ |
| 999 |
BFD_SEND (abfd, _bfd_find_line, \ |
| 1000 |
(abfd, syms, sym, file, line)) |
| 1001 |
|
| 1002 |
#define bfd_find_inliner_info(abfd, file, func, line) \ |
| 1003 |
BFD_SEND (abfd, _bfd_find_inliner_info, \ |
| 1004 |
(abfd, file, func, line)) |
| 1005 |
|
| 1006 |
#define bfd_debug_info_start(abfd) \ |
| 1007 |
BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) |
| 1008 |
|
| 1009 |
#define bfd_debug_info_end(abfd) \ |
| 1010 |
BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) |
| 1011 |
|
| 1012 |
#define bfd_debug_info_accumulate(abfd, section) \ |
| 1013 |
BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) |
| 1014 |
|
| 1015 |
#define bfd_stat_arch_elt(abfd, stat) \ |
| 1016 |
BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \ |
| 1017 |
_bfd_stat_arch_elt, (abfd, stat)) |
| 1018 |
|
| 1019 |
#define bfd_update_armap_timestamp(abfd) \ |
| 1020 |
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) |
| 1021 |
|
| 1022 |
#define bfd_set_arch_mach(abfd, arch, mach)\ |
| 1023 |
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) |
| 1024 |
|
| 1025 |
#define bfd_relax_section(abfd, section, link_info, again) \ |
| 1026 |
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) |
| 1027 |
|
| 1028 |
#define bfd_gc_sections(abfd, link_info) \ |
| 1029 |
BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info)) |
| 1030 |
|
| 1031 |
#define bfd_lookup_section_flags(link_info, flag_info, section) \ |
| 1032 |
BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section)) |
| 1033 |
|
| 1034 |
#define bfd_merge_sections(abfd, link_info) \ |
| 1035 |
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) |
| 1036 |
|
| 1037 |
#define bfd_is_group_section(abfd, sec) \ |
| 1038 |
BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) |
| 1039 |
|
| 1040 |
#define bfd_group_name(abfd, sec) \ |
| 1041 |
BFD_SEND (abfd, _bfd_group_name, (abfd, sec)) |
| 1042 |
|
| 1043 |
#define bfd_discard_group(abfd, sec) \ |
| 1044 |
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) |
| 1045 |
|
| 1046 |
#define bfd_link_hash_table_create(abfd) \ |
| 1047 |
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) |
| 1048 |
|
| 1049 |
#define bfd_link_add_symbols(abfd, info) \ |
| 1050 |
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) |
| 1051 |
|
| 1052 |
#define bfd_link_just_syms(abfd, sec, info) \ |
| 1053 |
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) |
| 1054 |
|
| 1055 |
#define bfd_final_link(abfd, info) \ |
| 1056 |
BFD_SEND (abfd, _bfd_final_link, (abfd, info)) |
| 1057 |
|
| 1058 |
#define bfd_free_cached_info(abfd) \ |
| 1059 |
BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) |
| 1060 |
|
| 1061 |
#define bfd_get_dynamic_symtab_upper_bound(abfd) \ |
| 1062 |
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) |
| 1063 |
|
| 1064 |
#define bfd_print_private_bfd_data(abfd, file)\ |
| 1065 |
BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) |
| 1066 |
|
| 1067 |
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ |
| 1068 |
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) |
| 1069 |
|
| 1070 |
#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ |
| 1071 |
BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ |
| 1072 |
dyncount, dynsyms, ret)) |
| 1073 |
|
| 1074 |
#define bfd_get_dynamic_reloc_upper_bound(abfd) \ |
| 1075 |
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) |
| 1076 |
|
| 1077 |
#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ |
| 1078 |
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) |
| 1079 |
|
| 1080 |
extern bfd_byte *bfd_get_relocated_section_contents |
| 1081 |
(bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, |
| 1082 |
bfd_boolean, asymbol **); |
| 1083 |
|
| 1084 |
@end example |
| 1085 |
|
| 1086 |
@findex bfd_alt_mach_code |
| 1087 |
@subsubsection @code{bfd_alt_mach_code} |
| 1088 |
@strong{Synopsis} |
| 1089 |
@example |
| 1090 |
bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); |
| 1091 |
@end example |
| 1092 |
@strong{Description}@* |
| 1093 |
When more than one machine code number is available for the |
| 1094 |
same machine type, this function can be used to switch between |
| 1095 |
the preferred one (alternative == 0) and any others. Currently, |
| 1096 |
only ELF supports this feature, with up to two alternate |
| 1097 |
machine codes. |
| 1098 |
|
| 1099 |
@findex bfd_emul_get_maxpagesize |
| 1100 |
@subsubsection @code{bfd_emul_get_maxpagesize} |
| 1101 |
@strong{Synopsis} |
| 1102 |
@example |
| 1103 |
bfd_vma bfd_emul_get_maxpagesize (const char *); |
| 1104 |
@end example |
| 1105 |
@strong{Description}@* |
| 1106 |
Returns the maximum page size, in bytes, as determined by |
| 1107 |
emulation. |
| 1108 |
|
| 1109 |
@strong{Returns}@* |
| 1110 |
Returns the maximum page size in bytes for ELF, 0 otherwise. |
| 1111 |
|
| 1112 |
@findex bfd_emul_set_maxpagesize |
| 1113 |
@subsubsection @code{bfd_emul_set_maxpagesize} |
| 1114 |
@strong{Synopsis} |
| 1115 |
@example |
| 1116 |
void bfd_emul_set_maxpagesize (const char *, bfd_vma); |
| 1117 |
@end example |
| 1118 |
@strong{Description}@* |
| 1119 |
For ELF, set the maximum page size for the emulation. It is |
| 1120 |
a no-op for other formats. |
| 1121 |
|
| 1122 |
@findex bfd_emul_get_commonpagesize |
| 1123 |
@subsubsection @code{bfd_emul_get_commonpagesize} |
| 1124 |
@strong{Synopsis} |
| 1125 |
@example |
| 1126 |
bfd_vma bfd_emul_get_commonpagesize (const char *, bfd_boolean); |
| 1127 |
@end example |
| 1128 |
@strong{Description}@* |
| 1129 |
Returns the common page size, in bytes, as determined by |
| 1130 |
emulation. |
| 1131 |
|
| 1132 |
@strong{Returns}@* |
| 1133 |
Returns the common page size in bytes for ELF, 0 otherwise. |
| 1134 |
|
| 1135 |
@findex bfd_emul_set_commonpagesize |
| 1136 |
@subsubsection @code{bfd_emul_set_commonpagesize} |
| 1137 |
@strong{Synopsis} |
| 1138 |
@example |
| 1139 |
void bfd_emul_set_commonpagesize (const char *, bfd_vma); |
| 1140 |
@end example |
| 1141 |
@strong{Description}@* |
| 1142 |
For ELF, set the common page size for the emulation. It is |
| 1143 |
a no-op for other formats. |
| 1144 |
|
| 1145 |
@findex bfd_demangle |
| 1146 |
@subsubsection @code{bfd_demangle} |
| 1147 |
@strong{Synopsis} |
| 1148 |
@example |
| 1149 |
char *bfd_demangle (bfd *, const char *, int); |
| 1150 |
@end example |
| 1151 |
@strong{Description}@* |
| 1152 |
Wrapper around cplus_demangle. Strips leading underscores and |
| 1153 |
other such chars that would otherwise confuse the demangler. |
| 1154 |
If passed a g++ v3 ABI mangled name, returns a buffer allocated |
| 1155 |
with malloc holding the demangled name. Returns NULL otherwise |
| 1156 |
and on memory alloc failure. |
| 1157 |
|
| 1158 |
@findex bfd_update_compression_header |
| 1159 |
@subsubsection @code{bfd_update_compression_header} |
| 1160 |
@strong{Synopsis} |
| 1161 |
@example |
| 1162 |
void bfd_update_compression_header |
| 1163 |
(bfd *abfd, bfd_byte *contents, asection *sec); |
| 1164 |
@end example |
| 1165 |
@strong{Description}@* |
| 1166 |
Set the compression header at CONTENTS of SEC in ABFD and update |
| 1167 |
elf_section_flags for compression. |
| 1168 |
|
| 1169 |
@findex bfd_check_compression_header |
| 1170 |
@subsubsection @code{bfd_check_compression_header} |
| 1171 |
@strong{Synopsis} |
| 1172 |
@example |
| 1173 |
bfd_boolean bfd_check_compression_header |
| 1174 |
(bfd *abfd, bfd_byte *contents, asection *sec, |
| 1175 |
bfd_size_type *uncompressed_size, |
| 1176 |
unsigned int *uncompressed_alignment_power); |
| 1177 |
@end example |
| 1178 |
@strong{Description}@* |
| 1179 |
Check the compression header at CONTENTS of SEC in ABFD and |
| 1180 |
store the uncompressed size in UNCOMPRESSED_SIZE and the |
| 1181 |
uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER |
| 1182 |
if the compression header is valid. |
| 1183 |
|
| 1184 |
@strong{Returns}@* |
| 1185 |
Return TRUE if the compression header is valid. |
| 1186 |
|
| 1187 |
@findex bfd_get_compression_header_size |
| 1188 |
@subsubsection @code{bfd_get_compression_header_size} |
| 1189 |
@strong{Synopsis} |
| 1190 |
@example |
| 1191 |
int bfd_get_compression_header_size (bfd *abfd, asection *sec); |
| 1192 |
@end example |
| 1193 |
@strong{Description}@* |
| 1194 |
Return the size of the compression header of SEC in ABFD. |
| 1195 |
|
| 1196 |
@strong{Returns}@* |
| 1197 |
Return the size of the compression header in bytes. |
| 1198 |
|
| 1199 |
@findex bfd_convert_section_size |
| 1200 |
@subsubsection @code{bfd_convert_section_size} |
| 1201 |
@strong{Synopsis} |
| 1202 |
@example |
| 1203 |
bfd_size_type bfd_convert_section_size |
| 1204 |
(bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); |
| 1205 |
@end example |
| 1206 |
@strong{Description}@* |
| 1207 |
Convert the size @var{size} of the section @var{isec} in input |
| 1208 |
BFD @var{ibfd} to the section size in output BFD @var{obfd}. |
| 1209 |
|
| 1210 |
@findex bfd_convert_section_contents |
| 1211 |
@subsubsection @code{bfd_convert_section_contents} |
| 1212 |
@strong{Synopsis} |
| 1213 |
@example |
| 1214 |
bfd_boolean bfd_convert_section_contents |
| 1215 |
(bfd *ibfd, asection *isec, bfd *obfd, |
| 1216 |
bfd_byte **ptr, bfd_size_type *ptr_size); |
| 1217 |
@end example |
| 1218 |
@strong{Description}@* |
| 1219 |
Convert the contents, stored in @var{*ptr}, of the section |
| 1220 |
@var{isec} in input BFD @var{ibfd} to output BFD @var{obfd} |
| 1221 |
if needed. The original buffer pointed to by @var{*ptr} may |
| 1222 |
be freed and @var{*ptr} is returned with memory malloc'd by this |
| 1223 |
function, and the new size written to @var{ptr_size}. |
| 1224 |
|