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