1 1.1 skrll /* libbfd.h -- Declarations used by bfd library *implementation*. 2 1.1 skrll (This include file is not for users of the library.) 3 1.1 skrll 4 1.1.1.12 christos Copyright (C) 1990-2026 Free Software Foundation, Inc. 5 1.1 skrll 6 1.1 skrll Written by Cygnus Support. 7 1.1 skrll 8 1.1 skrll This file is part of BFD, the Binary File Descriptor library. 9 1.1 skrll 10 1.1 skrll This program is free software; you can redistribute it and/or modify 11 1.1 skrll it under the terms of the GNU General Public License as published by 12 1.1 skrll the Free Software Foundation; either version 3 of the License, or 13 1.1 skrll (at your option) any later version. 14 1.1 skrll 15 1.1 skrll This program is distributed in the hope that it will be useful, 16 1.1 skrll but WITHOUT ANY WARRANTY; without even the implied warranty of 17 1.1 skrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 1.1 skrll GNU General Public License for more details. 19 1.1 skrll 20 1.1 skrll You should have received a copy of the GNU General Public License 21 1.1 skrll along with this program; if not, write to the Free Software 22 1.1 skrll Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 23 1.1 skrll MA 02110-1301, USA. */ 24 1.1 skrll 25 1.1.1.7 christos #ifndef _LIBBFD_H 26 1.1.1.7 christos #define _LIBBFD_H 1 27 1.1.1.7 christos 28 1.1 skrll #include "hashtab.h" 29 1.1.1.12 christos #include "hidden.h" 30 1.1 skrll 31 1.1.1.4 christos #ifdef __cplusplus 32 1.1.1.4 christos extern "C" { 33 1.1.1.4 christos #endif 34 1.1.1.4 christos 35 1.1 skrll /* Set a tdata field. Can't use the other macros for this, since they 36 1.1 skrll do casts, and casting to the left of assignment isn't portable. */ 37 1.1 skrll #define set_tdata(bfd, v) ((bfd)->tdata.any = (v)) 38 1.1 skrll 39 1.1 skrll /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points 40 1.1 skrll to an instance of this structure. */ 41 1.1 skrll 42 1.1 skrll struct bfd_in_memory 43 1.1 skrll { 44 1.1 skrll /* Size of buffer. */ 45 1.1 skrll bfd_size_type size; 46 1.1 skrll /* Buffer holding contents of BFD. */ 47 1.1 skrll bfd_byte *buffer; 48 1.1 skrll }; 49 1.1 skrll 50 1.1 skrll struct section_hash_entry 51 1.1 skrll { 52 1.1 skrll struct bfd_hash_entry root; 53 1.1 skrll asection section; 54 1.1 skrll }; 55 1.1 skrll 56 1.1.1.7 christos /* Unique section id. */ 57 1.1.1.7 christos extern unsigned int _bfd_section_id ATTRIBUTE_HIDDEN; 58 1.1.1.7 christos 59 1.1 skrll /* tdata for an archive. For an input archive, cache 60 1.1 skrll needs to be free()'d. For an output archive, symdefs do. */ 61 1.1 skrll 62 1.1.1.3 christos struct artdata 63 1.1.1.3 christos { 64 1.1.1.10 christos ufile_ptr first_file_filepos; 65 1.1 skrll /* Speed up searching the armap */ 66 1.1 skrll htab_t cache; 67 1.1.1.3 christos carsym *symdefs; /* The symdef entries. */ 68 1.1.1.3 christos symindex symdef_count; /* How many there are. */ 69 1.1.1.3 christos char *extended_names; /* Clever intel extension. */ 70 1.1.1.3 christos bfd_size_type extended_names_size; /* Size of extended names. */ 71 1.1.1.3 christos /* When more compilers are standard C, this can be a time_t. */ 72 1.1 skrll long armap_timestamp; /* Timestamp value written into armap. 73 1.1 skrll This is used for BSD archives to check 74 1.1 skrll that the timestamp is recent enough 75 1.1 skrll for the BSD linker to not complain, 76 1.1 skrll just before we finish writing an 77 1.1 skrll archive. */ 78 1.1 skrll file_ptr armap_datepos; /* Position within archive to seek to 79 1.1 skrll rewrite the date field. */ 80 1.1 skrll void *tdata; /* Backend specific information. */ 81 1.1 skrll }; 82 1.1 skrll 83 1.1 skrll #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) 84 1.1 skrll 85 1.1 skrll /* Goes in bfd's arelt_data slot */ 86 1.1.1.3 christos struct areltdata 87 1.1.1.3 christos { 88 1.1.1.3 christos char * arch_header; /* It's actually a string. */ 89 1.1.1.3 christos bfd_size_type parsed_size; /* Octets of filesize not including ar_hdr. */ 90 1.1.1.3 christos bfd_size_type extra_size; /* BSD4.4: extra bytes after the header. */ 91 1.1.1.3 christos char *filename; /* Null-terminated. */ 92 1.1.1.3 christos file_ptr origin; /* For element of a thin archive. */ 93 1.1.1.4 christos void *parent_cache; /* Where and how to find this member. */ 94 1.1.1.4 christos file_ptr key; 95 1.1 skrll }; 96 1.1 skrll 97 1.1 skrll #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) 98 1.1 skrll 99 1.1 skrll extern void *bfd_malloc 100 1.1.1.7 christos (bfd_size_type) ATTRIBUTE_HIDDEN; 101 1.1 skrll 102 1.1.1.8 christos static inline char * 103 1.1.1.8 christos bfd_strdup (const char *str) 104 1.1.1.8 christos { 105 1.1.1.8 christos size_t len = strlen (str) + 1; 106 1.1.1.8 christos char *buf = bfd_malloc (len); 107 1.1.1.8 christos if (buf != NULL) 108 1.1.1.8 christos memcpy (buf, str, len); 109 1.1.1.8 christos return buf; 110 1.1.1.8 christos } 111 1.1 skrll 112 1.1.1.7 christos extern bfd * _bfd_create_empty_archive_element_shell 113 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 114 1.1.1.7 christos extern bfd * _bfd_look_for_bfd_in_cache 115 1.1.1.7 christos (bfd *, file_ptr) ATTRIBUTE_HIDDEN; 116 1.1.1.9 christos extern bool _bfd_add_bfd_to_archive_cache 117 1.1.1.7 christos (bfd *, file_ptr, bfd *) ATTRIBUTE_HIDDEN; 118 1.1.1.9 christos extern bool _bfd_generic_mkarchive 119 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 120 1.1.1.7 christos extern char *_bfd_append_relative_path 121 1.1.1.7 christos (bfd *, char *) ATTRIBUTE_HIDDEN; 122 1.1.1.9 christos extern bfd_cleanup bfd_generic_archive_p 123 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 124 1.1.1.9 christos extern bool bfd_slurp_armap 125 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 126 1.1 skrll #define bfd_slurp_bsd_armap bfd_slurp_armap 127 1.1 skrll #define bfd_slurp_coff_armap bfd_slurp_armap 128 1.1.1.9 christos extern bool _bfd_archive_64_bit_slurp_armap 129 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 130 1.1.1.9 christos extern bool _bfd_archive_64_bit_write_armap 131 1.1.1.7 christos (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; 132 1.1.1.5 christos #define _bfd_archive_64_bit_slurp_extended_name_table \ 133 1.1.1.5 christos _bfd_slurp_extended_name_table 134 1.1.1.5 christos #define _bfd_archive_64_bit_construct_extended_name_table \ 135 1.1.1.5 christos _bfd_archive_coff_construct_extended_name_table 136 1.1.1.5 christos #define _bfd_archive_64_bit_truncate_arname \ 137 1.1.1.5 christos bfd_dont_truncate_arname 138 1.1.1.5 christos #define _bfd_archive_64_bit_read_ar_hdr \ 139 1.1.1.5 christos _bfd_generic_read_ar_hdr 140 1.1.1.5 christos #define _bfd_archive_64_bit_write_ar_hdr \ 141 1.1.1.5 christos _bfd_generic_write_ar_hdr 142 1.1.1.5 christos #define _bfd_archive_64_bit_openr_next_archived_file \ 143 1.1.1.5 christos bfd_generic_openr_next_archived_file 144 1.1.1.5 christos #define _bfd_archive_64_bit_get_elt_at_index \ 145 1.1.1.5 christos _bfd_generic_get_elt_at_index 146 1.1.1.5 christos #define _bfd_archive_64_bit_generic_stat_arch_elt \ 147 1.1.1.5 christos bfd_generic_stat_arch_elt 148 1.1.1.7 christos #define _bfd_archive_64_bit_update_armap_timestamp _bfd_bool_bfd_true 149 1.1.1.5 christos 150 1.1.1.9 christos extern bool _bfd_slurp_extended_name_table 151 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 152 1.1.1.9 christos extern bool _bfd_construct_extended_name_table 153 1.1.1.9 christos (bfd *, bool, char **, bfd_size_type *) ATTRIBUTE_HIDDEN; 154 1.1.1.9 christos extern bool _bfd_write_archive_contents 155 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 156 1.1.1.9 christos extern bool _bfd_compute_and_write_armap 157 1.1.1.7 christos (bfd *, unsigned int) ATTRIBUTE_HIDDEN; 158 1.1.1.7 christos extern bfd *_bfd_get_elt_at_filepos 159 1.1.1.9 christos (bfd *, file_ptr, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 160 1.1 skrll extern bfd *_bfd_generic_get_elt_at_index 161 1.1.1.7 christos (bfd *, symindex) ATTRIBUTE_HIDDEN; 162 1.1.1.7 christos 163 1.1.1.9 christos extern bool _bfd_bool_bfd_false 164 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 165 1.1.1.9 christos extern bool _bfd_bool_bfd_asymbol_false 166 1.1.1.7 christos (bfd *, asymbol *) ATTRIBUTE_HIDDEN; 167 1.1.1.9 christos extern bool _bfd_bool_bfd_false_error 168 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 169 1.1.1.9 christos extern bool _bfd_bool_bfd_link_false_error 170 1.1.1.7 christos (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 171 1.1.1.9 christos extern bool _bfd_bool_bfd_true 172 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 173 1.1.1.9 christos extern bool _bfd_bool_bfd_link_true 174 1.1.1.7 christos (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 175 1.1.1.9 christos extern bool _bfd_bool_bfd_bfd_true 176 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 177 1.1.1.9 christos extern bool _bfd_bool_bfd_uint_true 178 1.1.1.7 christos (bfd *, unsigned int) ATTRIBUTE_HIDDEN; 179 1.1.1.9 christos extern bool _bfd_bool_bfd_asection_bfd_asection_true 180 1.1.1.7 christos (bfd *, asection *, bfd *, asection *) ATTRIBUTE_HIDDEN; 181 1.1.1.9 christos extern bool _bfd_bool_bfd_asymbol_bfd_asymbol_true 182 1.1.1.12 christos (bfd *, asymbol **, bfd *, asymbol **) ATTRIBUTE_HIDDEN; 183 1.1.1.9 christos extern bool _bfd_bool_bfd_ptr_true 184 1.1.1.7 christos (bfd *, void *) ATTRIBUTE_HIDDEN; 185 1.1.1.7 christos extern void *_bfd_ptr_bfd_null_error 186 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 187 1.1.1.7 christos extern int _bfd_int_bfd_0 188 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 189 1.1.1.7 christos extern unsigned int _bfd_uint_bfd_0 190 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 191 1.1.1.7 christos extern long _bfd_long_bfd_0 192 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 193 1.1.1.7 christos extern long _bfd_long_bfd_n1_error 194 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 195 1.1.1.7 christos extern void _bfd_void_bfd 196 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 197 1.1.1.7 christos extern void _bfd_void_bfd_link 198 1.1.1.7 christos (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 199 1.1.1.7 christos extern void _bfd_void_bfd_asection 200 1.1.1.7 christos (bfd *, asection *) ATTRIBUTE_HIDDEN; 201 1.1.1.7 christos 202 1.1.1.9 christos extern bfd_cleanup _bfd_dummy_target 203 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 204 1.1.1.9 christos #define _bfd_no_cleanup _bfd_void_bfd 205 1.1.1.7 christos 206 1.1.1.7 christos extern void bfd_dont_truncate_arname 207 1.1.1.7 christos (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; 208 1.1.1.7 christos extern void bfd_bsd_truncate_arname 209 1.1.1.7 christos (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; 210 1.1.1.7 christos extern void bfd_gnu_truncate_arname 211 1.1.1.7 christos (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; 212 1.1.1.7 christos 213 1.1.1.9 christos extern bool _bfd_bsd_write_armap 214 1.1.1.7 christos (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; 215 1.1.1.7 christos 216 1.1.1.9 christos extern bool _bfd_coff_write_armap 217 1.1.1.7 christos (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; 218 1.1 skrll 219 1.1 skrll extern void *_bfd_generic_read_ar_hdr 220 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 221 1.1 skrll extern void _bfd_ar_spacepad 222 1.1.1.7 christos (char *, size_t, const char *, long) ATTRIBUTE_HIDDEN; 223 1.1.1.9 christos extern bool _bfd_ar_sizepad 224 1.1.1.7 christos (char *, size_t, bfd_size_type) ATTRIBUTE_HIDDEN; 225 1.1 skrll 226 1.1 skrll extern void *_bfd_generic_read_ar_hdr_mag 227 1.1.1.7 christos (bfd *, const char *) ATTRIBUTE_HIDDEN; 228 1.1 skrll 229 1.1.1.9 christos extern bool _bfd_generic_write_ar_hdr 230 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 231 1.1.1.2 christos 232 1.1.1.9 christos extern bool _bfd_bsd44_write_ar_hdr 233 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 234 1.1.1.2 christos 235 1.1.1.7 christos extern bfd * bfd_generic_openr_next_archived_file 236 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 237 1.1 skrll 238 1.1.1.7 christos extern int bfd_generic_stat_arch_elt 239 1.1.1.7 christos (bfd *, struct stat *) ATTRIBUTE_HIDDEN; 240 1.1 skrll 241 1.1 skrll #define _bfd_read_ar_hdr(abfd) \ 242 1.1.1.6 christos BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) 243 1.1.1.6 christos #define _bfd_write_ar_hdr(archive, abfd) \ 244 1.1.1.11 christos BFD_SEND (archive, _bfd_write_ar_hdr_fn, (archive, abfd)) 245 1.1 skrll 246 1.1 skrll /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use 248 1.1 skrll BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ 249 1.1.1.4 christos 250 1.1.1.9 christos #define _bfd_generic_close_and_cleanup _bfd_archive_close_and_cleanup 251 1.1.1.7 christos extern bool _bfd_archive_close_and_cleanup 252 1.1.1.8 christos (bfd *) ATTRIBUTE_HIDDEN; 253 1.1.1.10 christos extern void _bfd_unlink_from_archive_parent (bfd *) ATTRIBUTE_HIDDEN; 254 1.1.1.9 christos #define _bfd_generic_bfd_free_cached_info _bfd_free_cached_info 255 1.1.1.7 christos extern bool _bfd_generic_new_section_hook 256 1.1.1.9 christos (bfd *, asection *) ATTRIBUTE_HIDDEN; 257 1.1.1.7 christos extern bool _bfd_generic_get_section_contents 258 1.1 skrll (bfd *, asection *, void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; 259 1.1 skrll 260 1.1 skrll /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use 261 1.1 skrll BFD_JUMP_TABLE_COPY (_bfd_generic). */ 262 1.1.1.7 christos 263 1.1 skrll #define _bfd_generic_bfd_copy_private_bfd_data _bfd_bool_bfd_bfd_true 264 1.1.1.7 christos #define _bfd_generic_bfd_merge_private_bfd_data \ 265 1.1.1.7 christos _bfd_bool_bfd_link_true 266 1.1.1.11 christos #define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true 267 1.1.1.11 christos extern bool _bfd_generic_bfd_copy_private_section_data 268 1.1.1.11 christos (bfd *, asection *, bfd *, asection *, struct bfd_link_info *) 269 1.1 skrll ATTRIBUTE_HIDDEN; 270 1.1.1.7 christos #define _bfd_generic_bfd_copy_private_symbol_data \ 271 1.1.1.7 christos _bfd_bool_bfd_asymbol_bfd_asymbol_true 272 1.1.1.7 christos #define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true 273 1.1 skrll #define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true 274 1.1 skrll 275 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file 276 1.1 skrll support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ 277 1.1 skrll 278 1.1.1.7 christos extern char *_bfd_nocore_core_file_failing_command 279 1.1 skrll (bfd *) ATTRIBUTE_HIDDEN; 280 1.1.1.7 christos extern int _bfd_nocore_core_file_failing_signal 281 1.1.1.9 christos (bfd *) ATTRIBUTE_HIDDEN; 282 1.1.1.7 christos extern bool _bfd_nocore_core_file_matches_executable_p 283 1.1.1.2 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 284 1.1.1.7 christos extern int _bfd_nocore_core_file_pid 285 1.1 skrll (bfd *) ATTRIBUTE_HIDDEN; 286 1.1 skrll 287 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive 288 1.1 skrll file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ 289 1.1.1.7 christos 290 1.1.1.7 christos #define _bfd_noarchive_slurp_armap _bfd_bool_bfd_false_error 291 1.1.1.9 christos #define _bfd_noarchive_slurp_extended_name_table _bfd_bool_bfd_false_error 292 1.1.1.7 christos extern bool _bfd_noarchive_construct_extended_name_table 293 1.1.1.7 christos (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; 294 1.1.1.7 christos extern void _bfd_noarchive_truncate_arname 295 1.1.1.9 christos (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; 296 1.1.1.7 christos extern bool _bfd_noarchive_write_armap 297 1.1.1.7 christos (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; 298 1.1.1.9 christos #define _bfd_noarchive_read_ar_hdr _bfd_ptr_bfd_null_error 299 1.1.1.7 christos extern bool _bfd_noarchive_write_ar_hdr 300 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 301 1.1.1.7 christos extern bfd * 302 1.1.1.7 christos _bfd_noarchive_openr_next_archived_file 303 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 304 1.1.1.7 christos extern bfd * _bfd_noarchive_get_elt_at_index 305 1.1 skrll (bfd *, symindex) ATTRIBUTE_HIDDEN; 306 1.1.1.7 christos #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt 307 1.1 skrll #define _bfd_noarchive_update_armap_timestamp _bfd_bool_bfd_false_error 308 1.1 skrll 309 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style 310 1.1 skrll archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */ 311 1.1 skrll 312 1.1 skrll #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap 313 1.1 skrll #define _bfd_archive_bsd_slurp_extended_name_table \ 314 1.1.1.9 christos _bfd_slurp_extended_name_table 315 1.1.1.7 christos extern bool _bfd_archive_bsd_construct_extended_name_table 316 1.1 skrll (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; 317 1.1.1.6 christos #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname 318 1.1 skrll #define _bfd_archive_bsd_write_armap _bfd_bsd_write_armap 319 1.1.1.2 christos #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr 320 1.1 skrll #define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr 321 1.1 skrll #define _bfd_archive_bsd_openr_next_archived_file \ 322 1.1 skrll bfd_generic_openr_next_archived_file 323 1.1 skrll #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index 324 1.1 skrll #define _bfd_archive_bsd_generic_stat_arch_elt \ 325 1.1.1.9 christos bfd_generic_stat_arch_elt 326 1.1.1.7 christos extern bool _bfd_archive_bsd_update_armap_timestamp 327 1.1 skrll (bfd *) ATTRIBUTE_HIDDEN; 328 1.1 skrll 329 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style 330 1.1 skrll archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ 331 1.1 skrll 332 1.1 skrll #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap 333 1.1 skrll #define _bfd_archive_coff_slurp_extended_name_table \ 334 1.1.1.9 christos _bfd_slurp_extended_name_table 335 1.1.1.7 christos extern bool _bfd_archive_coff_construct_extended_name_table 336 1.1 skrll (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; 337 1.1.1.6 christos #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname 338 1.1 skrll #define _bfd_archive_coff_write_armap _bfd_coff_write_armap 339 1.1.1.2 christos #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr 340 1.1 skrll #define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr 341 1.1 skrll #define _bfd_archive_coff_openr_next_archived_file \ 342 1.1 skrll bfd_generic_openr_next_archived_file 343 1.1 skrll #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index 344 1.1 skrll #define _bfd_archive_coff_generic_stat_arch_elt \ 345 1.1.1.7 christos bfd_generic_stat_arch_elt 346 1.1 skrll #define _bfd_archive_coff_update_armap_timestamp _bfd_bool_bfd_true 347 1.1.1.2 christos 348 1.1.1.2 christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style 349 1.1.1.2 christos archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44). */ 350 1.1.1.2 christos 351 1.1.1.2 christos #define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap 352 1.1.1.2 christos #define _bfd_archive_bsd44_slurp_extended_name_table \ 353 1.1.1.9 christos _bfd_slurp_extended_name_table 354 1.1.1.7 christos extern bool _bfd_archive_bsd44_construct_extended_name_table 355 1.1.1.2 christos (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; 356 1.1.1.6 christos #define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname 357 1.1.1.2 christos #define _bfd_archive_bsd44_write_armap _bfd_bsd_write_armap 358 1.1.1.2 christos #define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr 359 1.1.1.2 christos #define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr 360 1.1.1.2 christos #define _bfd_archive_bsd44_openr_next_archived_file \ 361 1.1.1.2 christos bfd_generic_openr_next_archived_file 362 1.1.1.2 christos #define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index 363 1.1.1.2 christos #define _bfd_archive_bsd44_generic_stat_arch_elt \ 364 1.1.1.2 christos bfd_generic_stat_arch_elt 365 1.1.1.2 christos #define _bfd_archive_bsd44_update_armap_timestamp \ 366 1.1.1.2 christos _bfd_archive_bsd_update_armap_timestamp 367 1.1.1.2 christos 368 1.1.1.2 christos /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get VMS style 369 1.1.1.6 christos archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_vms_lib). Some of them 370 1.1.1.2 christos are irrelevant. */ 371 1.1.1.9 christos 372 1.1.1.7 christos extern bool _bfd_vms_lib_write_archive_contents 373 1.1.1.6 christos (bfd *) ATTRIBUTE_HIDDEN; 374 1.1.1.6 christos #define _bfd_vms_lib_slurp_armap _bfd_noarchive_slurp_armap 375 1.1.1.6 christos #define _bfd_vms_lib_slurp_extended_name_table \ 376 1.1.1.6 christos _bfd_noarchive_slurp_extended_name_table 377 1.1.1.6 christos #define _bfd_vms_lib_construct_extended_name_table \ 378 1.1.1.6 christos _bfd_noarchive_construct_extended_name_table 379 1.1.1.6 christos #define _bfd_vms_lib_truncate_arname _bfd_noarchive_truncate_arname 380 1.1.1.6 christos #define _bfd_vms_lib_write_armap _bfd_noarchive_write_armap 381 1.1.1.6 christos #define _bfd_vms_lib_read_ar_hdr _bfd_noarchive_read_ar_hdr 382 1.1.1.7 christos #define _bfd_vms_lib_write_ar_hdr _bfd_noarchive_write_ar_hdr 383 1.1.1.7 christos extern bfd *_bfd_vms_lib_openr_next_archived_file 384 1.1.1.7 christos (bfd *, bfd *) ATTRIBUTE_HIDDEN; 385 1.1.1.7 christos extern bfd *_bfd_vms_lib_get_elt_at_index 386 1.1.1.7 christos (bfd *, symindex) ATTRIBUTE_HIDDEN; 387 1.1.1.7 christos extern int _bfd_vms_lib_generic_stat_arch_elt 388 1.1.1.7 christos (bfd *, struct stat *) ATTRIBUTE_HIDDEN; 389 1.1.1.2 christos #define _bfd_vms_lib_update_armap_timestamp _bfd_bool_bfd_true 390 1.1.1.2 christos 391 1.1.1.2 christos /* Extra routines for VMS style archives. */ 392 1.1.1.7 christos 393 1.1.1.7 christos extern symindex _bfd_vms_lib_find_symbol 394 1.1.1.7 christos (bfd *, const char *) ATTRIBUTE_HIDDEN; 395 1.1.1.7 christos extern bfd *_bfd_vms_lib_get_imagelib_file 396 1.1.1.9 christos (bfd *) ATTRIBUTE_HIDDEN; 397 1.1.1.7 christos extern bfd_cleanup _bfd_vms_lib_alpha_archive_p 398 1.1.1.9 christos (bfd *) ATTRIBUTE_HIDDEN; 399 1.1.1.7 christos extern bfd_cleanup _bfd_vms_lib_ia64_archive_p 400 1.1.1.9 christos (bfd *) ATTRIBUTE_HIDDEN; 401 1.1.1.7 christos extern bool _bfd_vms_lib_alpha_mkarchive 402 1.1.1.9 christos (bfd *) ATTRIBUTE_HIDDEN; 403 1.1.1.7 christos extern bool _bfd_vms_lib_ia64_mkarchive 404 1.1.1.2 christos (bfd *) ATTRIBUTE_HIDDEN; 405 1.1 skrll 406 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol 407 1.1 skrll support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ 408 1.1.1.11 christos 409 1.1.1.7 christos #define _bfd_nosymbols_get_symtab_upper_bound _bfd_long_bfd_0 410 1.1.1.7 christos extern long _bfd_nosymbols_canonicalize_symtab 411 1.1 skrll (bfd *, asymbol **) ATTRIBUTE_HIDDEN; 412 1.1.1.7 christos #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol 413 1.1.1.7 christos extern void _bfd_nosymbols_print_symbol 414 1.1.1.7 christos (bfd *, void *, asymbol *, bfd_print_symbol_type) ATTRIBUTE_HIDDEN; 415 1.1.1.7 christos extern void _bfd_nosymbols_get_symbol_info 416 1.1.1.7 christos (bfd *, asymbol *, symbol_info *) ATTRIBUTE_HIDDEN; 417 1.1.1.9 christos extern const char * _bfd_nosymbols_get_symbol_version_string 418 1.1.1.9 christos (bfd *, asymbol *, bool, bool *) ATTRIBUTE_HIDDEN; 419 1.1.1.7 christos extern bool _bfd_nosymbols_bfd_is_local_label_name 420 1.1.1.7 christos (bfd *, const char *) ATTRIBUTE_HIDDEN; 421 1.1.1.7 christos #define _bfd_nosymbols_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false 422 1.1.1.7 christos extern alent *_bfd_nosymbols_get_lineno 423 1.1.1.9 christos (bfd *, asymbol *) ATTRIBUTE_HIDDEN; 424 1.1.1.7 christos extern bool _bfd_nosymbols_find_nearest_line 425 1.1.1.7 christos (bfd *, asymbol **, asection *, bfd_vma, 426 1.1.1.7 christos const char **, const char **, unsigned int *, unsigned int *) 427 1.1.1.10 christos ATTRIBUTE_HIDDEN; 428 1.1.1.10 christos extern bool _bfd_nosymbols_find_nearest_line_with_alt 429 1.1.1.10 christos (bfd *, const char *, asymbol **, asection *, bfd_vma, 430 1.1.1.10 christos const char **, const char **, unsigned int *, unsigned int *) 431 1.1.1.9 christos ATTRIBUTE_HIDDEN; 432 1.1.1.7 christos extern bool _bfd_nosymbols_find_line 433 1.1.1.7 christos (bfd *, asymbol **, asymbol *, const char **, unsigned int *) 434 1.1.1.9 christos ATTRIBUTE_HIDDEN; 435 1.1.1.7 christos extern bool _bfd_nosymbols_find_inliner_info 436 1.1.1.7 christos (bfd *, const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; 437 1.1.1.10 christos extern asymbol *_bfd_nosymbols_bfd_make_debug_symbol 438 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 439 1.1.1.9 christos extern long _bfd_nosymbols_read_minisymbols 440 1.1.1.7 christos (bfd *, bool, void **, unsigned int *) ATTRIBUTE_HIDDEN; 441 1.1.1.9 christos extern asymbol *_bfd_nosymbols_minisymbol_to_symbol 442 1.1 skrll (bfd *, bool, const void *, asymbol *) ATTRIBUTE_HIDDEN; 443 1.1 skrll 444 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc 445 1.1 skrll support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ 446 1.1.1.7 christos 447 1.1.1.7 christos extern long _bfd_norelocs_get_reloc_upper_bound 448 1.1.1.7 christos (bfd *, asection *) ATTRIBUTE_HIDDEN; 449 1.1.1.7 christos extern long _bfd_norelocs_canonicalize_reloc 450 1.1.1.12 christos (bfd *, asection *, arelent **, asymbol **) ATTRIBUTE_HIDDEN; 451 1.1.1.7 christos extern bool _bfd_norelocs_finalize_section_relocs 452 1.1.1.7 christos (bfd *, asection *, arelent **, unsigned int) ATTRIBUTE_HIDDEN; 453 1.1.1.7 christos extern reloc_howto_type *_bfd_norelocs_bfd_reloc_type_lookup 454 1.1.1.7 christos (bfd *, bfd_reloc_code_real_type) ATTRIBUTE_HIDDEN; 455 1.1.1.7 christos extern reloc_howto_type *_bfd_norelocs_bfd_reloc_name_lookup 456 1.1 skrll (bfd *, const char *) ATTRIBUTE_HIDDEN; 457 1.1 skrll 458 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not 459 1.1 skrll be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ 460 1.1.1.9 christos 461 1.1.1.7 christos extern bool _bfd_nowrite_set_arch_mach 462 1.1.1.9 christos (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_HIDDEN; 463 1.1.1.7 christos extern bool _bfd_nowrite_set_section_contents 464 1.1 skrll (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; 465 1.1 skrll 466 1.1 skrll /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use 467 1.1 skrll BFD_JUMP_TABLE_WRITE (_bfd_generic). */ 468 1.1 skrll 469 1.1.1.9 christos #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach 470 1.1.1.7 christos extern bool _bfd_generic_set_section_contents 471 1.1 skrll (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; 472 1.1 skrll 473 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not 474 1.1 skrll support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ 475 1.1.1.7 christos 476 1.1.1.7 christos extern int _bfd_nolink_sizeof_headers 477 1.1.1.7 christos (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 478 1.1.1.7 christos extern bfd_byte *_bfd_nolink_bfd_get_relocated_section_contents 479 1.1.1.9 christos (bfd *, struct bfd_link_info *, struct bfd_link_order *, 480 1.1.1.9 christos bfd_byte *, bool, asymbol **) ATTRIBUTE_HIDDEN; 481 1.1.1.9 christos extern bool _bfd_nolink_bfd_relax_section 482 1.1.1.7 christos (bfd *, asection *, struct bfd_link_info *, bool *) ATTRIBUTE_HIDDEN; 483 1.1.1.9 christos #define _bfd_nolink_bfd_gc_sections _bfd_bool_bfd_link_false_error 484 1.1.1.7 christos extern bool _bfd_nolink_bfd_lookup_section_flags 485 1.1.1.9 christos (struct bfd_link_info *, struct flag_info *, asection *) ATTRIBUTE_HIDDEN; 486 1.1.1.7 christos extern bool _bfd_nolink_bfd_is_group_section 487 1.1.1.8 christos (bfd *, const asection *) ATTRIBUTE_HIDDEN; 488 1.1.1.8 christos extern const char *_bfd_nolink_bfd_group_name 489 1.1.1.9 christos (bfd *, const asection *) ATTRIBUTE_HIDDEN; 490 1.1.1.7 christos extern bool _bfd_nolink_bfd_discard_group 491 1.1.1.7 christos (bfd *, asection *) ATTRIBUTE_HIDDEN; 492 1.1.1.7 christos extern struct bfd_link_hash_table *_bfd_nolink_bfd_link_hash_table_create 493 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 494 1.1.1.7 christos #define _bfd_nolink_bfd_link_add_symbols _bfd_bool_bfd_link_false_error 495 1.1.1.7 christos extern void _bfd_nolink_bfd_link_just_syms 496 1.1.1.7 christos (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 497 1.1.1.7 christos extern void _bfd_nolink_bfd_copy_link_hash_symbol_type 498 1.1.1.7 christos (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *) 499 1.1.1.7 christos ATTRIBUTE_HIDDEN; 500 1.1.1.9 christos #define _bfd_nolink_bfd_final_link _bfd_bool_bfd_link_false_error 501 1.1.1.7 christos extern bool _bfd_nolink_bfd_link_split_section 502 1.1.1.9 christos (bfd *, struct bfd_section *) ATTRIBUTE_HIDDEN; 503 1.1.1.7 christos extern bool _bfd_nolink_section_already_linked 504 1.1.1.9 christos (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 505 1.1.1.7 christos extern bool _bfd_nolink_bfd_define_common_symbol 506 1.1.1.7 christos (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *) 507 1.1.1.7 christos ATTRIBUTE_HIDDEN; 508 1.1.1.7 christos #define _bfd_nolink_bfd_link_hide_symbol \ 509 1.1.1.7 christos _bfd_generic_link_hide_symbol 510 1.1.1.7 christos extern struct bfd_link_hash_entry *_bfd_nolink_bfd_define_start_stop 511 1.1.1.5 christos (struct bfd_link_info *, const char *, asection *) ATTRIBUTE_HIDDEN; 512 1.1.1.5 christos #define _bfd_nolink_bfd_link_check_relocs \ 513 1.1 skrll _bfd_generic_link_check_relocs 514 1.1 skrll 515 1.1 skrll /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not 516 1.1 skrll have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC 517 1.1 skrll (_bfd_nodynamic). */ 518 1.1.1.7 christos 519 1.1 skrll #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_long_bfd_n1_error 520 1.1.1.7 christos #define _bfd_nodynamic_canonicalize_dynamic_symtab \ 521 1.1.1.7 christos _bfd_nosymbols_canonicalize_symtab 522 1.1.1.7 christos extern long _bfd_nodynamic_get_synthetic_symtab 523 1.1.1.7 christos (bfd *, long, asymbol **, long, asymbol **, asymbol **) ATTRIBUTE_HIDDEN; 524 1.1.1.7 christos #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_long_bfd_n1_error 525 1.1.1.7 christos extern long _bfd_nodynamic_canonicalize_dynamic_reloc 526 1.1 skrll (bfd *, arelent **, asymbol **) ATTRIBUTE_HIDDEN; 527 1.1 skrll 528 1.1 skrll /* Generic routine to determine of the given symbol is a local 530 1.1.1.7 christos label. */ 531 1.1 skrll extern bool bfd_generic_is_local_label_name 532 1.1 skrll (bfd *, const char *) ATTRIBUTE_HIDDEN; 533 1.1 skrll 534 1.1.1.9 christos /* Generic minisymbol routines. */ 535 1.1 skrll extern long _bfd_generic_read_minisymbols 536 1.1.1.9 christos (bfd *, bool, void **, unsigned int *) ATTRIBUTE_HIDDEN; 537 1.1 skrll extern asymbol *_bfd_generic_minisymbol_to_symbol 538 1.1 skrll (bfd *, bool, const void *, asymbol *) ATTRIBUTE_HIDDEN; 539 1.1.1.9 christos 540 1.1.1.9 christos /* Find the nearest line using .stab/.stabstr sections. */ 541 1.1.1.7 christos extern bool _bfd_stab_section_find_nearest_line 542 1.1 skrll (bfd *, asymbol **, asection *, bfd_vma, bool *, 543 1.1 skrll const char **, const char **, unsigned int *, void **) ATTRIBUTE_HIDDEN; 544 1.1.1.9 christos 545 1.1.1.4 christos /* Find the nearest line using DWARF 1 debugging information. */ 546 1.1.1.7 christos extern bool _bfd_dwarf1_find_nearest_line 547 1.1 skrll (bfd *, asymbol **, asection *, bfd_vma, 548 1.1.1.10 christos const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; 549 1.1.1.10 christos 550 1.1.1.10 christos /* Clean up the data used to handle DWARF 1 debugging information. */ 551 1.1.1.10 christos extern void _bfd_dwarf1_cleanup_debug_info 552 1.1.1.3 christos (bfd *, void **) ATTRIBUTE_HIDDEN; 553 1.1.1.3 christos 554 1.1.1.7 christos struct dwarf_debug_section 555 1.1.1.7 christos { 556 1.1.1.3 christos const char * uncompressed_name; 557 1.1.1.3 christos const char * compressed_name; 558 1.1.1.3 christos }; 559 1.1.1.3 christos 560 1.1.1.3 christos /* Map of uncompressed DWARF debug section name to compressed one. It 561 1.1.1.7 christos is terminated by NULL uncompressed_name. */ 562 1.1.1.3 christos 563 1.1 skrll extern const struct dwarf_debug_section dwarf_debug_sections[] ATTRIBUTE_HIDDEN; 564 1.1.1.8 christos 565 1.1.1.4 christos /* Find the nearest line using DWARF 2 debugging information. */ 566 1.1.1.4 christos extern int _bfd_dwarf2_find_nearest_line 567 1.1.1.8 christos (bfd *, asymbol **, asymbol *, asection *, bfd_vma, 568 1.1.1.4 christos const char **, const char **, unsigned int *, unsigned int *, 569 1.1.1.10 christos const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN; 570 1.1.1.10 christos 571 1.1.1.10 christos /* Find the nearest line using DWARF 2 debugging information, with 572 1.1.1.10 christos the option of specifying a .gnu_debugaltlink file. */ 573 1.1.1.10 christos extern int _bfd_dwarf2_find_nearest_line_with_alt 574 1.1.1.10 christos (bfd *, const char *, asymbol **, asymbol *, asection *, bfd_vma, 575 1.1.1.10 christos const char **, const char **, unsigned int *, unsigned int *, 576 1.1.1.4 christos const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN; 577 1.1.1.4 christos 578 1.1.1.7 christos /* Find the bias between DWARF addresses and real addresses. */ 579 1.1.1.3 christos extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias 580 1.1 skrll (asymbol **, void **) ATTRIBUTE_HIDDEN; 581 1.1.1.9 christos 582 1.1.1.7 christos /* Find inliner info after calling bfd_find_nearest_line. */ 583 1.1.1.7 christos extern bool _bfd_dwarf2_find_inliner_info 584 1.1.1.3 christos (bfd *, const char **, const char **, unsigned int *, void **) 585 1.1.1.3 christos ATTRIBUTE_HIDDEN; 586 1.1.1.9 christos 587 1.1.1.4 christos /* Read DWARF 2 debugging information. */ 588 1.1.1.9 christos extern bool _bfd_dwarf2_slurp_debug_info 589 1.1.1.3 christos (bfd *, bfd *, const struct dwarf_debug_section *, asymbol **, void **, 590 1.1.1.3 christos bool) ATTRIBUTE_HIDDEN; 591 1.1.1.3 christos 592 1.1.1.7 christos /* Clean up the data used to handle DWARF 2 debugging information. */ 593 1.1.1.3 christos extern void _bfd_dwarf2_cleanup_debug_info 594 1.1.1.10 christos (bfd *, void **) ATTRIBUTE_HIDDEN; 595 1.1.1.10 christos 596 1.1.1.10 christos extern void _bfd_stab_cleanup 597 1.1 skrll (bfd *, void **) ATTRIBUTE_HIDDEN; 598 1.1 skrll 599 1.1.1.7 christos /* Create a new section entry. */ 600 1.1.1.7 christos extern struct bfd_hash_entry *bfd_section_hash_newfunc 601 1.1 skrll (struct bfd_hash_entry *, struct bfd_hash_table *, const char *) 602 1.1 skrll ATTRIBUTE_HIDDEN; 603 1.1 skrll 604 1.1 skrll /* A routine to create entries for a bfd_link_hash_table. */ 605 1.1.1.7 christos extern struct bfd_hash_entry *_bfd_link_hash_newfunc 606 1.1 skrll (struct bfd_hash_entry *entry, struct bfd_hash_table *table, 607 1.1 skrll const char *string) ATTRIBUTE_HIDDEN; 608 1.1.1.9 christos 609 1.1 skrll /* Initialize a bfd_link_hash_table. */ 610 1.1 skrll extern bool _bfd_link_hash_table_init 611 1.1 skrll (struct bfd_link_hash_table *, bfd *, 612 1.1 skrll struct bfd_hash_entry *(*) (struct bfd_hash_entry *, 613 1.1.1.7 christos struct bfd_hash_table *, 614 1.1 skrll const char *), 615 1.1 skrll unsigned int) ATTRIBUTE_HIDDEN; 616 1.1 skrll 617 1.1.1.7 christos /* Generic link hash table creation routine. */ 618 1.1 skrll extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create 619 1.1 skrll (bfd *) ATTRIBUTE_HIDDEN; 620 1.1 skrll 621 1.1.1.7 christos /* Generic link hash table destruction routine. */ 622 1.1 skrll extern void _bfd_generic_link_hash_table_free 623 1.1 skrll (bfd *) ATTRIBUTE_HIDDEN; 624 1.1.1.9 christos 625 1.1.1.7 christos /* Generic add symbol routine. */ 626 1.1 skrll extern bool _bfd_generic_link_add_symbols 627 1.1 skrll (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 628 1.1.1.9 christos 629 1.1 skrll /* Generic archive add symbol routine. */ 630 1.1.1.9 christos extern bool _bfd_generic_link_add_archive_symbols 631 1.1.1.4 christos (bfd *, struct bfd_link_info *, 632 1.1.1.9 christos bool (*) (bfd *, struct bfd_link_info *, 633 1.1 skrll struct bfd_link_hash_entry *, const char *, 634 1.1 skrll bool *)) ATTRIBUTE_HIDDEN; 635 1.1 skrll 636 1.1 skrll /* Forward declaration to avoid prototype errors. */ 637 1.1 skrll typedef struct bfd_link_hash_entry _bfd_link_hash_entry; 638 1.1 skrll 639 1.1.1.7 christos /* Generic routine to mark section as supplying symbols only. */ 640 1.1 skrll extern void _bfd_generic_link_just_syms 641 1.1.1.2 christos (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 642 1.1.1.2 christos 643 1.1.1.7 christos /* Generic routine that does nothing. */ 644 1.1.1.7 christos extern void _bfd_generic_copy_link_hash_symbol_type 645 1.1.1.2 christos (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *) 646 1.1 skrll ATTRIBUTE_HIDDEN; 647 1.1.1.9 christos 648 1.1.1.7 christos /* Generic link routine. */ 649 1.1 skrll extern bool _bfd_generic_final_link 650 1.1.1.9 christos (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 651 1.1.1.7 christos 652 1.1 skrll extern bool _bfd_generic_link_split_section 653 1.1.1.9 christos (bfd *, struct bfd_section *) ATTRIBUTE_HIDDEN; 654 1.1.1.7 christos 655 1.1 skrll extern bool _bfd_generic_section_already_linked 656 1.1 skrll (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; 657 1.1.1.9 christos 658 1.1.1.7 christos /* Generic reloc_link_order processing routine. */ 659 1.1.1.7 christos extern bool _bfd_generic_reloc_link_order 660 1.1 skrll (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *) 661 1.1 skrll ATTRIBUTE_HIDDEN; 662 1.1.1.9 christos 663 1.1.1.7 christos /* Default link order processing routine. */ 664 1.1.1.7 christos extern bool _bfd_default_link_order 665 1.1 skrll (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *) 666 1.1 skrll ATTRIBUTE_HIDDEN; 667 1.1 skrll 668 1.1.1.7 christos /* Count the number of reloc entries in a link order list. */ 669 1.1 skrll extern unsigned int _bfd_count_link_order_relocs 670 1.1 skrll (struct bfd_link_order *) ATTRIBUTE_HIDDEN; 671 1.1 skrll 672 1.1 skrll /* Final link relocation routine. */ 673 1.1.1.7 christos extern bfd_reloc_status_type _bfd_final_link_relocate 674 1.1 skrll (reloc_howto_type *, bfd *, asection *, bfd_byte *, 675 1.1 skrll bfd_vma, bfd_vma, bfd_vma) ATTRIBUTE_HIDDEN; 676 1.1 skrll 677 1.1.1.7 christos /* Relocate a particular location by a howto and a value. */ 678 1.1 skrll extern bfd_reloc_status_type _bfd_relocate_contents 679 1.1 skrll (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN; 680 1.1.1.8 christos 681 1.1.1.8 christos /* Clear a given location using a given howto. */ 682 1.1 skrll extern bfd_reloc_status_type _bfd_clear_contents 683 1.1 skrll (reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma) ATTRIBUTE_HIDDEN; 684 1.1 skrll 685 1.1.1.9 christos /* Write out a merged section. */ 686 1.1.1.12 christos 687 1.1 skrll extern bool _bfd_write_merged_section 688 1.1 skrll (bfd *, asection *) ATTRIBUTE_HIDDEN; 689 1.1 skrll 690 1.1 skrll /* Find an offset within a modified SEC_MERGE section. */ 691 1.1.1.12 christos 692 1.1 skrll extern bfd_vma _bfd_merged_section_offset 693 1.1.1.4 christos (bfd *, asection **, bfd_vma) ATTRIBUTE_HIDDEN; 694 1.1.1.4 christos 695 1.1.1.7 christos /* Tidy up when done. */ 696 1.1.1.4 christos 697 1.1 skrll extern void _bfd_merge_sections_free (void *) ATTRIBUTE_HIDDEN; 698 1.1 skrll 699 1.1 skrll /* Macros to tell if bfds are read or write enabled. 700 1.1 skrll 701 1.1 skrll Note that bfds open for read may be scribbled into if the fd passed 702 1.1 skrll to bfd_fdopenr is actually open both for read and write 703 1.1 skrll simultaneously. However an output bfd will never be open for 704 1.1 skrll read. Therefore sometimes you want to check bfd_read_p or 705 1.1 skrll !bfd_read_p, and only sometimes bfd_write_p. 706 1.1 skrll */ 707 1.1 skrll 708 1.1 skrll #define bfd_read_p(abfd) \ 709 1.1 skrll ((abfd)->direction == read_direction || (abfd)->direction == both_direction) 710 1.1 skrll #define bfd_write_p(abfd) \ 711 1.1.1.7 christos ((abfd)->direction == write_direction || (abfd)->direction == both_direction) 712 1.1.1.7 christos 713 1.1 skrll extern void bfd_assert 714 1.1 skrll (const char*,int) ATTRIBUTE_HIDDEN; 715 1.1 skrll 716 1.1 skrll #define BFD_ASSERT(x) \ 717 1.1 skrll do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0) 718 1.1 skrll 719 1.1 skrll #define BFD_FAIL() \ 720 1.1 skrll do { bfd_assert(__FILE__,__LINE__); } while (0) 721 1.1.1.7 christos 722 1.1 skrll extern void _bfd_abort 723 1.1 skrll (const char *, int, const char *) ATTRIBUTE_NORETURN ATTRIBUTE_HIDDEN; 724 1.1 skrll 725 1.1 skrll /* if gcc >= 2.6, we can give a function name, too */ 726 1.1 skrll #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) 727 1.1 skrll #define __PRETTY_FUNCTION__ ((char *) NULL) 728 1.1 skrll #endif 729 1.1 skrll 730 1.1 skrll #undef abort 731 1.1 skrll #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) 732 1.1 skrll 733 1.1.1.7 christos /* Manipulate a system FILE but using BFD's "file_ptr", rather than 734 1.1.1.7 christos the system "off_t" or "off64_t", as the offset. */ 735 1.1.1.7 christos extern file_ptr _bfd_real_ftell 736 1.1.1.7 christos (FILE *) ATTRIBUTE_HIDDEN; 737 1.1.1.7 christos extern int _bfd_real_fseek 738 1.1.1.7 christos (FILE *, file_ptr, int) ATTRIBUTE_HIDDEN; 739 1.1 skrll extern FILE *_bfd_real_fopen 740 1.1 skrll (const char *, const char *) ATTRIBUTE_HIDDEN; 741 1.1 skrll 742 1.1.1.9 christos /* List of supported target vectors, and the default vector (if 743 1.1.1.7 christos bfd_default_vector[0] is NULL, there is no default). */ 744 1.1 skrll extern const bfd_target *const *const bfd_target_vector ATTRIBUTE_HIDDEN; 745 1.1 skrll extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN; 746 1.1.1.9 christos 747 1.1 skrll /* List of associated target vectors. */ 748 1.1 skrll extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN; 749 1.1 skrll 750 1.1 skrll /* Functions shared by the ECOFF and MIPS ELF backends, which have no 751 1.1.1.10 christos other common header files. */ 752 1.1.1.10 christos 753 1.1.1.10 christos struct ecoff_debug_info; 754 1.1 skrll struct ecoff_debug_swap; 755 1.1 skrll struct ecoff_extr; 756 1.1.1.10 christos struct ecoff_find_line; 757 1.1.1.10 christos 758 1.1.1.9 christos extern void _bfd_ecoff_free_ecoff_debug_info 759 1.1 skrll (struct ecoff_debug_info *debug); 760 1.1 skrll extern bool _bfd_ecoff_locate_line 761 1.1.1.7 christos (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, 762 1.1.1.9 christos const struct ecoff_debug_swap * const, struct ecoff_find_line *, 763 1.1.1.7 christos const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; 764 1.1.1.9 christos extern bool _bfd_ecoff_get_accumulated_pdr 765 1.1.1.7 christos (void *, bfd_byte *) ATTRIBUTE_HIDDEN; 766 1.1.1.9 christos extern bool _bfd_ecoff_get_accumulated_sym 767 1.1.1.7 christos (void *, bfd_byte *) ATTRIBUTE_HIDDEN; 768 1.1 skrll extern bool _bfd_ecoff_get_accumulated_ss 769 1.1 skrll (void *, bfd_byte *) ATTRIBUTE_HIDDEN; 770 1.1.1.7 christos 771 1.1 skrll extern bfd_vma _bfd_get_gp_value 772 1.1.1.7 christos (bfd *) ATTRIBUTE_HIDDEN; 773 1.1 skrll extern void _bfd_set_gp_value 774 1.1 skrll (bfd *, bfd_vma) ATTRIBUTE_HIDDEN; 775 1.1 skrll 776 1.1 skrll /* Function shared by the COFF and ELF SH backends, which have no 777 1.1 skrll other common header files. */ 778 1.1.1.9 christos 779 1.1 skrll #ifndef _bfd_sh_align_load_span 780 1.1.1.9 christos extern bool _bfd_sh_align_load_span 781 1.1.1.9 christos (bfd *, asection *, bfd_byte *, 782 1.1 skrll bool (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma), 783 1.1 skrll void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bool *) ATTRIBUTE_HIDDEN; 784 1.1 skrll #endif 785 1.1 skrll 786 1.1 skrll /* This is the shape of the elements inside the already_linked hash 787 1.1 skrll table. It maps a name onto a list of already_linked elements with 788 1.1 skrll the same name. */ 789 1.1 skrll 790 1.1 skrll struct bfd_section_already_linked_hash_entry 791 1.1 skrll { 792 1.1 skrll struct bfd_hash_entry root; 793 1.1 skrll struct bfd_section_already_linked *entry; 794 1.1 skrll }; 795 1.1 skrll 796 1.1 skrll struct bfd_section_already_linked 797 1.1 skrll { 798 1.1 skrll struct bfd_section_already_linked *next; 799 1.1 skrll asection *sec; 800 1.1 skrll }; 801 1.1.1.7 christos 802 1.1.1.9 christos extern struct bfd_section_already_linked_hash_entry * 803 1.1.1.7 christos bfd_section_already_linked_table_lookup (const char *) ATTRIBUTE_HIDDEN; 804 1.1.1.7 christos extern bool bfd_section_already_linked_table_insert 805 1.1 skrll (struct bfd_section_already_linked_hash_entry *, asection *) 806 1.1.1.9 christos ATTRIBUTE_HIDDEN; 807 1.1.1.7 christos extern void bfd_section_already_linked_table_traverse 808 1.1 skrll (bool (*) (struct bfd_section_already_linked_hash_entry *, 809 1.1.1.7 christos void *), void *) ATTRIBUTE_HIDDEN; 810 1.1.1.7 christos 811 1.1.1.7 christos extern bfd_vma _bfd_read_unsigned_leb128 812 1.1.1.7 christos (bfd *, bfd_byte *, unsigned int *) ATTRIBUTE_HIDDEN; 813 1.1.1.7 christos extern bfd_signed_vma _bfd_read_signed_leb128 814 1.1.1.9 christos (bfd *, bfd_byte *, unsigned int *) ATTRIBUTE_HIDDEN; 815 1.1.1.9 christos extern bfd_vma _bfd_safe_read_leb128 816 1.1.1.9 christos (bfd *, bfd_byte **, bool, const bfd_byte * const) ATTRIBUTE_HIDDEN; 817 1.1.1.9 christos extern bfd_byte * _bfd_write_unsigned_leb128 818 1.1.1.11 christos (bfd_byte *, bfd_byte *, bfd_vma) ATTRIBUTE_HIDDEN; 819 1.1.1.7 christos 820 1.1.1.9 christos extern struct bfd_link_info *_bfd_get_link_info (bfd *) 821 1.1.1.11 christos ATTRIBUTE_HIDDEN; 822 1.1.1.11 christos 823 1.1.1.11 christos #ifdef HAVE_MMAP 824 1.1.1.11 christos extern uintptr_t _bfd_pagesize ATTRIBUTE_HIDDEN; 825 1.1.1.11 christos extern uintptr_t _bfd_pagesize_m1 ATTRIBUTE_HIDDEN; 826 1.1.1.11 christos extern uintptr_t _bfd_minimum_mmap_size ATTRIBUTE_HIDDEN; 827 1.1.1.9 christos #endif 828 1.1.1.9 christos 829 1.1.1.9 christos #if GCC_VERSION >= 7000 830 1.1.1.9 christos #define _bfd_mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res) 831 1.1.1.9 christos #else 832 1.1.1.9 christos /* Assumes unsigned values. Careful! Args evaluated multiple times. */ 833 1.1.1.9 christos #define _bfd_mul_overflow(a, b, res) \ 834 1.1.1.9 christos ((*res) = (a), (*res) *= (b), (b) != 0 && (*res) / (b) != (a)) 835 1.1.1.9 christos #endif 836 1.1.1.9 christos 837 1.1.1.9 christos #ifdef __GNUC__ 838 1.1.1.9 christos #define _bfd_constant_p(v) __builtin_constant_p (v) 839 1.1.1.9 christos #else 840 1.1.1.9 christos #define _bfd_constant_p(v) 0 841 1.1.1.10 christos #endif 842 1.1.1.9 christos 843 1.1.1.9 christos static inline void * 844 1.1.1.10 christos _bfd_alloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) 845 1.1.1.9 christos { 846 1.1.1.9 christos void *mem; 847 1.1.1.9 christos if (!_bfd_constant_p (rsize)) 848 1.1.1.9 christos { 849 1.1.1.9 christos ufile_ptr filesize = bfd_get_file_size (abfd); 850 1.1.1.9 christos if (filesize != 0 && rsize > filesize) 851 1.1.1.9 christos { 852 1.1.1.9 christos bfd_set_error (bfd_error_file_truncated); 853 1.1.1.9 christos return NULL; 854 1.1.1.9 christos } 855 1.1.1.9 christos } 856 1.1.1.9 christos mem = bfd_alloc (abfd, asize); 857 1.1.1.10 christos if (mem != NULL) 858 1.1.1.9 christos { 859 1.1.1.9 christos if (bfd_read (mem, rsize, abfd) == rsize) 860 1.1.1.9 christos return mem; 861 1.1.1.9 christos bfd_release (abfd, mem); 862 1.1.1.9 christos } 863 1.1.1.9 christos return NULL; 864 1.1.1.10 christos } 865 1.1.1.9 christos 866 1.1.1.9 christos static inline void * 867 1.1.1.10 christos _bfd_malloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize) 868 1.1.1.9 christos { 869 1.1.1.9 christos void *mem; 870 1.1.1.9 christos if (!_bfd_constant_p (rsize)) 871 1.1.1.9 christos { 872 1.1.1.9 christos ufile_ptr filesize = bfd_get_file_size (abfd); 873 1.1.1.9 christos if (filesize != 0 && rsize > filesize) 874 1.1.1.9 christos { 875 1.1.1.9 christos bfd_set_error (bfd_error_file_truncated); 876 1.1.1.9 christos return NULL; 877 1.1.1.9 christos } 878 1.1.1.9 christos } 879 1.1.1.9 christos mem = bfd_malloc (asize); 880 1.1.1.10 christos if (mem != NULL) 881 1.1.1.9 christos { 882 1.1.1.9 christos if (bfd_read (mem, rsize, abfd) == rsize) 883 1.1.1.9 christos return mem; 884 1.1.1.9 christos free (mem); 885 1.1.1.9 christos } 886 1.1.1.11 christos return NULL; 887 1.1.1.11 christos } 888 1.1.1.11 christos 889 1.1.1.11 christos #ifdef USE_MMAP 890 1.1.1.11 christos extern void *_bfd_mmap_persistent 891 1.1.1.11 christos (bfd *, size_t) ATTRIBUTE_HIDDEN; 892 1.1.1.11 christos extern void *_bfd_mmap_temporary 893 1.1.1.11 christos (bfd *, size_t, void **, size_t *) ATTRIBUTE_HIDDEN; 894 1.1.1.11 christos extern void _bfd_munmap_temporary 895 1.1.1.11 christos (void *, size_t) ATTRIBUTE_HIDDEN; 896 1.1.1.11 christos #else 897 1.1.1.11 christos static inline void * 898 1.1.1.11 christos _bfd_mmap_persistent (bfd *abfd, size_t rsize) 899 1.1.1.11 christos { 900 1.1.1.11 christos return _bfd_alloc_and_read (abfd, rsize, rsize); 901 1.1.1.11 christos } 902 1.1.1.11 christos static inline void * 903 1.1.1.11 christos _bfd_mmap_temporary (bfd *abfd, size_t rsize, void **map_addr, 904 1.1.1.11 christos size_t *map_size) 905 1.1.1.11 christos { 906 1.1.1.11 christos void *mem = _bfd_malloc_and_read (abfd, rsize, rsize); 907 1.1.1.11 christos *map_addr = mem; 908 1.1.1.11 christos *map_size = rsize; 909 1.1.1.11 christos return mem; 910 1.1.1.11 christos } 911 1.1.1.11 christos static inline void 912 1.1.1.11 christos _bfd_munmap_temporary (void *ptr, size_t rsize ATTRIBUTE_UNUSED) 913 1.1.1.11 christos { 914 1.1.1.11 christos free (ptr); 915 1.1.1.11 christos } 916 1.1.1.11 christos #endif 917 1.1.1.11 christos 918 extern bool _bfd_mmap_read_temporary 919 (void **, size_t *, void **, bfd *, bool) ATTRIBUTE_HIDDEN; 920