| 1 |
@section Targets |
| 2 |
|
| 3 |
|
| 4 |
@strong{Description}@* |
| 5 |
Each port of BFD to a different machine requires 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 |
|
| 105 |
@end example |
| 106 |
This is the structure which defines the type of BFD this is. The |
| 107 |
@code{xvec} member of the struct @code{bfd} itself points here. Each |
| 108 |
module that implements access to a different target under BFD, |
| 109 |
defines one of these. |
| 110 |
|
| 111 |
FIXME, these names should be rationalised with the names of |
| 112 |
the entry points which call them. Too bad we can't have one |
| 113 |
macro to define them both! |
| 114 |
@example |
| 115 |
enum bfd_flavour |
| 116 |
@{ |
| 117 |
/* N.B. Update bfd_flavour_name if you change this. */ |
| 118 |
bfd_target_unknown_flavour, |
| 119 |
bfd_target_aout_flavour, |
| 120 |
bfd_target_coff_flavour, |
| 121 |
bfd_target_ecoff_flavour, |
| 122 |
bfd_target_xcoff_flavour, |
| 123 |
bfd_target_elf_flavour, |
| 124 |
bfd_target_tekhex_flavour, |
| 125 |
bfd_target_srec_flavour, |
| 126 |
bfd_target_verilog_flavour, |
| 127 |
bfd_target_ihex_flavour, |
| 128 |
bfd_target_som_flavour, |
| 129 |
bfd_target_os9k_flavour, |
| 130 |
bfd_target_versados_flavour, |
| 131 |
bfd_target_msdos_flavour, |
| 132 |
bfd_target_ovax_flavour, |
| 133 |
bfd_target_evax_flavour, |
| 134 |
bfd_target_mmo_flavour, |
| 135 |
bfd_target_mach_o_flavour, |
| 136 |
bfd_target_pef_flavour, |
| 137 |
bfd_target_pef_xlib_flavour, |
| 138 |
bfd_target_sym_flavour |
| 139 |
@}; |
| 140 |
|
| 141 |
enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @}; |
| 142 |
|
| 143 |
/* Forward declaration. */ |
| 144 |
typedef struct bfd_link_info _bfd_link_info; |
| 145 |
|
| 146 |
/* Forward declaration. */ |
| 147 |
typedef struct flag_info flag_info; |
| 148 |
|
| 149 |
typedef void (*bfd_cleanup) (bfd *); |
| 150 |
|
| 151 |
typedef struct bfd_target |
| 152 |
@{ |
| 153 |
/* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */ |
| 154 |
const char *name; |
| 155 |
|
| 156 |
/* The "flavour" of a back end is a general indication about |
| 157 |
the contents of a file. */ |
| 158 |
enum bfd_flavour flavour; |
| 159 |
|
| 160 |
/* The order of bytes within the data area of a file. */ |
| 161 |
enum bfd_endian byteorder; |
| 162 |
|
| 163 |
/* The order of bytes within the header parts of a file. */ |
| 164 |
enum bfd_endian header_byteorder; |
| 165 |
|
| 166 |
/* A mask of all the flags which an executable may have set - |
| 167 |
from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}. */ |
| 168 |
flagword object_flags; |
| 169 |
|
| 170 |
/* A mask of all the flags which a section may have set - from |
| 171 |
the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}. */ |
| 172 |
flagword section_flags; |
| 173 |
|
| 174 |
/* The character normally found at the front of a symbol. |
| 175 |
(if any), perhaps `_'. */ |
| 176 |
char symbol_leading_char; |
| 177 |
|
| 178 |
/* The pad character for file names within an archive header. */ |
| 179 |
char ar_pad_char; |
| 180 |
|
| 181 |
/* The maximum number of characters in an archive header. */ |
| 182 |
unsigned char ar_max_namelen; |
| 183 |
|
| 184 |
/* How well this target matches, used to select between various |
| 185 |
possible targets when more than one target matches. */ |
| 186 |
unsigned char match_priority; |
| 187 |
|
| 188 |
/* Entries for byte swapping for data. These are different from the |
| 189 |
other entry points, since they don't take a BFD as the first argument. |
| 190 |
Certain other handlers could do the same. */ |
| 191 |
bfd_uint64_t (*bfd_getx64) (const void *); |
| 192 |
bfd_int64_t (*bfd_getx_signed_64) (const void *); |
| 193 |
void (*bfd_putx64) (bfd_uint64_t, void *); |
| 194 |
bfd_vma (*bfd_getx32) (const void *); |
| 195 |
bfd_signed_vma (*bfd_getx_signed_32) (const void *); |
| 196 |
void (*bfd_putx32) (bfd_vma, void *); |
| 197 |
bfd_vma (*bfd_getx16) (const void *); |
| 198 |
bfd_signed_vma (*bfd_getx_signed_16) (const void *); |
| 199 |
void (*bfd_putx16) (bfd_vma, void *); |
| 200 |
|
| 201 |
/* Byte swapping for the headers. */ |
| 202 |
bfd_uint64_t (*bfd_h_getx64) (const void *); |
| 203 |
bfd_int64_t (*bfd_h_getx_signed_64) (const void *); |
| 204 |
void (*bfd_h_putx64) (bfd_uint64_t, void *); |
| 205 |
bfd_vma (*bfd_h_getx32) (const void *); |
| 206 |
bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); |
| 207 |
void (*bfd_h_putx32) (bfd_vma, void *); |
| 208 |
bfd_vma (*bfd_h_getx16) (const void *); |
| 209 |
bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); |
| 210 |
void (*bfd_h_putx16) (bfd_vma, void *); |
| 211 |
|
| 212 |
/* Format dependent routines: these are vectors of entry points |
| 213 |
within the target vector structure, one for each format to check. */ |
| 214 |
|
| 215 |
/* Check the format of a file being read. Return a @code{bfd_cleanup} on |
| 216 |
success or zero on failure. */ |
| 217 |
bfd_cleanup (*_bfd_check_format[bfd_type_end]) (bfd *); |
| 218 |
|
| 219 |
/* Set the format of a file being written. */ |
| 220 |
bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); |
| 221 |
|
| 222 |
/* Write cached information into a file being written, at @code{bfd_close}. */ |
| 223 |
bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); |
| 224 |
|
| 225 |
@end example |
| 226 |
The general target vector. These vectors are initialized using the |
| 227 |
BFD_JUMP_TABLE macros. |
| 228 |
@example |
| 229 |
|
| 230 |
/* Generic entry points. */ |
| 231 |
#define BFD_JUMP_TABLE_GENERIC(NAME) \ |
| 232 |
NAME##_close_and_cleanup, \ |
| 233 |
NAME##_bfd_free_cached_info, \ |
| 234 |
NAME##_new_section_hook, \ |
| 235 |
NAME##_get_section_contents, \ |
| 236 |
NAME##_get_section_contents_in_window |
| 237 |
|
| 238 |
/* Called when the BFD is being closed to do any necessary cleanup. */ |
| 239 |
bfd_boolean (*_close_and_cleanup) (bfd *); |
| 240 |
/* Ask the BFD to free all cached information. */ |
| 241 |
bfd_boolean (*_bfd_free_cached_info) (bfd *); |
| 242 |
/* Called when a new section is created. */ |
| 243 |
bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); |
| 244 |
/* Read the contents of a section. */ |
| 245 |
bfd_boolean (*_bfd_get_section_contents) (bfd *, sec_ptr, void *, file_ptr, |
| 246 |
bfd_size_type); |
| 247 |
bfd_boolean (*_bfd_get_section_contents_in_window) (bfd *, sec_ptr, |
| 248 |
bfd_window *, file_ptr, |
| 249 |
bfd_size_type); |
| 250 |
|
| 251 |
/* Entry points to copy private data. */ |
| 252 |
#define BFD_JUMP_TABLE_COPY(NAME) \ |
| 253 |
NAME##_bfd_copy_private_bfd_data, \ |
| 254 |
NAME##_bfd_merge_private_bfd_data, \ |
| 255 |
_bfd_generic_init_private_section_data, \ |
| 256 |
NAME##_bfd_copy_private_section_data, \ |
| 257 |
NAME##_bfd_copy_private_symbol_data, \ |
| 258 |
NAME##_bfd_copy_private_header_data, \ |
| 259 |
NAME##_bfd_set_private_flags, \ |
| 260 |
NAME##_bfd_print_private_bfd_data |
| 261 |
|
| 262 |
/* Called to copy BFD general private data from one object file |
| 263 |
to another. */ |
| 264 |
bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); |
| 265 |
/* Called to merge BFD general private data from one object file |
| 266 |
to a common output file when linking. */ |
| 267 |
bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *); |
| 268 |
/* Called to initialize BFD private section data from one object file |
| 269 |
to another. */ |
| 270 |
#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ |
| 271 |
BFD_SEND (obfd, _bfd_init_private_section_data, \ |
| 272 |
(ibfd, isec, obfd, osec, link_info)) |
| 273 |
bfd_boolean (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, |
| 274 |
sec_ptr, |
| 275 |
struct bfd_link_info *); |
| 276 |
/* Called to copy BFD private section data from one object file |
| 277 |
to another. */ |
| 278 |
bfd_boolean (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, |
| 279 |
sec_ptr); |
| 280 |
/* Called to copy BFD private symbol data from one symbol |
| 281 |
to another. */ |
| 282 |
bfd_boolean (*_bfd_copy_private_symbol_data) (bfd *, asymbol *, bfd *, |
| 283 |
asymbol *); |
| 284 |
/* Called to copy BFD private header data from one object file |
| 285 |
to another. */ |
| 286 |
bfd_boolean (*_bfd_copy_private_header_data) (bfd *, bfd *); |
| 287 |
/* Called to set private backend flags. */ |
| 288 |
bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); |
| 289 |
|
| 290 |
/* Called to print private BFD data. */ |
| 291 |
bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); |
| 292 |
|
| 293 |
/* Core file entry points. */ |
| 294 |
#define BFD_JUMP_TABLE_CORE(NAME) \ |
| 295 |
NAME##_core_file_failing_command, \ |
| 296 |
NAME##_core_file_failing_signal, \ |
| 297 |
NAME##_core_file_matches_executable_p, \ |
| 298 |
NAME##_core_file_pid |
| 299 |
|
| 300 |
char * (*_core_file_failing_command) (bfd *); |
| 301 |
int (*_core_file_failing_signal) (bfd *); |
| 302 |
bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); |
| 303 |
int (*_core_file_pid) (bfd *); |
| 304 |
|
| 305 |
/* Archive entry points. */ |
| 306 |
#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ |
| 307 |
NAME##_slurp_armap, \ |
| 308 |
NAME##_slurp_extended_name_table, \ |
| 309 |
NAME##_construct_extended_name_table, \ |
| 310 |
NAME##_truncate_arname, \ |
| 311 |
NAME##_write_armap, \ |
| 312 |
NAME##_read_ar_hdr, \ |
| 313 |
NAME##_write_ar_hdr, \ |
| 314 |
NAME##_openr_next_archived_file, \ |
| 315 |
NAME##_get_elt_at_index, \ |
| 316 |
NAME##_generic_stat_arch_elt, \ |
| 317 |
NAME##_update_armap_timestamp |
| 318 |
|
| 319 |
bfd_boolean (*_bfd_slurp_armap) (bfd *); |
| 320 |
bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); |
| 321 |
bfd_boolean (*_bfd_construct_extended_name_table) (bfd *, char **, |
| 322 |
bfd_size_type *, |
| 323 |
const char **); |
| 324 |
void (*_bfd_truncate_arname) (bfd *, const char *, char *); |
| 325 |
bfd_boolean (*write_armap) (bfd *, unsigned int, struct orl *, |
| 326 |
unsigned int, int); |
| 327 |
void * (*_bfd_read_ar_hdr_fn) (bfd *); |
| 328 |
bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *); |
| 329 |
bfd * (*openr_next_archived_file) (bfd *, bfd *); |
| 330 |
#define bfd_get_elt_at_index(b,i) \ |
| 331 |
BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) |
| 332 |
bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); |
| 333 |
int (*_bfd_stat_arch_elt) (bfd *, struct stat *); |
| 334 |
bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); |
| 335 |
|
| 336 |
/* Entry points used for symbols. */ |
| 337 |
#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ |
| 338 |
NAME##_get_symtab_upper_bound, \ |
| 339 |
NAME##_canonicalize_symtab, \ |
| 340 |
NAME##_make_empty_symbol, \ |
| 341 |
NAME##_print_symbol, \ |
| 342 |
NAME##_get_symbol_info, \ |
| 343 |
NAME##_get_symbol_version_string, \ |
| 344 |
NAME##_bfd_is_local_label_name, \ |
| 345 |
NAME##_bfd_is_target_special_symbol, \ |
| 346 |
NAME##_get_lineno, \ |
| 347 |
NAME##_find_nearest_line, \ |
| 348 |
NAME##_find_line, \ |
| 349 |
NAME##_find_inliner_info, \ |
| 350 |
NAME##_bfd_make_debug_symbol, \ |
| 351 |
NAME##_read_minisymbols, \ |
| 352 |
NAME##_minisymbol_to_symbol |
| 353 |
|
| 354 |
long (*_bfd_get_symtab_upper_bound) (bfd *); |
| 355 |
long (*_bfd_canonicalize_symtab) (bfd *, struct bfd_symbol **); |
| 356 |
struct bfd_symbol * |
| 357 |
(*_bfd_make_empty_symbol) (bfd *); |
| 358 |
void (*_bfd_print_symbol) (bfd *, void *, struct bfd_symbol *, |
| 359 |
bfd_print_symbol_type); |
| 360 |
#define bfd_print_symbol(b,p,s,e) \ |
| 361 |
BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) |
| 362 |
void (*_bfd_get_symbol_info) (bfd *, struct bfd_symbol *, |
| 363 |
symbol_info *); |
| 364 |
#define bfd_get_symbol_info(b,p,e) \ |
| 365 |
BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) |
| 366 |
const char *(*_bfd_get_symbol_version_string) (bfd *, struct bfd_symbol *, |
| 367 |
bfd_boolean, |
| 368 |
bfd_boolean *); |
| 369 |
#define bfd_get_symbol_version_string(b,s,p,h) \ |
| 370 |
BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,p,h)) |
| 371 |
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); |
| 372 |
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); |
| 373 |
alent * (*_get_lineno) (bfd *, struct bfd_symbol *); |
| 374 |
bfd_boolean (*_bfd_find_nearest_line) (bfd *, struct bfd_symbol **, |
| 375 |
struct bfd_section *, bfd_vma, |
| 376 |
const char **, const char **, |
| 377 |
unsigned int *, unsigned int *); |
| 378 |
bfd_boolean (*_bfd_find_line) (bfd *, struct bfd_symbol **, |
| 379 |
struct bfd_symbol *, const char **, |
| 380 |
unsigned int *); |
| 381 |
bfd_boolean (*_bfd_find_inliner_info) |
| 382 |
(bfd *, const char **, const char **, unsigned int *); |
| 383 |
/* Back-door to allow format-aware applications to create debug symbols |
| 384 |
while using BFD for everything else. Currently used by the assembler |
| 385 |
when creating COFF files. */ |
| 386 |
asymbol * (*_bfd_make_debug_symbol) (bfd *, void *, unsigned long size); |
| 387 |
#define bfd_read_minisymbols(b, d, m, s) \ |
| 388 |
BFD_SEND (b, _read_minisymbols, (b, d, m, s)) |
| 389 |
long (*_read_minisymbols) (bfd *, bfd_boolean, void **, |
| 390 |
unsigned int *); |
| 391 |
#define bfd_minisymbol_to_symbol(b, d, m, f) \ |
| 392 |
BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) |
| 393 |
asymbol * (*_minisymbol_to_symbol) (bfd *, bfd_boolean, const void *, |
| 394 |
asymbol *); |
| 395 |
|
| 396 |
/* Routines for relocs. */ |
| 397 |
#define BFD_JUMP_TABLE_RELOCS(NAME) \ |
| 398 |
NAME##_get_reloc_upper_bound, \ |
| 399 |
NAME##_canonicalize_reloc, \ |
| 400 |
NAME##_set_reloc, \ |
| 401 |
NAME##_bfd_reloc_type_lookup, \ |
| 402 |
NAME##_bfd_reloc_name_lookup |
| 403 |
|
| 404 |
long (*_get_reloc_upper_bound) (bfd *, sec_ptr); |
| 405 |
long (*_bfd_canonicalize_reloc) (bfd *, sec_ptr, arelent **, |
| 406 |
struct bfd_symbol **); |
| 407 |
void (*_bfd_set_reloc) (bfd *, sec_ptr, arelent **, unsigned int); |
| 408 |
/* See documentation on reloc types. */ |
| 409 |
reloc_howto_type * |
| 410 |
(*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); |
| 411 |
reloc_howto_type * |
| 412 |
(*reloc_name_lookup) (bfd *, const char *); |
| 413 |
|
| 414 |
/* Routines used when writing an object file. */ |
| 415 |
#define BFD_JUMP_TABLE_WRITE(NAME) \ |
| 416 |
NAME##_set_arch_mach, \ |
| 417 |
NAME##_set_section_contents |
| 418 |
|
| 419 |
bfd_boolean (*_bfd_set_arch_mach) (bfd *, enum bfd_architecture, |
| 420 |
unsigned long); |
| 421 |
bfd_boolean (*_bfd_set_section_contents) (bfd *, sec_ptr, const void *, |
| 422 |
file_ptr, bfd_size_type); |
| 423 |
|
| 424 |
/* Routines used by the linker. */ |
| 425 |
#define BFD_JUMP_TABLE_LINK(NAME) \ |
| 426 |
NAME##_sizeof_headers, \ |
| 427 |
NAME##_bfd_get_relocated_section_contents, \ |
| 428 |
NAME##_bfd_relax_section, \ |
| 429 |
NAME##_bfd_link_hash_table_create, \ |
| 430 |
NAME##_bfd_link_add_symbols, \ |
| 431 |
NAME##_bfd_link_just_syms, \ |
| 432 |
NAME##_bfd_copy_link_hash_symbol_type, \ |
| 433 |
NAME##_bfd_final_link, \ |
| 434 |
NAME##_bfd_link_split_section, \ |
| 435 |
NAME##_bfd_link_check_relocs, \ |
| 436 |
NAME##_bfd_gc_sections, \ |
| 437 |
NAME##_bfd_lookup_section_flags, \ |
| 438 |
NAME##_bfd_merge_sections, \ |
| 439 |
NAME##_bfd_is_group_section, \ |
| 440 |
NAME##_bfd_group_name, \ |
| 441 |
NAME##_bfd_discard_group, \ |
| 442 |
NAME##_section_already_linked, \ |
| 443 |
NAME##_bfd_define_common_symbol, \ |
| 444 |
NAME##_bfd_link_hide_symbol, \ |
| 445 |
NAME##_bfd_define_start_stop |
| 446 |
|
| 447 |
int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); |
| 448 |
bfd_byte * (*_bfd_get_relocated_section_contents) (bfd *, |
| 449 |
struct bfd_link_info *, |
| 450 |
struct bfd_link_order *, |
| 451 |
bfd_byte *, bfd_boolean, |
| 452 |
struct bfd_symbol **); |
| 453 |
|
| 454 |
bfd_boolean (*_bfd_relax_section) (bfd *, struct bfd_section *, |
| 455 |
struct bfd_link_info *, bfd_boolean *); |
| 456 |
|
| 457 |
/* Create a hash table for the linker. Different backends store |
| 458 |
different information in this table. */ |
| 459 |
struct bfd_link_hash_table * |
| 460 |
(*_bfd_link_hash_table_create) (bfd *); |
| 461 |
|
| 462 |
/* Add symbols from this object file into the hash table. */ |
| 463 |
bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); |
| 464 |
|
| 465 |
/* Indicate that we are only retrieving symbol values from this section. */ |
| 466 |
void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); |
| 467 |
|
| 468 |
/* Copy the symbol type and other attributes for a linker script |
| 469 |
assignment of one symbol to another. */ |
| 470 |
#define bfd_copy_link_hash_symbol_type(b, t, f) \ |
| 471 |
BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f)) |
| 472 |
void (*_bfd_copy_link_hash_symbol_type) (bfd *, |
| 473 |
struct bfd_link_hash_entry *, |
| 474 |
struct bfd_link_hash_entry *); |
| 475 |
|
| 476 |
/* Do a link based on the link_order structures attached to each |
| 477 |
section of the BFD. */ |
| 478 |
bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); |
| 479 |
|
| 480 |
/* Should this section be split up into smaller pieces during linking. */ |
| 481 |
bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); |
| 482 |
|
| 483 |
/* Check the relocations in the bfd for validity. */ |
| 484 |
bfd_boolean (* _bfd_link_check_relocs)(bfd *, struct bfd_link_info *); |
| 485 |
|
| 486 |
/* Remove sections that are not referenced from the output. */ |
| 487 |
bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); |
| 488 |
|
| 489 |
/* Sets the bitmask of allowed and disallowed section flags. */ |
| 490 |
bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *, |
| 491 |
struct flag_info *, asection *); |
| 492 |
|
| 493 |
/* Attempt to merge SEC_MERGE sections. */ |
| 494 |
bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); |
| 495 |
|
| 496 |
/* Is this section a member of a group? */ |
| 497 |
bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); |
| 498 |
|
| 499 |
/* The group name, if section is a member of a group. */ |
| 500 |
const char *(*_bfd_group_name) (bfd *, const struct bfd_section *); |
| 501 |
|
| 502 |
/* Discard members of a group. */ |
| 503 |
bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); |
| 504 |
|
| 505 |
/* Check if SEC has been already linked during a reloceatable or |
| 506 |
final link. */ |
| 507 |
bfd_boolean (*_section_already_linked) (bfd *, asection *, |
| 508 |
struct bfd_link_info *); |
| 509 |
|
| 510 |
/* Define a common symbol. */ |
| 511 |
bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *, |
| 512 |
struct bfd_link_hash_entry *); |
| 513 |
|
| 514 |
/* Hide a symbol. */ |
| 515 |
void (*_bfd_link_hide_symbol) (bfd *, struct bfd_link_info *, |
| 516 |
struct bfd_link_hash_entry *); |
| 517 |
|
| 518 |
/* Define a __start, __stop, .startof. or .sizeof. symbol. */ |
| 519 |
struct bfd_link_hash_entry * |
| 520 |
(*_bfd_define_start_stop) (struct bfd_link_info *, const char *, |
| 521 |
asection *); |
| 522 |
|
| 523 |
/* Routines to handle dynamic symbols and relocs. */ |
| 524 |
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ |
| 525 |
NAME##_get_dynamic_symtab_upper_bound, \ |
| 526 |
NAME##_canonicalize_dynamic_symtab, \ |
| 527 |
NAME##_get_synthetic_symtab, \ |
| 528 |
NAME##_get_dynamic_reloc_upper_bound, \ |
| 529 |
NAME##_canonicalize_dynamic_reloc |
| 530 |
|
| 531 |
/* Get the amount of memory required to hold the dynamic symbols. */ |
| 532 |
long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); |
| 533 |
/* Read in the dynamic symbols. */ |
| 534 |
long (*_bfd_canonicalize_dynamic_symtab) (bfd *, struct bfd_symbol **); |
| 535 |
/* Create synthetized symbols. */ |
| 536 |
long (*_bfd_get_synthetic_symtab) (bfd *, long, struct bfd_symbol **, |
| 537 |
long, struct bfd_symbol **, |
| 538 |
struct bfd_symbol **); |
| 539 |
/* Get the amount of memory required to hold the dynamic relocs. */ |
| 540 |
long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); |
| 541 |
/* Read in the dynamic relocs. */ |
| 542 |
long (*_bfd_canonicalize_dynamic_reloc) (bfd *, arelent **, |
| 543 |
struct bfd_symbol **); |
| 544 |
|
| 545 |
@end example |
| 546 |
A pointer to an alternative bfd_target in case the current one is not |
| 547 |
satisfactory. This can happen when the target cpu supports both big |
| 548 |
and little endian code, and target chosen by the linker has the wrong |
| 549 |
endianness. The function open_output() in ld/ldlang.c uses this field |
| 550 |
to find an alternative output format that is suitable. |
| 551 |
@example |
| 552 |
/* Opposite endian version of this target. */ |
| 553 |
const struct bfd_target *alternative_target; |
| 554 |
|
| 555 |
/* Data for use by back-end routines, which isn't |
| 556 |
generic enough to belong in this structure. */ |
| 557 |
const void *backend_data; |
| 558 |
|
| 559 |
@} bfd_target; |
| 560 |
|
| 561 |
static inline const char * |
| 562 |
bfd_get_target (const bfd *abfd) |
| 563 |
@{ |
| 564 |
return abfd->xvec->name; |
| 565 |
@} |
| 566 |
|
| 567 |
static inline enum bfd_flavour |
| 568 |
bfd_get_flavour (const bfd *abfd) |
| 569 |
@{ |
| 570 |
return abfd->xvec->flavour; |
| 571 |
@} |
| 572 |
|
| 573 |
static inline flagword |
| 574 |
bfd_applicable_file_flags (const bfd *abfd) |
| 575 |
@{ |
| 576 |
return abfd->xvec->object_flags; |
| 577 |
@} |
| 578 |
|
| 579 |
static inline bfd_boolean |
| 580 |
bfd_family_coff (const bfd *abfd) |
| 581 |
@{ |
| 582 |
return (bfd_get_flavour (abfd) == bfd_target_coff_flavour |
| 583 |
|| bfd_get_flavour (abfd) == bfd_target_xcoff_flavour); |
| 584 |
@} |
| 585 |
|
| 586 |
static inline bfd_boolean |
| 587 |
bfd_big_endian (const bfd *abfd) |
| 588 |
@{ |
| 589 |
return abfd->xvec->byteorder == BFD_ENDIAN_BIG; |
| 590 |
@} |
| 591 |
static inline bfd_boolean |
| 592 |
bfd_little_endian (const bfd *abfd) |
| 593 |
@{ |
| 594 |
return abfd->xvec->byteorder == BFD_ENDIAN_LITTLE; |
| 595 |
@} |
| 596 |
|
| 597 |
static inline bfd_boolean |
| 598 |
bfd_header_big_endian (const bfd *abfd) |
| 599 |
@{ |
| 600 |
return abfd->xvec->header_byteorder == BFD_ENDIAN_BIG; |
| 601 |
@} |
| 602 |
|
| 603 |
static inline bfd_boolean |
| 604 |
bfd_header_little_endian (const bfd *abfd) |
| 605 |
@{ |
| 606 |
return abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE; |
| 607 |
@} |
| 608 |
|
| 609 |
static inline flagword |
| 610 |
bfd_applicable_section_flags (const bfd *abfd) |
| 611 |
@{ |
| 612 |
return abfd->xvec->section_flags; |
| 613 |
@} |
| 614 |
|
| 615 |
static inline char |
| 616 |
bfd_get_symbol_leading_char (const bfd *abfd) |
| 617 |
@{ |
| 618 |
return abfd->xvec->symbol_leading_char; |
| 619 |
@} |
| 620 |
|
| 621 |
static inline enum bfd_flavour |
| 622 |
bfd_asymbol_flavour (const asymbol *sy) |
| 623 |
@{ |
| 624 |
if ((sy->flags & BSF_SYNTHETIC) != 0) |
| 625 |
return bfd_target_unknown_flavour; |
| 626 |
return sy->the_bfd->xvec->flavour; |
| 627 |
@} |
| 628 |
|
| 629 |
@end example |
| 630 |
|
| 631 |
@findex bfd_set_default_target |
| 632 |
@subsubsection @code{bfd_set_default_target} |
| 633 |
@strong{Synopsis} |
| 634 |
@example |
| 635 |
bfd_boolean bfd_set_default_target (const char *name); |
| 636 |
@end example |
| 637 |
@strong{Description}@* |
| 638 |
Set the default target vector to use when recognizing a BFD. |
| 639 |
This takes the name of the target, which may be a BFD target |
| 640 |
name or a configuration triplet. |
| 641 |
|
| 642 |
@findex bfd_find_target |
| 643 |
@subsubsection @code{bfd_find_target} |
| 644 |
@strong{Synopsis} |
| 645 |
@example |
| 646 |
const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); |
| 647 |
@end example |
| 648 |
@strong{Description}@* |
| 649 |
Return a pointer to the transfer vector for the object target |
| 650 |
named @var{target_name}. If @var{target_name} is @code{NULL}, |
| 651 |
choose the one in the environment variable @code{GNUTARGET}; if |
| 652 |
that is null or not defined, then choose the first entry in the |
| 653 |
target list. Passing in the string "default" or setting the |
| 654 |
environment variable to "default" will cause the first entry in |
| 655 |
the target list to be returned, and "target_defaulted" will be |
| 656 |
set in the BFD if @var{abfd} isn't @code{NULL}. This causes |
| 657 |
@code{bfd_check_format} to loop over all the targets to find the |
| 658 |
one that matches the file being read. |
| 659 |
|
| 660 |
@findex bfd_get_target_info |
| 661 |
@subsubsection @code{bfd_get_target_info} |
| 662 |
@strong{Synopsis} |
| 663 |
@example |
| 664 |
const bfd_target *bfd_get_target_info (const char *target_name, |
| 665 |
bfd *abfd, |
| 666 |
bfd_boolean *is_bigendian, |
| 667 |
int *underscoring, |
| 668 |
const char **def_target_arch); |
| 669 |
@end example |
| 670 |
@strong{Description}@* |
| 671 |
Return a pointer to the transfer vector for the object target |
| 672 |
named @var{target_name}. If @var{target_name} is @code{NULL}, |
| 673 |
choose the one in the environment variable @code{GNUTARGET}; if |
| 674 |
that is null or not defined, then choose the first entry in the |
| 675 |
target list. Passing in the string "default" or setting the |
| 676 |
environment variable to "default" will cause the first entry in |
| 677 |
the target list to be returned, and "target_defaulted" will be |
| 678 |
set in the BFD if @var{abfd} isn't @code{NULL}. This causes |
| 679 |
@code{bfd_check_format} to loop over all the targets to find the |
| 680 |
one that matches the file being read. |
| 681 |
If @var{is_bigendian} is not @code{NULL}, then set this value to target's |
| 682 |
endian mode. True for big-endian, FALSE for little-endian or for |
| 683 |
invalid target. |
| 684 |
If @var{underscoring} is not @code{NULL}, then set this value to target's |
| 685 |
underscoring mode. Zero for none-underscoring, -1 for invalid target, |
| 686 |
else the value of target vector's symbol underscoring. |
| 687 |
If @var{def_target_arch} is not @code{NULL}, then set it to the architecture |
| 688 |
string specified by the target_name. |
| 689 |
|
| 690 |
@findex bfd_target_list |
| 691 |
@subsubsection @code{bfd_target_list} |
| 692 |
@strong{Synopsis} |
| 693 |
@example |
| 694 |
const char ** bfd_target_list (void); |
| 695 |
@end example |
| 696 |
@strong{Description}@* |
| 697 |
Return a freshly malloced NULL-terminated |
| 698 |
vector of the names of all the valid BFD targets. Do not |
| 699 |
modify the names. |
| 700 |
|
| 701 |
@findex bfd_iterate_over_targets |
| 702 |
@subsubsection @code{bfd_iterate_over_targets} |
| 703 |
@strong{Synopsis} |
| 704 |
@example |
| 705 |
const bfd_target *bfd_iterate_over_targets |
| 706 |
(int (*func) (const bfd_target *, void *), |
| 707 |
void *data); |
| 708 |
@end example |
| 709 |
@strong{Description}@* |
| 710 |
Call @var{func} for each target in the list of BFD target |
| 711 |
vectors, passing @var{data} to @var{func}. Stop iterating if |
| 712 |
@var{func} returns a non-zero result, and return that target |
| 713 |
vector. Return NULL if @var{func} always returns zero. |
| 714 |
|
| 715 |
@findex bfd_flavour_name |
| 716 |
@subsubsection @code{bfd_flavour_name} |
| 717 |
@strong{Synopsis} |
| 718 |
@example |
| 719 |
const char *bfd_flavour_name (enum bfd_flavour flavour); |
| 720 |
@end example |
| 721 |
@strong{Description}@* |
| 722 |
Return the string form of @var{flavour}. |
| 723 |
|