| 1 | @section @code{typedef bfd}
|
|---|
| 2 | A BFD has type @code{bfd}; objects of this type are the
|
|---|
| 3 | cornerstone of any application using BFD. Using BFD
|
|---|
| 4 | consists of making references though the BFD and to data in the BFD.
|
|---|
| 5 |
|
|---|
| 6 | Here is the structure that defines the type @code{bfd}. It
|
|---|
| 7 | contains the major data about the file and pointers
|
|---|
| 8 | to the rest of the data.
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | @example
|
|---|
| 12 |
|
|---|
| 13 | struct bfd
|
|---|
| 14 | @{
|
|---|
| 15 | /* A unique identifier of the BFD */
|
|---|
| 16 | unsigned int id;
|
|---|
| 17 |
|
|---|
| 18 | /* The filename the application opened the BFD with. */
|
|---|
| 19 | const char *filename;
|
|---|
| 20 |
|
|---|
| 21 | /* A pointer to the target jump table. */
|
|---|
| 22 | const struct bfd_target *xvec;
|
|---|
| 23 |
|
|---|
| 24 | /* To avoid dragging too many header files into every file that
|
|---|
| 25 | includes `@code{bfd.h}', IOSTREAM has been declared as a "char *",
|
|---|
| 26 | and MTIME as a "long". Their correct types, to which they
|
|---|
| 27 | are cast when used, are "FILE *" and "time_t". The iostream
|
|---|
| 28 | is the result of an fopen on the filename. However, if the
|
|---|
| 29 | BFD_IN_MEMORY flag is set, then iostream is actually a pointer
|
|---|
| 30 | to a bfd_in_memory struct. */
|
|---|
| 31 | PTR iostream;
|
|---|
| 32 |
|
|---|
| 33 | /* Is the file descriptor being cached? That is, can it be closed as
|
|---|
| 34 | needed, and re-opened when accessed later? */
|
|---|
| 35 | bfd_boolean cacheable;
|
|---|
| 36 |
|
|---|
| 37 | /* Marks whether there was a default target specified when the
|
|---|
| 38 | BFD was opened. This is used to select which matching algorithm
|
|---|
| 39 | to use to choose the back end. */
|
|---|
| 40 | bfd_boolean target_defaulted;
|
|---|
| 41 |
|
|---|
| 42 | /* The caching routines use these to maintain a
|
|---|
| 43 | least-recently-used list of BFDs. */
|
|---|
| 44 | struct bfd *lru_prev, *lru_next;
|
|---|
| 45 |
|
|---|
| 46 | /* When a file is closed by the caching routines, BFD retains
|
|---|
| 47 | state information on the file here... */
|
|---|
| 48 | ufile_ptr where;
|
|---|
| 49 |
|
|---|
| 50 | /* ... and here: (``once'' means at least once). */
|
|---|
| 51 | bfd_boolean opened_once;
|
|---|
| 52 |
|
|---|
| 53 | /* Set if we have a locally maintained mtime value, rather than
|
|---|
| 54 | getting it from the file each time. */
|
|---|
| 55 | bfd_boolean mtime_set;
|
|---|
| 56 |
|
|---|
| 57 | /* File modified time, if mtime_set is TRUE. */
|
|---|
| 58 | long mtime;
|
|---|
| 59 |
|
|---|
| 60 | /* Reserved for an unimplemented file locking extension. */
|
|---|
| 61 | int ifd;
|
|---|
| 62 |
|
|---|
| 63 | /* The format which belongs to the BFD. (object, core, etc.) */
|
|---|
| 64 | bfd_format format;
|
|---|
| 65 |
|
|---|
| 66 | /* The direction with which the BFD was opened. */
|
|---|
| 67 | enum bfd_direction
|
|---|
| 68 | @{
|
|---|
| 69 | no_direction = 0,
|
|---|
| 70 | read_direction = 1,
|
|---|
| 71 | write_direction = 2,
|
|---|
| 72 | both_direction = 3
|
|---|
| 73 | @}
|
|---|
| 74 | direction;
|
|---|
| 75 |
|
|---|
| 76 | /* Format_specific flags. */
|
|---|
| 77 | flagword flags;
|
|---|
| 78 |
|
|---|
| 79 | /* Currently my_archive is tested before adding origin to
|
|---|
| 80 | anything. I believe that this can become always an add of
|
|---|
| 81 | origin, with origin set to 0 for non archive files. */
|
|---|
| 82 | ufile_ptr origin;
|
|---|
| 83 |
|
|---|
| 84 | /* Remember when output has begun, to stop strange things
|
|---|
| 85 | from happening. */
|
|---|
| 86 | bfd_boolean output_has_begun;
|
|---|
| 87 |
|
|---|
| 88 | /* A hash table for section names. */
|
|---|
| 89 | struct bfd_hash_table section_htab;
|
|---|
| 90 |
|
|---|
| 91 | /* Pointer to linked list of sections. */
|
|---|
| 92 | struct sec *sections;
|
|---|
| 93 |
|
|---|
| 94 | /* The place where we add to the section list. */
|
|---|
| 95 | struct sec **section_tail;
|
|---|
| 96 |
|
|---|
| 97 | /* The number of sections. */
|
|---|
| 98 | unsigned int section_count;
|
|---|
| 99 |
|
|---|
| 100 | /* Stuff only useful for object files:
|
|---|
| 101 | The start address. */
|
|---|
| 102 | bfd_vma start_address;
|
|---|
| 103 |
|
|---|
| 104 | /* Used for input and output. */
|
|---|
| 105 | unsigned int symcount;
|
|---|
| 106 |
|
|---|
| 107 | /* Symbol table for output BFD (with symcount entries). */
|
|---|
| 108 | struct symbol_cache_entry **outsymbols;
|
|---|
| 109 |
|
|---|
| 110 | /* Used for slurped dynamic symbol tables. */
|
|---|
| 111 | unsigned int dynsymcount;
|
|---|
| 112 |
|
|---|
| 113 | /* Pointer to structure which contains architecture information. */
|
|---|
| 114 | const struct bfd_arch_info *arch_info;
|
|---|
| 115 |
|
|---|
| 116 | /* Stuff only useful for archives. */
|
|---|
| 117 | PTR arelt_data;
|
|---|
| 118 | struct bfd *my_archive; /* The containing archive BFD. */
|
|---|
| 119 | struct bfd *next; /* The next BFD in the archive. */
|
|---|
| 120 | struct bfd *archive_head; /* The first BFD in the archive. */
|
|---|
| 121 | bfd_boolean has_armap;
|
|---|
| 122 |
|
|---|
| 123 | /* A chain of BFD structures involved in a link. */
|
|---|
| 124 | struct bfd *link_next;
|
|---|
| 125 |
|
|---|
| 126 | /* A field used by _bfd_generic_link_add_archive_symbols. This will
|
|---|
| 127 | be used only for archive elements. */
|
|---|
| 128 | int archive_pass;
|
|---|
| 129 |
|
|---|
| 130 | /* Used by the back end to hold private data. */
|
|---|
| 131 | union
|
|---|
| 132 | @{
|
|---|
| 133 | struct aout_data_struct *aout_data;
|
|---|
| 134 | struct artdata *aout_ar_data;
|
|---|
| 135 | struct _oasys_data *oasys_obj_data;
|
|---|
| 136 | struct _oasys_ar_data *oasys_ar_data;
|
|---|
| 137 | struct coff_tdata *coff_obj_data;
|
|---|
| 138 | struct pe_tdata *pe_obj_data;
|
|---|
| 139 | struct xcoff_tdata *xcoff_obj_data;
|
|---|
| 140 | struct ecoff_tdata *ecoff_obj_data;
|
|---|
| 141 | struct ieee_data_struct *ieee_data;
|
|---|
| 142 | struct ieee_ar_data_struct *ieee_ar_data;
|
|---|
| 143 | struct srec_data_struct *srec_data;
|
|---|
| 144 | struct ihex_data_struct *ihex_data;
|
|---|
| 145 | struct tekhex_data_struct *tekhex_data;
|
|---|
| 146 | struct elf_obj_tdata *elf_obj_data;
|
|---|
| 147 | struct nlm_obj_tdata *nlm_obj_data;
|
|---|
| 148 | struct bout_data_struct *bout_data;
|
|---|
| 149 | struct mmo_data_struct *mmo_data;
|
|---|
| 150 | struct sun_core_struct *sun_core_data;
|
|---|
| 151 | struct sco5_core_struct *sco5_core_data;
|
|---|
| 152 | struct trad_core_struct *trad_core_data;
|
|---|
| 153 | struct som_data_struct *som_data;
|
|---|
| 154 | struct hpux_core_struct *hpux_core_data;
|
|---|
| 155 | struct hppabsd_core_struct *hppabsd_core_data;
|
|---|
| 156 | struct sgi_core_struct *sgi_core_data;
|
|---|
| 157 | struct lynx_core_struct *lynx_core_data;
|
|---|
| 158 | struct osf_core_struct *osf_core_data;
|
|---|
| 159 | struct cisco_core_struct *cisco_core_data;
|
|---|
| 160 | struct versados_data_struct *versados_data;
|
|---|
| 161 | struct netbsd_core_struct *netbsd_core_data;
|
|---|
| 162 | struct mach_o_data_struct *mach_o_data;
|
|---|
| 163 | struct mach_o_fat_data_struct *mach_o_fat_data;
|
|---|
| 164 | struct bfd_pef_data_struct *pef_data;
|
|---|
| 165 | struct bfd_pef_xlib_data_struct *pef_xlib_data;
|
|---|
| 166 | struct bfd_sym_data_struct *sym_data;
|
|---|
| 167 | PTR any;
|
|---|
| 168 | @}
|
|---|
| 169 | tdata;
|
|---|
| 170 |
|
|---|
| 171 | /* Used by the application to hold private data. */
|
|---|
| 172 | PTR usrdata;
|
|---|
| 173 |
|
|---|
| 174 | /* Where all the allocated stuff under this BFD goes. This is a
|
|---|
| 175 | struct objalloc *, but we use PTR to avoid requiring the inclusion of
|
|---|
| 176 | objalloc.h. */
|
|---|
| 177 | PTR memory;
|
|---|
| 178 | @};
|
|---|
| 179 |
|
|---|
| 180 | @end example
|
|---|
| 181 | @section Error reporting
|
|---|
| 182 | Most BFD functions return nonzero on success (check their
|
|---|
| 183 | individual documentation for precise semantics). On an error,
|
|---|
| 184 | they call @code{bfd_set_error} to set an error condition that callers
|
|---|
| 185 | can check by calling @code{bfd_get_error}.
|
|---|
| 186 | If that returns @code{bfd_error_system_call}, then check
|
|---|
| 187 | @code{errno}.
|
|---|
| 188 |
|
|---|
| 189 | The easiest way to report a BFD error to the user is to
|
|---|
| 190 | use @code{bfd_perror}.
|
|---|
| 191 |
|
|---|
| 192 | @subsection Type @code{bfd_error_type}
|
|---|
| 193 | The values returned by @code{bfd_get_error} are defined by the
|
|---|
| 194 | enumerated type @code{bfd_error_type}.
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 | @example
|
|---|
| 198 |
|
|---|
| 199 | typedef enum bfd_error
|
|---|
| 200 | @{
|
|---|
| 201 | bfd_error_no_error = 0,
|
|---|
| 202 | bfd_error_system_call,
|
|---|
| 203 | bfd_error_invalid_target,
|
|---|
| 204 | bfd_error_wrong_format,
|
|---|
| 205 | bfd_error_wrong_object_format,
|
|---|
| 206 | bfd_error_invalid_operation,
|
|---|
| 207 | bfd_error_no_memory,
|
|---|
| 208 | bfd_error_no_symbols,
|
|---|
| 209 | bfd_error_no_armap,
|
|---|
| 210 | bfd_error_no_more_archived_files,
|
|---|
| 211 | bfd_error_malformed_archive,
|
|---|
| 212 | bfd_error_file_not_recognized,
|
|---|
| 213 | bfd_error_file_ambiguously_recognized,
|
|---|
| 214 | bfd_error_no_contents,
|
|---|
| 215 | bfd_error_nonrepresentable_section,
|
|---|
| 216 | bfd_error_no_debug_section,
|
|---|
| 217 | bfd_error_bad_value,
|
|---|
| 218 | bfd_error_file_truncated,
|
|---|
| 219 | bfd_error_file_too_big,
|
|---|
| 220 | bfd_error_invalid_error_code
|
|---|
| 221 | @}
|
|---|
| 222 | bfd_error_type;
|
|---|
| 223 |
|
|---|
| 224 | @end example
|
|---|
| 225 | @findex bfd_get_error
|
|---|
| 226 | @subsubsection @code{bfd_get_error}
|
|---|
| 227 | @strong{Synopsis}
|
|---|
| 228 | @example
|
|---|
| 229 | bfd_error_type bfd_get_error (void);
|
|---|
| 230 | @end example
|
|---|
| 231 | @strong{Description}@*
|
|---|
| 232 | Return the current BFD error condition.
|
|---|
| 233 |
|
|---|
| 234 | @findex bfd_set_error
|
|---|
| 235 | @subsubsection @code{bfd_set_error}
|
|---|
| 236 | @strong{Synopsis}
|
|---|
| 237 | @example
|
|---|
| 238 | void bfd_set_error (bfd_error_type error_tag);
|
|---|
| 239 | @end example
|
|---|
| 240 | @strong{Description}@*
|
|---|
| 241 | Set the BFD error condition to be @var{error_tag}.
|
|---|
| 242 |
|
|---|
| 243 | @findex bfd_errmsg
|
|---|
| 244 | @subsubsection @code{bfd_errmsg}
|
|---|
| 245 | @strong{Synopsis}
|
|---|
| 246 | @example
|
|---|
| 247 | const char *bfd_errmsg (bfd_error_type error_tag);
|
|---|
| 248 | @end example
|
|---|
| 249 | @strong{Description}@*
|
|---|
| 250 | Return a string describing the error @var{error_tag}, or
|
|---|
| 251 | the system error if @var{error_tag} is @code{bfd_error_system_call}.
|
|---|
| 252 |
|
|---|
| 253 | @findex bfd_perror
|
|---|
| 254 | @subsubsection @code{bfd_perror}
|
|---|
| 255 | @strong{Synopsis}
|
|---|
| 256 | @example
|
|---|
| 257 | void bfd_perror (const char *message);
|
|---|
| 258 | @end example
|
|---|
| 259 | @strong{Description}@*
|
|---|
| 260 | Print to the standard error stream a string describing the
|
|---|
| 261 | last BFD error that occurred, or the last system error if
|
|---|
| 262 | the last BFD error was a system call failure. If @var{message}
|
|---|
| 263 | is non-NULL and non-empty, the error string printed is preceded
|
|---|
| 264 | by @var{message}, a colon, and a space. It is followed by a newline.
|
|---|
| 265 |
|
|---|
| 266 | @subsection BFD error handler
|
|---|
| 267 | Some BFD functions want to print messages describing the
|
|---|
| 268 | problem. They call a BFD error handler function. This
|
|---|
| 269 | function may be overriden by the program.
|
|---|
| 270 |
|
|---|
| 271 | The BFD error handler acts like printf.
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 | @example
|
|---|
| 275 |
|
|---|
| 276 | typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
|
|---|
| 277 |
|
|---|
| 278 | @end example
|
|---|
| 279 | @findex bfd_set_error_handler
|
|---|
| 280 | @subsubsection @code{bfd_set_error_handler}
|
|---|
| 281 | @strong{Synopsis}
|
|---|
| 282 | @example
|
|---|
| 283 | bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
|
|---|
| 284 | @end example
|
|---|
| 285 | @strong{Description}@*
|
|---|
| 286 | Set the BFD error handler function. Returns the previous
|
|---|
| 287 | function.
|
|---|
| 288 |
|
|---|
| 289 | @findex bfd_set_error_program_name
|
|---|
| 290 | @subsubsection @code{bfd_set_error_program_name}
|
|---|
| 291 | @strong{Synopsis}
|
|---|
| 292 | @example
|
|---|
| 293 | void bfd_set_error_program_name (const char *);
|
|---|
| 294 | @end example
|
|---|
| 295 | @strong{Description}@*
|
|---|
| 296 | Set the program name to use when printing a BFD error. This
|
|---|
| 297 | is printed before the error message followed by a colon and
|
|---|
| 298 | space. The string must not be changed after it is passed to
|
|---|
| 299 | this function.
|
|---|
| 300 |
|
|---|
| 301 | @findex bfd_get_error_handler
|
|---|
| 302 | @subsubsection @code{bfd_get_error_handler}
|
|---|
| 303 | @strong{Synopsis}
|
|---|
| 304 | @example
|
|---|
| 305 | bfd_error_handler_type bfd_get_error_handler (void);
|
|---|
| 306 | @end example
|
|---|
| 307 | @strong{Description}@*
|
|---|
| 308 | Return the BFD error handler function.
|
|---|
| 309 |
|
|---|
| 310 | @findex bfd_archive_filename
|
|---|
| 311 | @subsubsection @code{bfd_archive_filename}
|
|---|
| 312 | @strong{Synopsis}
|
|---|
| 313 | @example
|
|---|
| 314 | const char *bfd_archive_filename (bfd *);
|
|---|
| 315 | @end example
|
|---|
| 316 | @strong{Description}@*
|
|---|
| 317 | For a BFD that is a component of an archive, returns a string
|
|---|
| 318 | with both the archive name and file name. For other BFDs, just
|
|---|
| 319 | returns the file name.
|
|---|
| 320 |
|
|---|
| 321 | @section Symbols
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 | @findex bfd_get_reloc_upper_bound
|
|---|
| 325 | @subsubsection @code{bfd_get_reloc_upper_bound}
|
|---|
| 326 | @strong{Synopsis}
|
|---|
| 327 | @example
|
|---|
| 328 | long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
|
|---|
| 329 | @end example
|
|---|
| 330 | @strong{Description}@*
|
|---|
| 331 | Return the number of bytes required to store the
|
|---|
| 332 | relocation information associated with section @var{sect}
|
|---|
| 333 | attached to bfd @var{abfd}. If an error occurs, return -1.
|
|---|
| 334 |
|
|---|
| 335 | @findex bfd_canonicalize_reloc
|
|---|
| 336 | @subsubsection @code{bfd_canonicalize_reloc}
|
|---|
| 337 | @strong{Synopsis}
|
|---|
| 338 | @example
|
|---|
| 339 | long bfd_canonicalize_reloc
|
|---|
| 340 | (bfd *abfd,
|
|---|
| 341 | asection *sec,
|
|---|
| 342 | arelent **loc,
|
|---|
| 343 | asymbol **syms);
|
|---|
| 344 | @end example
|
|---|
| 345 | @strong{Description}@*
|
|---|
| 346 | Call the back end associated with the open BFD
|
|---|
| 347 | @var{abfd} and translate the external form of the relocation
|
|---|
| 348 | information attached to @var{sec} into the internal canonical
|
|---|
| 349 | form. Place the table into memory at @var{loc}, which has
|
|---|
| 350 | been preallocated, usually by a call to
|
|---|
| 351 | @code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
|
|---|
| 352 | -1 on error.
|
|---|
| 353 |
|
|---|
| 354 | The @var{syms} table is also needed for horrible internal magic
|
|---|
| 355 | reasons.
|
|---|
| 356 |
|
|---|
| 357 | @findex bfd_set_reloc
|
|---|
| 358 | @subsubsection @code{bfd_set_reloc}
|
|---|
| 359 | @strong{Synopsis}
|
|---|
| 360 | @example
|
|---|
| 361 | void bfd_set_reloc
|
|---|
| 362 | (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
|
|---|
| 363 | @end example
|
|---|
| 364 | @strong{Description}@*
|
|---|
| 365 | Set the relocation pointer and count within
|
|---|
| 366 | section @var{sec} to the values @var{rel} and @var{count}.
|
|---|
| 367 | The argument @var{abfd} is ignored.
|
|---|
| 368 |
|
|---|
| 369 | @findex bfd_set_file_flags
|
|---|
| 370 | @subsubsection @code{bfd_set_file_flags}
|
|---|
| 371 | @strong{Synopsis}
|
|---|
| 372 | @example
|
|---|
| 373 | bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
|
|---|
| 374 | @end example
|
|---|
| 375 | @strong{Description}@*
|
|---|
| 376 | Set the flag word in the BFD @var{abfd} to the value @var{flags}.
|
|---|
| 377 |
|
|---|
| 378 | Possible errors are:
|
|---|
| 379 | @itemize @bullet
|
|---|
| 380 |
|
|---|
| 381 | @item
|
|---|
| 382 | @code{bfd_error_wrong_format} - The target bfd was not of object format.
|
|---|
| 383 | @item
|
|---|
| 384 | @code{bfd_error_invalid_operation} - The target bfd was open for reading.
|
|---|
| 385 | @item
|
|---|
| 386 | @code{bfd_error_invalid_operation} -
|
|---|
| 387 | The flag word contained a bit which was not applicable to the
|
|---|
| 388 | type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
|
|---|
| 389 | on a BFD format which does not support demand paging.
|
|---|
| 390 | @end itemize
|
|---|
| 391 |
|
|---|
| 392 | @findex bfd_get_arch_size
|
|---|
| 393 | @subsubsection @code{bfd_get_arch_size}
|
|---|
| 394 | @strong{Synopsis}
|
|---|
| 395 | @example
|
|---|
| 396 | int bfd_get_arch_size (bfd *abfd);
|
|---|
| 397 | @end example
|
|---|
| 398 | @strong{Description}@*
|
|---|
| 399 | Returns the architecture address size, in bits, as determined
|
|---|
| 400 | by the object file's format. For ELF, this information is
|
|---|
| 401 | included in the header.
|
|---|
| 402 |
|
|---|
| 403 | @strong{Returns}@*
|
|---|
| 404 | Returns the arch size in bits if known, @code{-1} otherwise.
|
|---|
| 405 |
|
|---|
| 406 | @findex bfd_get_sign_extend_vma
|
|---|
| 407 | @subsubsection @code{bfd_get_sign_extend_vma}
|
|---|
| 408 | @strong{Synopsis}
|
|---|
| 409 | @example
|
|---|
| 410 | int bfd_get_sign_extend_vma (bfd *abfd);
|
|---|
| 411 | @end example
|
|---|
| 412 | @strong{Description}@*
|
|---|
| 413 | Indicates if the target architecture "naturally" sign extends
|
|---|
| 414 | an address. Some architectures implicitly sign extend address
|
|---|
| 415 | values when they are converted to types larger than the size
|
|---|
| 416 | of an address. For instance, bfd_get_start_address() will
|
|---|
| 417 | return an address sign extended to fill a bfd_vma when this is
|
|---|
| 418 | the case.
|
|---|
| 419 |
|
|---|
| 420 | @strong{Returns}@*
|
|---|
| 421 | Returns @code{1} if the target architecture is known to sign
|
|---|
| 422 | extend addresses, @code{0} if the target architecture is known to
|
|---|
| 423 | not sign extend addresses, and @code{-1} otherwise.
|
|---|
| 424 |
|
|---|
| 425 | @findex bfd_set_start_address
|
|---|
| 426 | @subsubsection @code{bfd_set_start_address}
|
|---|
| 427 | @strong{Synopsis}
|
|---|
| 428 | @example
|
|---|
| 429 | bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
|
|---|
| 430 | @end example
|
|---|
| 431 | @strong{Description}@*
|
|---|
| 432 | Make @var{vma} the entry point of output BFD @var{abfd}.
|
|---|
| 433 |
|
|---|
| 434 | @strong{Returns}@*
|
|---|
| 435 | Returns @code{TRUE} on success, @code{FALSE} otherwise.
|
|---|
| 436 |
|
|---|
| 437 | @findex bfd_get_gp_size
|
|---|
| 438 | @subsubsection @code{bfd_get_gp_size}
|
|---|
| 439 | @strong{Synopsis}
|
|---|
| 440 | @example
|
|---|
| 441 | unsigned int bfd_get_gp_size (bfd *abfd);
|
|---|
| 442 | @end example
|
|---|
| 443 | @strong{Description}@*
|
|---|
| 444 | Return the maximum size of objects to be optimized using the GP
|
|---|
| 445 | register under MIPS ECOFF. This is typically set by the @code{-G}
|
|---|
| 446 | argument to the compiler, assembler or linker.
|
|---|
| 447 |
|
|---|
| 448 | @findex bfd_set_gp_size
|
|---|
| 449 | @subsubsection @code{bfd_set_gp_size}
|
|---|
| 450 | @strong{Synopsis}
|
|---|
| 451 | @example
|
|---|
| 452 | void bfd_set_gp_size (bfd *abfd, unsigned int i);
|
|---|
| 453 | @end example
|
|---|
| 454 | @strong{Description}@*
|
|---|
| 455 | Set the maximum size of objects to be optimized using the GP
|
|---|
| 456 | register under ECOFF or MIPS ELF. This is typically set by
|
|---|
| 457 | the @code{-G} argument to the compiler, assembler or linker.
|
|---|
| 458 |
|
|---|
| 459 | @findex bfd_scan_vma
|
|---|
| 460 | @subsubsection @code{bfd_scan_vma}
|
|---|
| 461 | @strong{Synopsis}
|
|---|
| 462 | @example
|
|---|
| 463 | bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
|
|---|
| 464 | @end example
|
|---|
| 465 | @strong{Description}@*
|
|---|
| 466 | Convert, like @code{strtoul}, a numerical expression
|
|---|
| 467 | @var{string} into a @code{bfd_vma} integer, and return that integer.
|
|---|
| 468 | (Though without as many bells and whistles as @code{strtoul}.)
|
|---|
| 469 | The expression is assumed to be unsigned (i.e., positive).
|
|---|
| 470 | If given a @var{base}, it is used as the base for conversion.
|
|---|
| 471 | A base of 0 causes the function to interpret the string
|
|---|
| 472 | in hex if a leading "0x" or "0X" is found, otherwise
|
|---|
| 473 | in octal if a leading zero is found, otherwise in decimal.
|
|---|
| 474 |
|
|---|
| 475 | If the value would overflow, the maximum @code{bfd_vma} value is
|
|---|
| 476 | returned.
|
|---|
| 477 |
|
|---|
| 478 | @findex bfd_copy_private_bfd_data
|
|---|
| 479 | @subsubsection @code{bfd_copy_private_bfd_data}
|
|---|
| 480 | @strong{Synopsis}
|
|---|
| 481 | @example
|
|---|
| 482 | bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
|
|---|
| 483 | @end example
|
|---|
| 484 | @strong{Description}@*
|
|---|
| 485 | Copy private BFD information from the BFD @var{ibfd} to the
|
|---|
| 486 | the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error.
|
|---|
| 487 | Possible error returns are:
|
|---|
| 488 |
|
|---|
| 489 | @itemize @bullet
|
|---|
| 490 |
|
|---|
| 491 | @item
|
|---|
| 492 | @code{bfd_error_no_memory} -
|
|---|
| 493 | Not enough memory exists to create private data for @var{obfd}.
|
|---|
| 494 | @end itemize
|
|---|
| 495 | @example
|
|---|
| 496 | #define bfd_copy_private_bfd_data(ibfd, obfd) \
|
|---|
| 497 | BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
|
|---|
| 498 | (ibfd, obfd))
|
|---|
| 499 | @end example
|
|---|
| 500 |
|
|---|
| 501 | @findex bfd_merge_private_bfd_data
|
|---|
| 502 | @subsubsection @code{bfd_merge_private_bfd_data}
|
|---|
| 503 | @strong{Synopsis}
|
|---|
| 504 | @example
|
|---|
| 505 | bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
|
|---|
| 506 | @end example
|
|---|
| 507 | @strong{Description}@*
|
|---|
| 508 | Merge private BFD information from the BFD @var{ibfd} to the
|
|---|
| 509 | the output file BFD @var{obfd} when linking. Return @code{TRUE}
|
|---|
| 510 | on success, @code{FALSE} on error. Possible error returns are:
|
|---|
| 511 |
|
|---|
| 512 | @itemize @bullet
|
|---|
| 513 |
|
|---|
| 514 | @item
|
|---|
| 515 | @code{bfd_error_no_memory} -
|
|---|
| 516 | Not enough memory exists to create private data for @var{obfd}.
|
|---|
| 517 | @end itemize
|
|---|
| 518 | @example
|
|---|
| 519 | #define bfd_merge_private_bfd_data(ibfd, obfd) \
|
|---|
| 520 | BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
|
|---|
| 521 | (ibfd, obfd))
|
|---|
| 522 | @end example
|
|---|
| 523 |
|
|---|
| 524 | @findex bfd_set_private_flags
|
|---|
| 525 | @subsubsection @code{bfd_set_private_flags}
|
|---|
| 526 | @strong{Synopsis}
|
|---|
| 527 | @example
|
|---|
| 528 | bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
|
|---|
| 529 | @end example
|
|---|
| 530 | @strong{Description}@*
|
|---|
| 531 | Set private BFD flag information in the BFD @var{abfd}.
|
|---|
| 532 | Return @code{TRUE} on success, @code{FALSE} on error. Possible error
|
|---|
| 533 | returns are:
|
|---|
| 534 |
|
|---|
| 535 | @itemize @bullet
|
|---|
| 536 |
|
|---|
| 537 | @item
|
|---|
| 538 | @code{bfd_error_no_memory} -
|
|---|
| 539 | Not enough memory exists to create private data for @var{obfd}.
|
|---|
| 540 | @end itemize
|
|---|
| 541 | @example
|
|---|
| 542 | #define bfd_set_private_flags(abfd, flags) \
|
|---|
| 543 | BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
|
|---|
| 544 | @end example
|
|---|
| 545 |
|
|---|
| 546 | @findex Other functions
|
|---|
| 547 | @subsubsection @code{Other functions}
|
|---|
| 548 | @strong{Description}@*
|
|---|
| 549 | The following functions exist but have not yet been documented.
|
|---|
| 550 | @example
|
|---|
| 551 | #define bfd_sizeof_headers(abfd, reloc) \
|
|---|
| 552 | BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
|
|---|
| 553 |
|
|---|
| 554 | #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
|
|---|
| 555 | BFD_SEND (abfd, _bfd_find_nearest_line, \
|
|---|
| 556 | (abfd, sec, syms, off, file, func, line))
|
|---|
| 557 |
|
|---|
| 558 | #define bfd_debug_info_start(abfd) \
|
|---|
| 559 | BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
|
|---|
| 560 |
|
|---|
| 561 | #define bfd_debug_info_end(abfd) \
|
|---|
| 562 | BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
|
|---|
| 563 |
|
|---|
| 564 | #define bfd_debug_info_accumulate(abfd, section) \
|
|---|
| 565 | BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
|
|---|
| 566 |
|
|---|
| 567 | #define bfd_stat_arch_elt(abfd, stat) \
|
|---|
| 568 | BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
|
|---|
| 569 |
|
|---|
| 570 | #define bfd_update_armap_timestamp(abfd) \
|
|---|
| 571 | BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
|
|---|
| 572 |
|
|---|
| 573 | #define bfd_set_arch_mach(abfd, arch, mach)\
|
|---|
| 574 | BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
|
|---|
| 575 |
|
|---|
| 576 | #define bfd_relax_section(abfd, section, link_info, again) \
|
|---|
| 577 | BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
|---|
| 578 |
|
|---|
| 579 | #define bfd_gc_sections(abfd, link_info) \
|
|---|
| 580 | BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
|
|---|
| 581 |
|
|---|
| 582 | #define bfd_merge_sections(abfd, link_info) \
|
|---|
| 583 | BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
|
|---|
| 584 |
|
|---|
| 585 | #define bfd_discard_group(abfd, sec) \
|
|---|
| 586 | BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
|
|---|
| 587 |
|
|---|
| 588 | #define bfd_link_hash_table_create(abfd) \
|
|---|
| 589 | BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
|---|
| 590 |
|
|---|
| 591 | #define bfd_link_hash_table_free(abfd, hash) \
|
|---|
| 592 | BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
|
|---|
| 593 |
|
|---|
| 594 | #define bfd_link_add_symbols(abfd, info) \
|
|---|
| 595 | BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
|
|---|
| 596 |
|
|---|
| 597 | #define bfd_link_just_syms(sec, info) \
|
|---|
| 598 | BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
|
|---|
| 599 |
|
|---|
| 600 | #define bfd_final_link(abfd, info) \
|
|---|
| 601 | BFD_SEND (abfd, _bfd_final_link, (abfd, info))
|
|---|
| 602 |
|
|---|
| 603 | #define bfd_free_cached_info(abfd) \
|
|---|
| 604 | BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
|
|---|
| 605 |
|
|---|
| 606 | #define bfd_get_dynamic_symtab_upper_bound(abfd) \
|
|---|
| 607 | BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
|
|---|
| 608 |
|
|---|
| 609 | #define bfd_print_private_bfd_data(abfd, file)\
|
|---|
| 610 | BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
|
|---|
| 611 |
|
|---|
| 612 | #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
|
|---|
| 613 | BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
|
|---|
| 614 |
|
|---|
| 615 | #define bfd_get_dynamic_reloc_upper_bound(abfd) \
|
|---|
| 616 | BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
|
|---|
| 617 |
|
|---|
| 618 | #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
|
|---|
| 619 | BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
|
|---|
| 620 |
|
|---|
| 621 | extern bfd_byte *bfd_get_relocated_section_contents
|
|---|
| 622 | PARAMS ((bfd *, struct bfd_link_info *,
|
|---|
| 623 | struct bfd_link_order *, bfd_byte *,
|
|---|
| 624 | bfd_boolean, asymbol **));
|
|---|
| 625 |
|
|---|
| 626 | @end example
|
|---|
| 627 |
|
|---|
| 628 | @findex bfd_alt_mach_code
|
|---|
| 629 | @subsubsection @code{bfd_alt_mach_code}
|
|---|
| 630 | @strong{Synopsis}
|
|---|
| 631 | @example
|
|---|
| 632 | bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
|
|---|
| 633 | @end example
|
|---|
| 634 | @strong{Description}@*
|
|---|
| 635 | When more than one machine code number is available for the
|
|---|
| 636 | same machine type, this function can be used to switch between
|
|---|
| 637 | the preferred one (alternative == 0) and any others. Currently,
|
|---|
| 638 | only ELF supports this feature, with up to two alternate
|
|---|
| 639 | machine codes.
|
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 | @example
|
|---|
| 643 | struct bfd_preserve
|
|---|
| 644 | @{
|
|---|
| 645 | PTR marker;
|
|---|
| 646 | PTR tdata;
|
|---|
| 647 | flagword flags;
|
|---|
| 648 | const struct bfd_arch_info *arch_info;
|
|---|
| 649 | struct sec *sections;
|
|---|
| 650 | struct sec **section_tail;
|
|---|
| 651 | unsigned int section_count;
|
|---|
| 652 | struct bfd_hash_table section_htab;
|
|---|
| 653 | @};
|
|---|
| 654 |
|
|---|
| 655 | @end example
|
|---|
| 656 | @findex bfd_preserve_save
|
|---|
| 657 | @subsubsection @code{bfd_preserve_save}
|
|---|
| 658 | @strong{Synopsis}
|
|---|
| 659 | @example
|
|---|
| 660 | bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
|
|---|
| 661 | @end example
|
|---|
| 662 | @strong{Description}@*
|
|---|
| 663 | When testing an object for compatibility with a particular
|
|---|
| 664 | target back-end, the back-end object_p function needs to set
|
|---|
| 665 | up certain fields in the bfd on successfully recognizing the
|
|---|
| 666 | object. This typically happens in a piecemeal fashion, with
|
|---|
| 667 | failures possible at many points. On failure, the bfd is
|
|---|
| 668 | supposed to be restored to its initial state, which is
|
|---|
| 669 | virtually impossible. However, restoring a subset of the bfd
|
|---|
| 670 | state works in practice. This function stores the subset and
|
|---|
| 671 | reinitializes the bfd.
|
|---|
| 672 |
|
|---|
| 673 | @findex bfd_preserve_restore
|
|---|
| 674 | @subsubsection @code{bfd_preserve_restore}
|
|---|
| 675 | @strong{Synopsis}
|
|---|
| 676 | @example
|
|---|
| 677 | void bfd_preserve_restore (bfd *, struct bfd_preserve *);
|
|---|
| 678 | @end example
|
|---|
| 679 | @strong{Description}@*
|
|---|
| 680 | This function restores bfd state saved by bfd_preserve_save.
|
|---|
| 681 | If MARKER is non-NULL in struct bfd_preserve then that block
|
|---|
| 682 | and all subsequently bfd_alloc'd memory is freed.
|
|---|
| 683 |
|
|---|
| 684 | @findex bfd_preserve_finish
|
|---|
| 685 | @subsubsection @code{bfd_preserve_finish}
|
|---|
| 686 | @strong{Synopsis}
|
|---|
| 687 | @example
|
|---|
| 688 | void bfd_preserve_finish (bfd *, struct bfd_preserve *);
|
|---|
| 689 | @end example
|
|---|
| 690 | @strong{Description}@*
|
|---|
| 691 | This function should be called when the bfd state saved by
|
|---|
| 692 | bfd_preserve_save is no longer needed. ie. when the back-end
|
|---|
| 693 | object_p function returns with success.
|
|---|
| 694 |
|
|---|