| 1 | /* libbfd.h -- Declarations used by bfd library *implementation*. |
| 2 | (This include file is not for users of the library.) |
| 3 | Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 4 | 2000, 2001, 2002 |
| 5 | Free Software Foundation, Inc. |
| 6 | Written by Cygnus Support. |
| 7 | |
| 8 | This file is part of BFD, the Binary File Descriptor library. |
| 9 | |
| 10 | This program is free software; you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by |
| 12 | the Free Software Foundation; either version 2 of the License, or |
| 13 | (at your option) any later version. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with this program; if not, write to the Free Software |
| 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 23 | |
| 24 | /* Align an address upward to a boundary, expressed as a number of bytes. |
| 25 | E.g. align to an 8-byte boundary with argument of 8. Take care never |
| 26 | to wrap around if the address is within boundary-1 of the end of the |
| 27 | address space. */ |
| 28 | #define BFD_ALIGN(this, boundary) \ |
| 29 | ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ |
| 30 | ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ |
| 31 | : ~ (bfd_vma) 0) |
| 32 | |
| 33 | /* If you want to read and write large blocks, you might want to do it |
| 34 | in quanta of this amount */ |
| 35 | #define DEFAULT_BUFFERSIZE 8192 |
| 36 | |
| 37 | /* Set a tdata field. Can't use the other macros for this, since they |
| 38 | do casts, and casting to the left of assignment isn't portable. */ |
| 39 | #define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v)) |
| 40 | |
| 41 | /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points |
| 42 | to an instance of this structure. */ |
| 43 | |
| 44 | struct bfd_in_memory |
| 45 | { |
| 46 | /* Size of buffer. */ |
| 47 | bfd_size_type size; |
| 48 | /* Buffer holding contents of BFD. */ |
| 49 | bfd_byte *buffer; |
| 50 | }; |
| 51 | |
| 52 | /* tdata for an archive. For an input archive, cache |
| 53 | needs to be free()'d. For an output archive, symdefs do. */ |
| 54 | |
| 55 | struct artdata { |
| 56 | file_ptr first_file_filepos; |
| 57 | /* Speed up searching the armap */ |
| 58 | struct ar_cache *cache; |
| 59 | bfd *archive_head; /* Only interesting in output routines */ |
| 60 | carsym *symdefs; /* the symdef entries */ |
| 61 | symindex symdef_count; /* how many there are */ |
| 62 | char *extended_names; /* clever intel extension */ |
| 63 | /* when more compilers are standard C, this can be a time_t */ |
| 64 | long armap_timestamp; /* Timestamp value written into armap. |
| 65 | This is used for BSD archives to check |
| 66 | that the timestamp is recent enough |
| 67 | for the BSD linker to not complain, |
| 68 | just before we finish writing an |
| 69 | archive. */ |
| 70 | file_ptr armap_datepos; /* Position within archive to seek to |
| 71 | rewrite the date field. */ |
| 72 | PTR tdata; /* Backend specific information. */ |
| 73 | }; |
| 74 | |
| 75 | #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) |
| 76 | |
| 77 | /* Goes in bfd's arelt_data slot */ |
| 78 | struct areltdata { |
| 79 | char * arch_header; /* it's actually a string */ |
| 80 | unsigned int parsed_size; /* octets of filesize not including ar_hdr */ |
| 81 | char *filename; /* null-terminated */ |
| 82 | }; |
| 83 | |
| 84 | #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) |
| 85 | |
| 86 | extern PTR bfd_malloc |
| 87 | PARAMS ((bfd_size_type)); |
| 88 | extern PTR bfd_realloc |
| 89 | PARAMS ((PTR, bfd_size_type)); |
| 90 | extern PTR bfd_zmalloc |
| 91 | PARAMS ((bfd_size_type)); |
| 92 | |
| 93 | extern bfd_error_handler_type _bfd_error_handler; |
| 94 | |
| 95 | /* These routines allocate and free things on the BFD's objalloc. */ |
| 96 | |
| 97 | extern PTR bfd_alloc |
| 98 | PARAMS ((bfd *, bfd_size_type)); |
| 99 | extern PTR bfd_zalloc |
| 100 | PARAMS ((bfd *, bfd_size_type)); |
| 101 | extern void bfd_release |
| 102 | PARAMS ((bfd *, PTR)); |
| 103 | |
| 104 | bfd * _bfd_create_empty_archive_element_shell |
| 105 | PARAMS ((bfd *obfd)); |
| 106 | bfd * _bfd_look_for_bfd_in_cache |
| 107 | PARAMS ((bfd *, file_ptr)); |
| 108 | bfd_boolean _bfd_add_bfd_to_archive_cache |
| 109 | PARAMS ((bfd *, file_ptr, bfd *)); |
| 110 | bfd_boolean _bfd_generic_mkarchive |
| 111 | PARAMS ((bfd *abfd)); |
| 112 | const bfd_target *bfd_generic_archive_p |
| 113 | PARAMS ((bfd *abfd)); |
| 114 | bfd_boolean bfd_slurp_armap |
| 115 | PARAMS ((bfd *abfd)); |
| 116 | bfd_boolean bfd_slurp_bsd_armap_f2 |
| 117 | PARAMS ((bfd *abfd)); |
| 118 | #define bfd_slurp_bsd_armap bfd_slurp_armap |
| 119 | #define bfd_slurp_coff_armap bfd_slurp_armap |
| 120 | bfd_boolean _bfd_slurp_extended_name_table |
| 121 | PARAMS ((bfd *abfd)); |
| 122 | extern bfd_boolean _bfd_construct_extended_name_table |
| 123 | PARAMS ((bfd *, bfd_boolean, char **, bfd_size_type *)); |
| 124 | bfd_boolean _bfd_write_archive_contents |
| 125 | PARAMS ((bfd *abfd)); |
| 126 | bfd_boolean _bfd_compute_and_write_armap |
| 127 | PARAMS ((bfd *, unsigned int elength)); |
| 128 | bfd *_bfd_get_elt_at_filepos |
| 129 | PARAMS ((bfd *archive, file_ptr filepos)); |
| 130 | extern bfd *_bfd_generic_get_elt_at_index |
| 131 | PARAMS ((bfd *, symindex)); |
| 132 | bfd * _bfd_new_bfd |
| 133 | PARAMS ((void)); |
| 134 | void _bfd_delete_bfd |
| 135 | PARAMS ((bfd *)); |
| 136 | |
| 137 | bfd_boolean bfd_false |
| 138 | PARAMS ((bfd *ignore)); |
| 139 | bfd_boolean bfd_true |
| 140 | PARAMS ((bfd *ignore)); |
| 141 | PTR bfd_nullvoidptr |
| 142 | PARAMS ((bfd *ignore)); |
| 143 | int bfd_0 |
| 144 | PARAMS ((bfd *ignore)); |
| 145 | unsigned int bfd_0u |
| 146 | PARAMS ((bfd *ignore)); |
| 147 | long bfd_0l |
| 148 | PARAMS ((bfd *ignore)); |
| 149 | long _bfd_n1 |
| 150 | PARAMS ((bfd *ignore)); |
| 151 | void bfd_void |
| 152 | PARAMS ((bfd *ignore)); |
| 153 | |
| 154 | bfd *_bfd_new_bfd_contained_in |
| 155 | PARAMS ((bfd *)); |
| 156 | const bfd_target *_bfd_dummy_target |
| 157 | PARAMS ((bfd *abfd)); |
| 158 | |
| 159 | void bfd_dont_truncate_arname |
| 160 | PARAMS ((bfd *abfd, const char *filename, char *hdr)); |
| 161 | void bfd_bsd_truncate_arname |
| 162 | PARAMS ((bfd *abfd, const char *filename, char *hdr)); |
| 163 | void bfd_gnu_truncate_arname |
| 164 | PARAMS ((bfd *abfd, const char *filename, char *hdr)); |
| 165 | |
| 166 | bfd_boolean bsd_write_armap |
| 167 | PARAMS ((bfd *arch, unsigned int elength, struct orl *map, |
| 168 | unsigned int orl_count, int stridx)); |
| 169 | |
| 170 | bfd_boolean coff_write_armap |
| 171 | PARAMS ((bfd *arch, unsigned int elength, struct orl *map, |
| 172 | unsigned int orl_count, int stridx)); |
| 173 | |
| 174 | extern PTR _bfd_generic_read_ar_hdr |
| 175 | PARAMS ((bfd *)); |
| 176 | |
| 177 | extern PTR _bfd_generic_read_ar_hdr_mag |
| 178 | PARAMS ((bfd *, const char *)); |
| 179 | |
| 180 | bfd * bfd_generic_openr_next_archived_file |
| 181 | PARAMS ((bfd *archive, bfd *last_file)); |
| 182 | |
| 183 | int bfd_generic_stat_arch_elt |
| 184 | PARAMS ((bfd *, struct stat *)); |
| 185 | |
| 186 | #define _bfd_read_ar_hdr(abfd) \ |
| 187 | BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) |
| 188 | \f |
| 189 | /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use |
| 190 | BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ |
| 191 | |
| 192 | #define _bfd_generic_close_and_cleanup bfd_true |
| 193 | #define _bfd_generic_bfd_free_cached_info bfd_true |
| 194 | #define _bfd_generic_new_section_hook \ |
| 195 | ((bfd_boolean (*) PARAMS ((bfd *, asection *))) bfd_true) |
| 196 | extern bfd_boolean _bfd_generic_get_section_contents |
| 197 | PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); |
| 198 | extern bfd_boolean _bfd_generic_get_section_contents_in_window |
| 199 | PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); |
| 200 | |
| 201 | /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use |
| 202 | BFD_JUMP_TABLE_COPY (_bfd_generic). */ |
| 203 | |
| 204 | #define _bfd_generic_bfd_copy_private_bfd_data \ |
| 205 | ((bfd_boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) |
| 206 | #define _bfd_generic_bfd_merge_private_bfd_data \ |
| 207 | ((bfd_boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) |
| 208 | #define _bfd_generic_bfd_set_private_flags \ |
| 209 | ((bfd_boolean (*) PARAMS ((bfd *, flagword))) bfd_true) |
| 210 | #define _bfd_generic_bfd_copy_private_section_data \ |
| 211 | ((bfd_boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true) |
| 212 | #define _bfd_generic_bfd_copy_private_symbol_data \ |
| 213 | ((bfd_boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true) |
| 214 | #define _bfd_generic_bfd_print_private_bfd_data \ |
| 215 | ((bfd_boolean (*) PARAMS ((bfd *, PTR))) bfd_true) |
| 216 | |
| 217 | /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file |
| 218 | support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ |
| 219 | |
| 220 | extern char *_bfd_nocore_core_file_failing_command |
| 221 | PARAMS ((bfd *)); |
| 222 | extern int _bfd_nocore_core_file_failing_signal |
| 223 | PARAMS ((bfd *)); |
| 224 | extern bfd_boolean _bfd_nocore_core_file_matches_executable_p |
| 225 | PARAMS ((bfd *, bfd *)); |
| 226 | |
| 227 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive |
| 228 | file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ |
| 229 | |
| 230 | #define _bfd_noarchive_slurp_armap bfd_false |
| 231 | #define _bfd_noarchive_slurp_extended_name_table bfd_false |
| 232 | #define _bfd_noarchive_construct_extended_name_table \ |
| 233 | ((bfd_boolean (*) \ |
| 234 | PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ |
| 235 | bfd_false) |
| 236 | #define _bfd_noarchive_truncate_arname \ |
| 237 | ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void) |
| 238 | #define _bfd_noarchive_write_armap \ |
| 239 | ((bfd_boolean (*) \ |
| 240 | PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ |
| 241 | bfd_false) |
| 242 | #define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr |
| 243 | #define _bfd_noarchive_openr_next_archived_file \ |
| 244 | ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) |
| 245 | #define _bfd_noarchive_get_elt_at_index \ |
| 246 | ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr) |
| 247 | #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt |
| 248 | #define _bfd_noarchive_update_armap_timestamp bfd_false |
| 249 | |
| 250 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style |
| 251 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */ |
| 252 | |
| 253 | #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap |
| 254 | #define _bfd_archive_bsd_slurp_extended_name_table \ |
| 255 | _bfd_slurp_extended_name_table |
| 256 | extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table |
| 257 | PARAMS ((bfd *, char **, bfd_size_type *, const char **)); |
| 258 | #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname |
| 259 | #define _bfd_archive_bsd_write_armap bsd_write_armap |
| 260 | #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr |
| 261 | #define _bfd_archive_bsd_openr_next_archived_file \ |
| 262 | bfd_generic_openr_next_archived_file |
| 263 | #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index |
| 264 | #define _bfd_archive_bsd_generic_stat_arch_elt \ |
| 265 | bfd_generic_stat_arch_elt |
| 266 | extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp |
| 267 | PARAMS ((bfd *)); |
| 268 | |
| 269 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style |
| 270 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ |
| 271 | |
| 272 | #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap |
| 273 | #define _bfd_archive_coff_slurp_extended_name_table \ |
| 274 | _bfd_slurp_extended_name_table |
| 275 | extern bfd_boolean _bfd_archive_coff_construct_extended_name_table |
| 276 | PARAMS ((bfd *, char **, bfd_size_type *, const char **)); |
| 277 | #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname |
| 278 | #define _bfd_archive_coff_write_armap coff_write_armap |
| 279 | #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr |
| 280 | #define _bfd_archive_coff_openr_next_archived_file \ |
| 281 | bfd_generic_openr_next_archived_file |
| 282 | #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index |
| 283 | #define _bfd_archive_coff_generic_stat_arch_elt \ |
| 284 | bfd_generic_stat_arch_elt |
| 285 | #define _bfd_archive_coff_update_armap_timestamp bfd_true |
| 286 | |
| 287 | /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol |
| 288 | support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ |
| 289 | |
| 290 | #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 |
| 291 | #define _bfd_nosymbols_get_symtab \ |
| 292 | ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) |
| 293 | #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol |
| 294 | #define _bfd_nosymbols_print_symbol \ |
| 295 | ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) |
| 296 | #define _bfd_nosymbols_get_symbol_info \ |
| 297 | ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) |
| 298 | #define _bfd_nosymbols_bfd_is_local_label_name \ |
| 299 | ((bfd_boolean (*) PARAMS ((bfd *, const char *))) bfd_false) |
| 300 | #define _bfd_nosymbols_get_lineno \ |
| 301 | ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) |
| 302 | #define _bfd_nosymbols_find_nearest_line \ |
| 303 | ((bfd_boolean (*) \ |
| 304 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \ |
| 305 | const char **, unsigned int *))) \ |
| 306 | bfd_false) |
| 307 | #define _bfd_nosymbols_bfd_make_debug_symbol \ |
| 308 | ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr) |
| 309 | #define _bfd_nosymbols_read_minisymbols \ |
| 310 | ((long (*) PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *))) _bfd_n1) |
| 311 | #define _bfd_nosymbols_minisymbol_to_symbol \ |
| 312 | ((asymbol *(*) PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *))) \ |
| 313 | bfd_nullvoidptr) |
| 314 | |
| 315 | /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc |
| 316 | support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ |
| 317 | |
| 318 | #define _bfd_norelocs_get_reloc_upper_bound \ |
| 319 | ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1) |
| 320 | #define _bfd_norelocs_canonicalize_reloc \ |
| 321 | ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1) |
| 322 | #define _bfd_norelocs_bfd_reloc_type_lookup \ |
| 323 | ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \ |
| 324 | bfd_nullvoidptr) |
| 325 | |
| 326 | /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not |
| 327 | be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ |
| 328 | |
| 329 | #define _bfd_nowrite_set_arch_mach \ |
| 330 | ((bfd_boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \ |
| 331 | bfd_false) |
| 332 | #define _bfd_nowrite_set_section_contents \ |
| 333 | ((bfd_boolean (*) \ |
| 334 | PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \ |
| 335 | bfd_false) |
| 336 | |
| 337 | /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use |
| 338 | BFD_JUMP_TABLE_WRITE (_bfd_generic). */ |
| 339 | |
| 340 | #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach |
| 341 | extern bfd_boolean _bfd_generic_set_section_contents |
| 342 | PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); |
| 343 | |
| 344 | /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not |
| 345 | support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ |
| 346 | |
| 347 | #define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, bfd_boolean))) bfd_0) |
| 348 | #define _bfd_nolink_bfd_get_relocated_section_contents \ |
| 349 | ((bfd_byte *(*) \ |
| 350 | PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \ |
| 351 | bfd_byte *, bfd_boolean, asymbol **))) \ |
| 352 | bfd_nullvoidptr) |
| 353 | #define _bfd_nolink_bfd_relax_section \ |
| 354 | ((bfd_boolean (*) \ |
| 355 | PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *))) \ |
| 356 | bfd_false) |
| 357 | #define _bfd_nolink_bfd_gc_sections \ |
| 358 | ((bfd_boolean (*) \ |
| 359 | PARAMS ((bfd *, struct bfd_link_info *))) \ |
| 360 | bfd_false) |
| 361 | #define _bfd_nolink_bfd_merge_sections \ |
| 362 | ((bfd_boolean (*) \ |
| 363 | PARAMS ((bfd *, struct bfd_link_info *))) \ |
| 364 | bfd_false) |
| 365 | #define _bfd_nolink_bfd_discard_group \ |
| 366 | ((bfd_boolean (*) \ |
| 367 | PARAMS ((bfd *, struct sec *))) \ |
| 368 | bfd_false) |
| 369 | #define _bfd_nolink_bfd_link_hash_table_create \ |
| 370 | ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) |
| 371 | #define _bfd_nolink_bfd_link_hash_table_free \ |
| 372 | ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void) |
| 373 | #define _bfd_nolink_bfd_link_add_symbols \ |
| 374 | ((bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) |
| 375 | #define _bfd_nolink_bfd_link_just_syms \ |
| 376 | ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void) |
| 377 | #define _bfd_nolink_bfd_final_link \ |
| 378 | ((bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) |
| 379 | #define _bfd_nolink_bfd_link_split_section \ |
| 380 | ((bfd_boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false) |
| 381 | |
| 382 | /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not |
| 383 | have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC |
| 384 | (_bfd_nodynamic). */ |
| 385 | |
| 386 | #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 |
| 387 | #define _bfd_nodynamic_canonicalize_dynamic_symtab \ |
| 388 | ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) |
| 389 | #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 |
| 390 | #define _bfd_nodynamic_canonicalize_dynamic_reloc \ |
| 391 | ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1) |
| 392 | \f |
| 393 | /* Generic routine to determine of the given symbol is a local |
| 394 | label. */ |
| 395 | extern bfd_boolean bfd_generic_is_local_label_name |
| 396 | PARAMS ((bfd *, const char *)); |
| 397 | |
| 398 | /* Generic minisymbol routines. */ |
| 399 | extern long _bfd_generic_read_minisymbols |
| 400 | PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *)); |
| 401 | extern asymbol *_bfd_generic_minisymbol_to_symbol |
| 402 | PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *)); |
| 403 | |
| 404 | /* Find the nearest line using .stab/.stabstr sections. */ |
| 405 | extern bfd_boolean _bfd_stab_section_find_nearest_line |
| 406 | PARAMS ((bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, |
| 407 | const char **, const char **, unsigned int *, PTR *)); |
| 408 | |
| 409 | /* Find the neaderst line using DWARF 1 debugging information. */ |
| 410 | extern bfd_boolean _bfd_dwarf1_find_nearest_line |
| 411 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, |
| 412 | const char **, unsigned int *)); |
| 413 | |
| 414 | /* Find the nearest line using DWARF 2 debugging information. */ |
| 415 | extern bfd_boolean _bfd_dwarf2_find_nearest_line |
| 416 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, |
| 417 | const char **, unsigned int *, unsigned int, |
| 418 | PTR *)); |
| 419 | |
| 420 | /* Create a new section entry. */ |
| 421 | extern struct bfd_hash_entry *bfd_section_hash_newfunc |
| 422 | PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); |
| 423 | |
| 424 | /* A routine to create entries for a bfd_link_hash_table. */ |
| 425 | extern struct bfd_hash_entry *_bfd_link_hash_newfunc |
| 426 | PARAMS ((struct bfd_hash_entry *entry, |
| 427 | struct bfd_hash_table *table, |
| 428 | const char *string)); |
| 429 | |
| 430 | /* Initialize a bfd_link_hash_table. */ |
| 431 | extern bfd_boolean _bfd_link_hash_table_init |
| 432 | PARAMS ((struct bfd_link_hash_table *, bfd *, |
| 433 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
| 434 | struct bfd_hash_table *, |
| 435 | const char *))); |
| 436 | |
| 437 | /* Generic link hash table creation routine. */ |
| 438 | extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create |
| 439 | PARAMS ((bfd *)); |
| 440 | |
| 441 | /* Generic link hash table destruction routine. */ |
| 442 | extern void _bfd_generic_link_hash_table_free |
| 443 | PARAMS ((struct bfd_link_hash_table *)); |
| 444 | |
| 445 | /* Generic add symbol routine. */ |
| 446 | extern bfd_boolean _bfd_generic_link_add_symbols |
| 447 | PARAMS ((bfd *, struct bfd_link_info *)); |
| 448 | |
| 449 | /* Generic add symbol routine. This version is used by targets for |
| 450 | which the linker must collect constructors and destructors by name, |
| 451 | as the collect2 program does. */ |
| 452 | extern bfd_boolean _bfd_generic_link_add_symbols_collect |
| 453 | PARAMS ((bfd *, struct bfd_link_info *)); |
| 454 | |
| 455 | /* Generic archive add symbol routine. */ |
| 456 | extern bfd_boolean _bfd_generic_link_add_archive_symbols |
| 457 | PARAMS ((bfd *, struct bfd_link_info *, |
| 458 | bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *))); |
| 459 | |
| 460 | /* Forward declaration to avoid prototype errors. */ |
| 461 | typedef struct bfd_link_hash_entry _bfd_link_hash_entry; |
| 462 | |
| 463 | /* Generic routine to add a single symbol. */ |
| 464 | extern bfd_boolean _bfd_generic_link_add_one_symbol |
| 465 | PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, |
| 466 | asection *, bfd_vma, const char *, bfd_boolean copy, |
| 467 | bfd_boolean constructor, struct bfd_link_hash_entry **)); |
| 468 | |
| 469 | /* Generic routine to mark section as supplying symbols only. */ |
| 470 | extern void _bfd_generic_link_just_syms |
| 471 | PARAMS ((asection *, struct bfd_link_info *)); |
| 472 | |
| 473 | /* Generic link routine. */ |
| 474 | extern bfd_boolean _bfd_generic_final_link |
| 475 | PARAMS ((bfd *, struct bfd_link_info *)); |
| 476 | |
| 477 | extern bfd_boolean _bfd_generic_link_split_section |
| 478 | PARAMS ((bfd *, struct sec *)); |
| 479 | |
| 480 | /* Generic reloc_link_order processing routine. */ |
| 481 | extern bfd_boolean _bfd_generic_reloc_link_order |
| 482 | PARAMS ((bfd *, struct bfd_link_info *, asection *, |
| 483 | struct bfd_link_order *)); |
| 484 | |
| 485 | /* Default link order processing routine. */ |
| 486 | extern bfd_boolean _bfd_default_link_order |
| 487 | PARAMS ((bfd *, struct bfd_link_info *, asection *, |
| 488 | struct bfd_link_order *)); |
| 489 | |
| 490 | /* Count the number of reloc entries in a link order list. */ |
| 491 | extern unsigned int _bfd_count_link_order_relocs |
| 492 | PARAMS ((struct bfd_link_order *)); |
| 493 | |
| 494 | /* Final link relocation routine. */ |
| 495 | extern bfd_reloc_status_type _bfd_final_link_relocate |
| 496 | PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, |
| 497 | bfd_vma, bfd_vma, bfd_vma)); |
| 498 | |
| 499 | /* Relocate a particular location by a howto and a value. */ |
| 500 | extern bfd_reloc_status_type _bfd_relocate_contents |
| 501 | PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); |
| 502 | |
| 503 | /* Link stabs in sections in the first pass. */ |
| 504 | |
| 505 | extern bfd_boolean _bfd_link_section_stabs |
| 506 | PARAMS ((bfd *, PTR *, asection *, asection *, PTR *)); |
| 507 | |
| 508 | /* Eliminate stabs for discarded functions and symbols. */ |
| 509 | extern bfd_boolean _bfd_discard_section_stabs |
| 510 | PARAMS ((bfd *, asection *, PTR, |
| 511 | bfd_boolean (*) (bfd_vma, PTR), PTR)); |
| 512 | |
| 513 | /* Write out the .stab section when linking stabs in sections. */ |
| 514 | |
| 515 | extern bfd_boolean _bfd_write_section_stabs |
| 516 | PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *)); |
| 517 | |
| 518 | /* Write out the .stabstr string table when linking stabs in sections. */ |
| 519 | |
| 520 | extern bfd_boolean _bfd_write_stab_strings |
| 521 | PARAMS ((bfd *, PTR *)); |
| 522 | |
| 523 | /* Find an offset within a .stab section when linking stabs in |
| 524 | sections. */ |
| 525 | |
| 526 | extern bfd_vma _bfd_stab_section_offset |
| 527 | PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma)); |
| 528 | |
| 529 | /* Attempt to merge a SEC_MERGE section. */ |
| 530 | |
| 531 | extern bfd_boolean _bfd_merge_section |
| 532 | PARAMS ((bfd *, PTR *, asection *, PTR *)); |
| 533 | |
| 534 | /* Attempt to merge SEC_MERGE sections. */ |
| 535 | |
| 536 | extern bfd_boolean _bfd_merge_sections |
| 537 | PARAMS ((bfd *, PTR, void (*)(bfd *, asection *))); |
| 538 | |
| 539 | /* Write out a merged section. */ |
| 540 | |
| 541 | extern bfd_boolean _bfd_write_merged_section |
| 542 | PARAMS ((bfd *, asection *, PTR)); |
| 543 | |
| 544 | /* Find an offset within a modified SEC_MERGE section. */ |
| 545 | |
| 546 | extern bfd_vma _bfd_merged_section_offset |
| 547 | PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma)); |
| 548 | |
| 549 | /* Create a string table. */ |
| 550 | extern struct bfd_strtab_hash *_bfd_stringtab_init |
| 551 | PARAMS ((void)); |
| 552 | |
| 553 | /* Create an XCOFF .debug section style string table. */ |
| 554 | extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init |
| 555 | PARAMS ((void)); |
| 556 | |
| 557 | /* Free a string table. */ |
| 558 | extern void _bfd_stringtab_free |
| 559 | PARAMS ((struct bfd_strtab_hash *)); |
| 560 | |
| 561 | /* Get the size of a string table. */ |
| 562 | extern bfd_size_type _bfd_stringtab_size |
| 563 | PARAMS ((struct bfd_strtab_hash *)); |
| 564 | |
| 565 | /* Add a string to a string table. */ |
| 566 | extern bfd_size_type _bfd_stringtab_add |
| 567 | PARAMS ((struct bfd_strtab_hash *, const char *, bfd_boolean hash, |
| 568 | bfd_boolean copy)); |
| 569 | |
| 570 | /* Write out a string table. */ |
| 571 | extern bfd_boolean _bfd_stringtab_emit |
| 572 | PARAMS ((bfd *, struct bfd_strtab_hash *)); |
| 573 | |
| 574 | /* Check that endianness of input and output file match. */ |
| 575 | extern bfd_boolean _bfd_generic_verify_endian_match |
| 576 | PARAMS ((bfd *, bfd *)); |
| 577 | \f |
| 578 | /* Macros to tell if bfds are read or write enabled. |
| 579 | |
| 580 | Note that bfds open for read may be scribbled into if the fd passed |
| 581 | to bfd_fdopenr is actually open both for read and write |
| 582 | simultaneously. However an output bfd will never be open for |
| 583 | read. Therefore sometimes you want to check bfd_read_p or |
| 584 | !bfd_read_p, and only sometimes bfd_write_p. |
| 585 | */ |
| 586 | |
| 587 | #define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) |
| 588 | #define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) |
| 589 | |
| 590 | void bfd_assert |
| 591 | PARAMS ((const char*,int)); |
| 592 | |
| 593 | #define BFD_ASSERT(x) \ |
| 594 | { if (!(x)) bfd_assert(__FILE__,__LINE__); } |
| 595 | |
| 596 | #define BFD_FAIL() \ |
| 597 | { bfd_assert(__FILE__,__LINE__); } |
| 598 | |
| 599 | extern void _bfd_abort |
| 600 | PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN; |
| 601 | |
| 602 | /* if gcc >= 2.6, we can give a function name, too */ |
| 603 | #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) |
| 604 | #define __PRETTY_FUNCTION__ ((char *) NULL) |
| 605 | #endif |
| 606 | |
| 607 | #undef abort |
| 608 | #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) |
| 609 | |
| 610 | FILE * bfd_cache_lookup_worker |
| 611 | PARAMS ((bfd *)); |
| 612 | |
| 613 | extern bfd *bfd_last_cache; |
| 614 | |
| 615 | /* List of supported target vectors, and the default vector (if |
| 616 | bfd_default_vector[0] is NULL, there is no default). */ |
| 617 | extern const bfd_target * const *bfd_target_vector; |
| 618 | extern const bfd_target *bfd_default_vector[]; |
| 619 | |
| 620 | /* List of associated target vectors. */ |
| 621 | extern const bfd_target * const *bfd_associated_vector; |
| 622 | |
| 623 | /* Functions shared by the ECOFF and MIPS ELF backends, which have no |
| 624 | other common header files. */ |
| 625 | |
| 626 | #if defined(__STDC__) || defined(ALMOST_STDC) |
| 627 | struct ecoff_find_line; |
| 628 | #endif |
| 629 | |
| 630 | extern bfd_boolean _bfd_ecoff_locate_line |
| 631 | PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, |
| 632 | const struct ecoff_debug_swap * const, struct ecoff_find_line *, |
| 633 | const char **, const char **, unsigned int *)); |
| 634 | extern bfd_boolean _bfd_ecoff_get_accumulated_pdr |
| 635 | PARAMS ((PTR, bfd_byte *)); |
| 636 | extern bfd_boolean _bfd_ecoff_get_accumulated_sym |
| 637 | PARAMS ((PTR, bfd_byte *)); |
| 638 | extern bfd_boolean _bfd_ecoff_get_accumulated_ss |
| 639 | PARAMS ((PTR, bfd_byte *)); |
| 640 | |
| 641 | extern bfd_vma _bfd_get_gp_value |
| 642 | PARAMS ((bfd *)); |
| 643 | extern void _bfd_set_gp_value |
| 644 | PARAMS ((bfd *, bfd_vma)); |
| 645 | |
| 646 | /* Function shared by the COFF and ELF SH backends, which have no |
| 647 | other common header files. */ |
| 648 | |
| 649 | extern bfd_boolean _bfd_sh_align_load_span |
| 650 | PARAMS ((bfd *, asection *, bfd_byte *, |
| 651 | bfd_boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), |
| 652 | PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *)); |
| 653 | |