X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fxsym.c;h=525d6d98abc1bc385acce6593fb57aca8ae7bde9;hb=7242fa8aa7596b4e154ca96ddf5ce49353bf2e5d;hp=c51b715200977933a14c30a7a65b45f687a0967b;hpb=12ef3f5a7c5a6b89964842fd3da047b8d07dec91;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/xsym.c b/bfd/xsym.c index c51b715200..525d6d98ab 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright (C) 1999-2018 Free Software Foundation, Inc. + Copyright (C) 1999-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -30,7 +30,7 @@ #define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define bfd_sym_new_section_hook _bfd_generic_new_section_hook #define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name -#define bfd_sym_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) (bfd_boolean (*)) bfd_false) +#define bfd_sym_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false #define bfd_sym_get_lineno _bfd_nosymbols_get_lineno #define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line #define bfd_sym_find_line _bfd_nosymbols_find_line @@ -48,9 +48,11 @@ #define bfd_sym_bfd_lookup_section_flags bfd_generic_lookup_section_flags #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections #define bfd_sym_bfd_is_group_section bfd_generic_is_group_section +#define bfd_sym_bfd_group_name bfd_generic_group_name #define bfd_sym_bfd_discard_group bfd_generic_discard_group #define bfd_sym_section_already_linked _bfd_generic_section_already_linked #define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol +#define bfd_sym_bfd_link_hide_symbol _bfd_generic_link_hide_symbol #define bfd_sym_bfd_define_start_stop bfd_generic_define_start_stop #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols @@ -125,24 +127,12 @@ bfd_sym_valid (bfd *abfd) unsigned char * bfd_sym_read_name_table (bfd *abfd, bfd_sym_header_block *dshb) { - unsigned char *rstr; - long ret; size_t table_size = dshb->dshb_nte.dti_page_count * dshb->dshb_page_size; size_t table_offset = dshb->dshb_nte.dti_first_page * dshb->dshb_page_size; - rstr = bfd_alloc (abfd, table_size); - if (rstr == NULL) - return rstr; - - bfd_seek (abfd, table_offset, SEEK_SET); - ret = bfd_bread (rstr, table_size, abfd); - if (ret < 0 || (unsigned long) ret != table_size) - { - bfd_release (abfd, rstr); - return NULL; - } - - return rstr; + if (bfd_seek (abfd, table_offset, SEEK_SET) != 0) + return FALSE; + return _bfd_alloc_and_read (abfd, table_size, table_size); } void @@ -1806,22 +1796,11 @@ bfd_sym_print_type_information_table_entry (bfd *abfd, fprintf (f, "\n "); - buf = malloc (entry->physical_size); - if (buf == NULL) - { - fprintf (f, "[ERROR]\n"); - return; - } - if (bfd_seek (abfd, entry->offset, SEEK_SET) < 0) - { - fprintf (f, "[ERROR]\n"); - free (buf); - return; - } - if (bfd_bread (buf, entry->physical_size, abfd) != entry->physical_size) + if (bfd_seek (abfd, entry->offset, SEEK_SET) != 0 + || (buf = _bfd_malloc_and_read (abfd, entry->physical_size, + entry->physical_size)) == NULL) { fprintf (f, "[ERROR]\n"); - free (buf); return; } @@ -2251,7 +2230,7 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata) return 0; } -const bfd_target * +bfd_cleanup bfd_sym_object_p (bfd *abfd) { bfd_sym_version version = -1; @@ -2268,7 +2247,7 @@ bfd_sym_object_p (bfd *abfd) if (bfd_sym_scan (abfd, version, mdata) != 0) goto wrong; - return abfd->xvec; + return _bfd_no_cleanup; wrong: bfd_set_error (bfd_error_wrong_format); @@ -2332,16 +2311,16 @@ const bfd_target sym_vec = _bfd_dummy_target, }, { /* bfd_set_format. */ - bfd_false, + _bfd_bool_bfd_false_error, bfd_sym_mkobject, - bfd_false, - bfd_false, + _bfd_bool_bfd_false_error, + _bfd_bool_bfd_false_error, }, { /* bfd_write_contents. */ - bfd_false, - bfd_true, - bfd_false, - bfd_false, + _bfd_bool_bfd_false_error, + _bfd_bool_bfd_true, + _bfd_bool_bfd_false_error, + _bfd_bool_bfd_false_error, }, BFD_JUMP_TABLE_GENERIC (bfd_sym),