Libbfd the Binary File Descriptor Library
Total Page:16
File Type:pdf, Size:1020Kb
libbfd The Binary File Descriptor Library First Edition|BFD version < 3.0 % Since no product is stable before version 3.0 :-) Original Document Created: April 1991 Steve Chamberlain Cygnus Support Free Software Foundation [email protected] BFD, 1.5 TEXinfo 2019-09-20.22 Copyright c 1991-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents 1 Introduction ::::::::::::::::::::::::::::::::::::: 1 1.1 History ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.2 How To Use BFD::::::::::::::::::::::::::::::::::::::::::::::: 1 1.3 What BFD Version 2 Can Do ::::::::::::::::::::::::::::::::::: 2 1.3.1 Information Loss::::::::::::::::::::::::::::::::::::::::::: 2 1.3.2 The BFD canonical object-file format :::::::::::::::::::::: 3 2 BFD Front End:::::::::::::::::::::::::::::::::: 5 2.1 typedef bfd:::::::::::::::::::::::::::::::::::::::::::::::::::: 5 2.2 Error reporting :::::::::::::::::::::::::::::::::::::::::::::::: 17 2.2.1 Type bfd_error_type :::::::::::::::::::::::::::::::::::: 17 2.2.1.1 bfd_get_error :::::::::::::::::::::::::::::::::::::: 18 2.2.1.2 bfd_set_error :::::::::::::::::::::::::::::::::::::: 18 2.2.1.3 bfd_set_input_error ::::::::::::::::::::::::::::::: 18 2.2.1.4 bfd_errmsg ::::::::::::::::::::::::::::::::::::::::: 18 2.2.1.5 bfd_perror ::::::::::::::::::::::::::::::::::::::::: 18 2.2.2 BFD error handler:::::::::::::::::::::::::::::::::::::::: 18 2.2.2.1 _bfd_error_handler :::::::::::::::::::::::::::::::: 19 2.2.2.2 bfd_set_error_handler :::::::::::::::::::::::::::: 19 2.2.2.3 bfd_set_error_program_name::::::::::::::::::::::: 19 2.2.3 BFD assert handler ::::::::::::::::::::::::::::::::::::::: 19 2.2.3.1 bfd_set_assert_handler ::::::::::::::::::::::::::: 19 2.3 Miscellaneous ::::::::::::::::::::::::::::::::::::::::::::::::: 20 2.3.1 Miscellaneous functions ::::::::::::::::::::::::::::::::::: 20 2.3.1.1 bfd_get_reloc_upper_bound :::::::::::::::::::::::: 20 2.3.1.2 bfd_canonicalize_reloc ::::::::::::::::::::::::::: 20 2.3.1.3 bfd_set_reloc :::::::::::::::::::::::::::::::::::::: 20 2.3.1.4 bfd_set_file_flags :::::::::::::::::::::::::::::::: 20 2.3.1.5 bfd_get_arch_size ::::::::::::::::::::::::::::::::: 21 2.3.1.6 bfd_get_sign_extend_vma :::::::::::::::::::::::::: 21 2.3.1.7 bfd_set_start_address :::::::::::::::::::::::::::: 21 2.3.1.8 bfd_get_gp_size:::::::::::::::::::::::::::::::::::: 21 2.3.1.9 bfd_set_gp_size:::::::::::::::::::::::::::::::::::: 21 2.3.1.10 bfd_scan_vma :::::::::::::::::::::::::::::::::::::: 22 2.3.1.11 bfd_copy_private_header_data ::::::::::::::::::: 22 2.3.1.12 bfd_copy_private_bfd_data::::::::::::::::::::::: 22 2.3.1.13 bfd_set_private_flags ::::::::::::::::::::::::::: 22 2.3.1.14 Other functions ::::::::::::::::::::::::::::::::::: 23 2.3.1.15 bfd_alt_mach_code :::::::::::::::::::::::::::::::: 25 2.3.1.16 bfd_emul_get_maxpagesize :::::::::::::::::::::::: 25 2.3.1.17 bfd_emul_get_commonpagesize :::::::::::::::::::: 25 2.3.1.18 bfd_demangle :::::::::::::::::::::::::::::::::::::: 25 2.3.1.19 bfd_update_compression_header :::::::::::::::::: 26 ii 2.3.1.20 bfd_check_compression_header ::::::::::::::::::: 26 2.3.1.21 bfd_get_compression_header_size:::::::::::::::: 26 2.3.1.22 bfd_convert_section_size :::::::::::::::::::::::: 26 2.3.1.23 bfd_convert_section_contents ::::::::::::::::::: 26 2.3.1.24 struct bfd_iovec:::::::::::::::::::::::::::::::::: 27 2.3.1.25 bfd_get_mtime ::::::::::::::::::::::::::::::::::::: 27 2.3.1.26 bfd_get_size :::::::::::::::::::::::::::::::::::::: 28 2.3.1.27 bfd_get_file_size :::::::::::::::::::::::::::::::: 28 2.3.1.28 bfd_mmap ::::::::::::::::::::::::::::::::::::::::::: 28 2.4 Memory Usage :::::::::::::::::::::::::::::::::::::::::::::::: 28 2.5 Initialization :::::::::::::::::::::::::::::::::::::::::::::::::: 29 2.5.1 Initialization functions :::::::::::::::::::::::::::::::::::: 29 2.5.1.1 bfd_init :::::::::::::::::::::::::::::::::::::::::::: 29 2.6 Sections ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 29 2.6.1 Section input ::::::::::::::::::::::::::::::::::::::::::::: 29 2.6.2 Section output:::::::::::::::::::::::::::::::::::::::::::: 30 2.6.3 Link orders ::::::::::::::::::::::::::::::::::::::::::::::: 30 2.6.4 typedef asection :::::::::::::::::::::::::::::::::::::::::: 30 2.6.5 Section prototypes :::::::::::::::::::::::::::::::::::::::: 44 2.6.5.1 bfd_section_list_clear ::::::::::::::::::::::::::: 44 2.6.5.2 bfd_get_section_by_name :::::::::::::::::::::::::: 44 2.6.5.3 bfd_get_next_section_by_name :::::::::::::::::::: 44 2.6.5.4 bfd_get_linker_section ::::::::::::::::::::::::::: 44 2.6.5.5 bfd_get_section_by_name_if::::::::::::::::::::::: 44 2.6.5.6 bfd_get_unique_section_name ::::::::::::::::::::: 45 2.6.5.7 bfd_make_section_old_way ::::::::::::::::::::::::: 45 2.6.5.8 bfd_make_section_anyway_with_flags ::::::::::::: 45 2.6.5.9 bfd_make_section_anyway :::::::::::::::::::::::::: 45 2.6.5.10 bfd_make_section_with_flags :::::::::::::::::::: 46 2.6.5.11 bfd_make_section ::::::::::::::::::::::::::::::::: 46 2.6.5.12 bfd_set_section_flags ::::::::::::::::::::::::::: 46 2.6.5.13 bfd_rename_section ::::::::::::::::::::::::::::::: 46 2.6.5.14 bfd_map_over_sections ::::::::::::::::::::::::::: 46 2.6.5.15 bfd_sections_find_if::::::::::::::::::::::::::::: 47 2.6.5.16 bfd_set_section_size::::::::::::::::::::::::::::: 47 2.6.5.17 bfd_set_section_contents :::::::::::::::::::::::: 47 2.6.5.18 bfd_get_section_contents :::::::::::::::::::::::: 48 2.6.5.19 bfd_malloc_and_get_section ::::::::::::::::::::: 48 2.6.5.20 bfd_copy_private_section_data :::::::::::::::::: 48 2.6.5.21 bfd_generic_is_group_section ::::::::::::::::::: 48 2.6.5.22 bfd_generic_group_name :::::::::::::::::::::::::: 48 2.6.5.23 bfd_generic_discard_group::::::::::::::::::::::: 49 2.7 Symbols ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 49 2.7.1 Reading symbols:::::::::::::::::::::::::::::::::::::::::: 49 2.7.2 Writing symbols :::::::::::::::::::::::::::::::::::::::::: 50 2.7.3 Mini Symbols::::::::::::::::::::::::::::::::::::::::::::: 51 2.7.4 typedef asymbol :::::::::::::::::::::::::::::::::::::::::: 51 2.7.5 Symbol handling functions :::::::::::::::::::::::::::::::: 54 iii 2.7.5.1 bfd_get_symtab_upper_bound::::::::::::::::::::::: 54 2.7.5.2 bfd_is_local_label :::::::::::::::::::::::::::::::: 54 2.7.5.3 bfd_is_local_label_name :::::::::::::::::::::::::: 54 2.7.5.4 bfd_is_target_special_symbol :::::::::::::::::::: 55 2.7.5.5 bfd_canonicalize_symtab :::::::::::::::::::::::::: 55 2.7.5.6 bfd_set_symtab ::::::::::::::::::::::::::::::::::::: 55 2.7.5.7 bfd_print_symbol_vandf ::::::::::::::::::::::::::: 55 2.7.5.8 bfd_make_empty_symbol :::::::::::::::::::::::::::: 55 2.7.5.9 _bfd_generic_make_empty_symbol :::::::::::::::::: 56 2.7.5.10 bfd_make_debug_symbol ::::::::::::::::::::::::::: 56 2.7.5.11 bfd_decode_symclass :::::::::::::::::::::::::::::: 56 2.7.5.12 bfd_is_undefined_symclass::::::::::::::::::::::: 56 2.7.5.13 bfd_symbol_info :::::::::::::::::::::::::::::::::: 56 2.7.5.14 bfd_copy_private_symbol_data ::::::::::::::::::: 57 2.8 Archives::::::::::::::::::::::::::::::::::::::::::::::::::::::: 57 2.8.1 Archive functions ::::::::::::::::::::::::::::::::::::::::: 58 2.8.1.1 bfd_get_next_mapent ::::::::::::::::::::::::::::::: 58 2.8.1.2 bfd_set_archive_head:::::::::::::::::::::::::::::: 58 2.8.1.3 bfd_openr_next_archived_file :::::::::::::::::::: 58 2.9 File formats ::::::::::::::::::::::::::::::::::::::::::::::::::: 58 2.9.1 File format functions ::::::::::::::::::::::::::::::::::::: 59 2.9.1.1 bfd_check_format :::::::::::::::::::::::::::::::::: 59 2.9.1.2 bfd_check_format_matches ::::::::::::::::::::::::: 59 2.9.1.3 bfd_set_format ::::::::::::::::::::::::::::::::::::: 59 2.9.1.4 bfd_format_string ::::::::::::::::::::::::::::::::: 60 2.10 Relocations :::::::::::::::::::::::::::::::::::::::::::::::::: 60 2.10.1 typedef arelent :::::::::::::::::::::::::::::::::::::::::: 60 2.10.1.1 enum complain_overflow::::::::::::::::::::::::::: 63 2.10.1.2 reloc_howto_type ::::::::::::::::::::::::::::::::: 64 2.10.1.3 The HOWTO Macro ::::::::::::::::::::::::::::::::::: 65 2.10.1.4 bfd_get_reloc_size ::::::::::::::::::::::::::::::: 66 2.10.1.5 arelent_chain ::::::::::::::::::::::::::::::::::::: 66 2.10.1.6 bfd_check_overflow ::::::::::::::::::::::::::::::: 66 2.10.1.7 bfd_reloc_offset_in_range::::::::::::::::::::::: 66 2.10.1.8 bfd_perform_relocation :::::::::::::::::::::::::: 67 2.10.1.9 bfd_install_relocation :::::::::::::::::::::::::: 67 2.10.2 The howto manager ::::::::::::::::::::::::::::::::::::: 67 2.10.2.1 bfd_reloc_code_type :::::::::::::::::::::::::::::: 68 2.10.2.2 bfd_reloc_type_lookup :::::::::::::::::::::::::: 146 2.10.2.3 bfd_default_reloc_type_lookup ::::::::::::::::: 146 2.10.2.4 bfd_get_reloc_code_name :::::::::::::::::::::::: 146 2.10.2.5 bfd_generic_relax_section:::::::::::::::::::::: 147 2.10.2.6 bfd_generic_gc_sections :::::::::::::::::::::::: 147 2.10.2.7 bfd_generic_lookup_section_flags ::::::::::::: 147 2.10.2.8 bfd_generic_merge_sections :::::::::::::::::::: 147 2.10.2.9 bfd_generic_get_relocated_section_contents :: 147 2.10.2.10 _bfd_generic_set_reloc :::::::::::::::::::::::: 148 2.10.2.11 _bfd_unrecognized_reloc ::::::::::::::::::::::: 148 iv 2.11 Core files::::::::::::::::::::::::::::::::::::::::::::::::::::