X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=bfd%2Fxsym.c;h=01434e1b72d08c7740253b157c8bfa589849a5c0;hb=62dc7e9a46fdeb1f2f772bda48a0605cc00e6bf8;hp=99b4eb719c4201eb3ffb2b83452c4d7485f1f388;hpb=e95a7ac4e71cb338aa70dbad23efb0739bc8f3ff;p=pf3gnuchains%2Fpf3gnuchains4x.git diff --git a/bfd/xsym.c b/bfd/xsym.c index 99b4eb719c..01434e1b72 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -1,12 +1,12 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,57 +15,60 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ +#include "alloca-conf.h" +#include "sysdep.h" #include "xsym.h" #include "bfd.h" -#include "sysdep.h" #include "libbfd.h" -#define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup -#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_get_lineno _bfd_nosymbols_get_lineno -#define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line -#define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols -#define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol -#define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound -#define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc -#define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup -#define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach -#define bfd_sym_get_section_contents _bfd_generic_get_section_contents -#define bfd_sym_set_section_contents _bfd_generic_set_section_contents -#define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents -#define bfd_sym_bfd_relax_section bfd_generic_relax_section -#define bfd_sym_bfd_gc_sections bfd_generic_gc_sections -#define bfd_sym_bfd_merge_sections bfd_generic_merge_sections -#define bfd_sym_bfd_discard_group bfd_generic_discard_group -#define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms -#define bfd_sym_bfd_final_link _bfd_generic_final_link -#define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section -#define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window - -static int pstrcmp PARAMS ((unsigned char *, unsigned char *)); -static unsigned long compute_offset - PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long)); +#define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup +#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_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_inliner_info _bfd_nosymbols_find_inliner_info +#define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols +#define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach +#define bfd_sym_get_section_contents _bfd_generic_get_section_contents +#define bfd_sym_set_section_contents _bfd_generic_set_section_contents +#define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define bfd_sym_bfd_relax_section bfd_generic_relax_section +#define bfd_sym_bfd_gc_sections bfd_generic_gc_sections +#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_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_hash_table_create _bfd_generic_link_hash_table_create +#define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms +#define bfd_sym_bfd_copy_link_hash_symbol_type \ + _bfd_generic_copy_link_hash_symbol_type +#define bfd_sym_bfd_final_link _bfd_generic_final_link +#define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section +#define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window extern const bfd_target sym_vec; static int -pstrcmp (a, b) - unsigned char *a; - unsigned char *b; +pstrcmp (const char *as, const char *bs) { + const unsigned char *a = (const unsigned char *) as; + const unsigned char *b = (const unsigned char *) bs; unsigned char clen; int ret; - clen = (a[0] > b[0]) ? a[0] : b[0]; + clen = (a[0] > b[0]) ? b[0] : a[0]; ret = memcmp (a + 1, b + 1, clen); if (ret != 0) return ret; @@ -75,80 +78,73 @@ pstrcmp (a, b) else if (a[0] < b[0]) return -1; else - return 0; + return 1; } static unsigned long -compute_offset (first_page, page_size, entry_size, index) - unsigned long first_page; - unsigned long page_size; - unsigned long entry_size; - unsigned long index; +compute_offset (unsigned long first_page, + unsigned long page_size, + unsigned long entry_size, + unsigned long sym_index) { unsigned long entries_per_page = page_size / entry_size; - unsigned long page_number = first_page + (index / entries_per_page); - unsigned long page_offset = (index % entries_per_page) * entry_size; + unsigned long page_number = first_page + (sym_index / entries_per_page); + unsigned long page_offset = (sym_index % entries_per_page) * entry_size; return (page_number * page_size) + page_offset; } -boolean -bfd_sym_mkobject (abfd) - bfd *abfd ATTRIBUTE_UNUSED; +bfd_boolean +bfd_sym_mkobject (bfd *abfd ATTRIBUTE_UNUSED) { - return (boolean) true; + return 1; } void -bfd_sym_print_symbol (abfd, afile, symbol, how) - bfd *abfd ATTRIBUTE_UNUSED; - PTR afile ATTRIBUTE_UNUSED; - asymbol *symbol ATTRIBUTE_UNUSED; - bfd_print_symbol_type how ATTRIBUTE_UNUSED; +bfd_sym_print_symbol (bfd *abfd ATTRIBUTE_UNUSED, + void * afile ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + bfd_print_symbol_type how ATTRIBUTE_UNUSED) { return; } -boolean -bfd_sym_valid (abfd) - bfd *abfd; +bfd_boolean +bfd_sym_valid (bfd *abfd) { if (abfd == NULL || abfd->xvec == NULL) return 0; - return (abfd->xvec == &sym_vec); + return abfd->xvec == &sym_vec; } unsigned char * -bfd_sym_read_name_table (abfd, dshb) - bfd *abfd; - bfd_sym_header_block *dshb; +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 = (unsigned char *) bfd_alloc (abfd, table_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)) + if (ret < 0 || (unsigned long) ret != table_size) { bfd_release (abfd, rstr); return NULL; } - + return rstr; } void -bfd_sym_parse_file_reference_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_file_reference *entry; +bfd_sym_parse_file_reference_v32 (unsigned char *buf, + size_t len, + bfd_sym_file_reference *entry) { BFD_ASSERT (len == 6); @@ -157,32 +153,30 @@ bfd_sym_parse_file_reference_v32 (buf, len, entry) } void -bfd_sym_parse_disk_table_v32 (buf, len, table) - unsigned char *buf; - size_t len; - bfd_sym_table_info *table; +bfd_sym_parse_disk_table_v32 (unsigned char *buf, + size_t len, + bfd_sym_table_info *table) { BFD_ASSERT (len == 8); - + table->dti_first_page = bfd_getb16 (buf); table->dti_page_count = bfd_getb16 (buf + 2); table->dti_object_count = bfd_getb32 (buf + 4); -} +} void -bfd_sym_parse_header_v32 (buf, len, header) - unsigned char *buf; - size_t len; - bfd_sym_header_block *header; +bfd_sym_parse_header_v32 (unsigned char *buf, + size_t len, + bfd_sym_header_block *header) { BFD_ASSERT (len == 154); - + memcpy (header->dshb_id, buf, 32); header->dshb_page_size = bfd_getb16 (buf + 32); header->dshb_hash_page = bfd_getb16 (buf + 34); header->dshb_root_mte = bfd_getb16 (buf + 36); header->dshb_mod_date = bfd_getb32 (buf + 38); - + bfd_sym_parse_disk_table_v32 (buf + 42, 8, &header->dshb_frte); bfd_sym_parse_disk_table_v32 (buf + 50, 8, &header->dshb_rte); bfd_sym_parse_disk_table_v32 (buf + 58, 8, &header->dshb_mte); @@ -196,41 +190,37 @@ bfd_sym_parse_header_v32 (buf, len, header) bfd_sym_parse_disk_table_v32 (buf + 122, 8, &header->dshb_tinfo); bfd_sym_parse_disk_table_v32 (buf + 130, 8, &header->dshb_fite); bfd_sym_parse_disk_table_v32 (buf + 138, 8, &header->dshb_const); - + memcpy (&header->dshb_file_creator, buf + 146, 4); memcpy (&header->dshb_file_type, buf + 150, 4); } int -bfd_sym_read_header_v32 (abfd, header) - bfd *abfd; - bfd_sym_header_block *header; +bfd_sym_read_header_v32 (bfd *abfd, bfd_sym_header_block *header) { unsigned char buf[154]; long ret; - + ret = bfd_bread (buf, 154, abfd); if (ret != 154) return -1; - + bfd_sym_parse_header_v32 (buf, 154, header); - + return 0; } int -bfd_sym_read_header_v34 (abfd, header) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_sym_header_block *header ATTRIBUTE_UNUSED; +bfd_sym_read_header_v34 (bfd *abfd ATTRIBUTE_UNUSED, + bfd_sym_header_block *header ATTRIBUTE_UNUSED) { abort (); } int -bfd_sym_read_header (abfd, header, version) - bfd *abfd; - bfd_sym_header_block *header; - bfd_sym_version version; +bfd_sym_read_header (bfd *abfd, + bfd_sym_header_block *header, + bfd_sym_version version) { switch (version) { @@ -242,22 +232,20 @@ bfd_sym_read_header (abfd, header, version) return bfd_sym_read_header_v32 (abfd, header); case BFD_SYM_VERSION_3_1: default: - return false; + return 0; } } int -bfd_sym_read_version (abfd, version) - bfd *abfd; - bfd_sym_version *version; +bfd_sym_read_version (bfd *abfd, bfd_sym_version *version) { - unsigned char version_string[32]; + char version_string[32]; long ret; - + ret = bfd_bread (version_string, sizeof (version_string), abfd); if (ret != sizeof (version_string)) return -1; - + if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_1) == 0) *version = BFD_SYM_VERSION_3_1; else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_2) == 0) @@ -270,15 +258,14 @@ bfd_sym_read_version (abfd, version) *version = BFD_SYM_VERSION_3_5; else return -1; - + return 0; } void -bfd_sym_display_table_summary (f, dti, name) - FILE *f; - bfd_sym_table_info *dti; - const char *name; +bfd_sym_display_table_summary (FILE *f, + bfd_sym_table_info *dti, + const char *name) { fprintf (f, "%-6s %13ld %13ld %13ld\n", name, @@ -288,9 +275,7 @@ bfd_sym_display_table_summary (f, dti, name) } void -bfd_sym_display_header (f, dshb) - FILE *f; - bfd_sym_header_block *dshb; +bfd_sym_display_header (FILE *f, bfd_sym_header_block *dshb) { fprintf (f, " Version: %.*s\n", dshb->dshb_id[0], dshb->dshb_id + 1); fprintf (f, " Page Size: 0x%x\n", dshb->dshb_page_size); @@ -302,10 +287,10 @@ bfd_sym_display_header (f, dshb) fprintf (f, " File Creator: %.4s Type: %.4s\n\n", dshb->dshb_file_creator, dshb->dshb_file_type); - + fprintf (f, "Table Name First Page Page Count Object Count\n"); fprintf (f, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); - + bfd_sym_display_table_summary (f, &dshb->dshb_nte, "NTE"); bfd_sym_display_table_summary (f, &dshb->dshb_rte, "RTE"); bfd_sym_display_table_summary (f, &dshb->dshb_mte, "MTE"); @@ -319,15 +304,14 @@ bfd_sym_display_header (f, dshb) bfd_sym_display_table_summary (f, &dshb->dshb_tinfo, "TINFO"); bfd_sym_display_table_summary (f, &dshb->dshb_fite, "FITE"); bfd_sym_display_table_summary (f, &dshb->dshb_const, "CONST"); - + fprintf (f, "\n"); } void -bfd_sym_parse_resources_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_resources_table_entry *entry; +bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_resources_table_entry *entry) { BFD_ASSERT (len == 18); @@ -340,10 +324,9 @@ bfd_sym_parse_resources_table_entry_v32 (buf, len, entry) } void -bfd_sym_parse_modules_table_entry_v33 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_modules_table_entry *entry; +bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf, + size_t len, + bfd_sym_modules_table_entry *entry) { BFD_ASSERT (len == 46); @@ -365,13 +348,12 @@ bfd_sym_parse_modules_table_entry_v33 (buf, len, entry) } void -bfd_sym_parse_file_references_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_file_references_table_entry *entry; +bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_file_references_table_entry *entry) { unsigned int type; - + BFD_ASSERT (len == 10); memset (entry, 0, sizeof (bfd_sym_file_references_table_entry)); @@ -396,10 +378,9 @@ bfd_sym_parse_file_references_table_entry_v32 (buf, len, entry) } void -bfd_sym_parse_contained_modules_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_contained_modules_table_entry *entry; +bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_contained_modules_table_entry *entry) { unsigned int type; @@ -407,7 +388,7 @@ bfd_sym_parse_contained_modules_table_entry_v32 (buf, len, entry) memset (entry, 0, sizeof (bfd_sym_contained_modules_table_entry)); type = bfd_getb16 (buf); - + switch (type) { case BFD_SYM_END_OF_LIST_3_2: @@ -422,13 +403,12 @@ bfd_sym_parse_contained_modules_table_entry_v32 (buf, len, entry) } void -bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_contained_variables_table_entry *entry; +bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_contained_variables_table_entry *entry) { unsigned int type; - + BFD_ASSERT (len == 26); memset (entry, 0, sizeof (bfd_sym_contained_variables_table_entry)); @@ -460,7 +440,10 @@ bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry) } else if (entry->entry.la_size <= BFD_SYM_CVTE_SCA) { - memcpy (&entry->entry.address.lastruct.la, buf + 10, BFD_SYM_CVTE_SCA); +#if BFD_SYM_CVTE_SCA > 0 + memcpy (&entry->entry.address.lastruct.la, buf + 10, + BFD_SYM_CVTE_SCA); +#endif entry->entry.address.lastruct.la_kind = buf[23]; } else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA) @@ -472,10 +455,9 @@ bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry) } void -bfd_sym_parse_contained_statements_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_contained_statements_table_entry *entry; +bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_contained_statements_table_entry *entry) { unsigned int type; @@ -483,7 +465,7 @@ bfd_sym_parse_contained_statements_table_entry_v32 (buf, len, entry) memset (entry, 0, sizeof (bfd_sym_contained_statements_table_entry)); type = bfd_getb16 (buf); - + switch (type) { case BFD_SYM_END_OF_LIST_3_2: @@ -504,10 +486,9 @@ bfd_sym_parse_contained_statements_table_entry_v32 (buf, len, entry) } void -bfd_sym_parse_contained_labels_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_contained_labels_table_entry *entry; +bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_contained_labels_table_entry *entry) { unsigned int type; @@ -515,7 +496,7 @@ bfd_sym_parse_contained_labels_table_entry_v32 (buf, len, entry) memset (entry, 0, sizeof (bfd_sym_contained_labels_table_entry)); type = bfd_getb16 (buf); - + switch (type) { case BFD_SYM_END_OF_LIST_3_2: @@ -538,32 +519,31 @@ bfd_sym_parse_contained_labels_table_entry_v32 (buf, len, entry) } void -bfd_sym_parse_type_table_entry_v32 (buf, len, entry) - unsigned char *buf; - size_t len; - bfd_sym_type_table_entry *entry; +bfd_sym_parse_type_table_entry_v32 (unsigned char *buf, + size_t len, + bfd_sym_type_table_entry *entry) { BFD_ASSERT (len == 4); - + *entry = bfd_getb32 (buf); } int -bfd_sym_fetch_resources_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_resources_table_entry *entry; - unsigned long index; +bfd_sym_fetch_resources_table_entry (bfd *abfd, + bfd_sym_resources_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *); unsigned long offset; unsigned long entry_size; unsigned char buf[18]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -587,34 +567,34 @@ bfd_sym_fetch_resources_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_rte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_modules_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_modules_table_entry *entry; - unsigned long index; +bfd_sym_fetch_modules_table_entry (bfd *abfd, + bfd_sym_modules_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *); unsigned long offset; unsigned long entry_size; unsigned char buf[46]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -638,34 +618,34 @@ bfd_sym_fetch_modules_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_mte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_file_references_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_file_references_table_entry *entry; - unsigned long index; +bfd_sym_fetch_file_references_table_entry (bfd *abfd, + bfd_sym_file_references_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[8]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -688,34 +668,34 @@ bfd_sym_fetch_file_references_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_frte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_contained_modules_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_contained_modules_table_entry *entry; - unsigned long index; +bfd_sym_fetch_contained_modules_table_entry (bfd *abfd, + bfd_sym_contained_modules_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[6]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -738,34 +718,34 @@ bfd_sym_fetch_contained_modules_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_cmte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_contained_variables_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_contained_variables_table_entry *entry; - unsigned long index; +bfd_sym_fetch_contained_variables_table_entry (bfd *abfd, + bfd_sym_contained_variables_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[26]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -788,34 +768,34 @@ bfd_sym_fetch_contained_variables_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_cvte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_contained_statements_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_contained_statements_table_entry *entry; - unsigned long index; +bfd_sym_fetch_contained_statements_table_entry (bfd *abfd, + bfd_sym_contained_statements_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[8]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -838,34 +818,34 @@ bfd_sym_fetch_contained_statements_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_csnte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_contained_labels_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_contained_labels_table_entry *entry; - unsigned long index; +bfd_sym_fetch_contained_labels_table_entry (bfd *abfd, + bfd_sym_contained_labels_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[12]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -888,34 +868,34 @@ bfd_sym_fetch_contained_labels_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_clte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_contained_types_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_contained_types_table_entry *entry; - unsigned long index; +bfd_sym_fetch_contained_types_table_entry (bfd *abfd, + bfd_sym_contained_types_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[0]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -938,34 +918,34 @@ bfd_sym_fetch_contained_types_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_ctte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_file_references_index_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_file_references_index_table_entry *entry; - unsigned long index; +bfd_sym_fetch_file_references_index_table_entry (bfd *abfd, + bfd_sym_file_references_index_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[0]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -988,34 +968,34 @@ bfd_sym_fetch_file_references_index_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_fite.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_constant_pool_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_constant_pool_entry *entry; - unsigned long index; +bfd_sym_fetch_constant_pool_entry (bfd *abfd, + bfd_sym_constant_pool_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[0]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (sym_index == 0) return -1; switch (sdata->version) @@ -1038,30 +1018,30 @@ bfd_sym_fetch_constant_pool_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_fite.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_type_table_entry (abfd, entry, index) - bfd *abfd; - bfd_sym_type_table_entry *entry; - unsigned long index; +bfd_sym_fetch_type_table_entry (bfd *abfd, + bfd_sym_type_table_entry *entry, + unsigned long sym_index) { - void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *) = NULL; + void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *); unsigned long offset; unsigned long entry_size = 0; unsigned char buf[4]; bfd_sym_data_struct *sdata = NULL; + parser = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; @@ -1085,31 +1065,28 @@ bfd_sym_fetch_type_table_entry (abfd, entry, index) offset = compute_offset (sdata->header.dshb_tte.dti_first_page, sdata->header.dshb_page_size, - entry_size, index); - + entry_size, sym_index); + if (bfd_seek (abfd, offset, SEEK_SET) < 0) return -1; if (bfd_bread (buf, entry_size, abfd) != entry_size) return -1; (*parser) (buf, entry_size, entry); - + return 0; } int -bfd_sym_fetch_type_information_table_entry (abfd, entry, offset) - bfd *abfd; - bfd_sym_type_information_table_entry *entry; - unsigned long offset; +bfd_sym_fetch_type_information_table_entry (bfd *abfd, + bfd_sym_type_information_table_entry *entry, + unsigned long offset) { unsigned char buf[4]; - bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); - sdata = abfd->tdata.sym_data; - if (index == 0) + if (offset == 0) return -1; if (bfd_seek (abfd, offset, SEEK_SET) < 0) @@ -1118,11 +1095,11 @@ bfd_sym_fetch_type_information_table_entry (abfd, entry, offset) if (bfd_bread (buf, 4, abfd) != 4) return -1; entry->nte_index = bfd_getb32 (buf); - + if (bfd_bread (buf, 2, abfd) != 2) return -1; entry->physical_size = bfd_getb16 (buf); - + if (entry->physical_size & 0x8000) { if (bfd_bread (buf, 4, abfd) != 4) @@ -1144,10 +1121,9 @@ bfd_sym_fetch_type_information_table_entry (abfd, entry, offset) } int -bfd_sym_fetch_type_table_information (abfd, entry, index) - bfd *abfd; - bfd_sym_type_information_table_entry *entry; - unsigned long index; +bfd_sym_fetch_type_table_information (bfd *abfd, + bfd_sym_type_information_table_entry *entry, + unsigned long sym_index) { bfd_sym_type_table_entry tindex; bfd_sym_data_struct *sdata = NULL; @@ -1157,10 +1133,10 @@ bfd_sym_fetch_type_table_information (abfd, entry, index) if (sdata->header.dshb_tte.dti_object_count <= 99) return -1; - if (index < 100) + if (sym_index < 100) return -1; - if (bfd_sym_fetch_type_table_entry (abfd, &tindex, index - 100) < 0) + if (bfd_sym_fetch_type_table_entry (abfd, &tindex, sym_index - 100) < 0) return -1; if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0) return -1; @@ -1169,41 +1145,37 @@ bfd_sym_fetch_type_table_information (abfd, entry, index) } const unsigned char * -bfd_sym_symbol_name (abfd, index) - bfd *abfd; - unsigned long index; +bfd_sym_symbol_name (bfd *abfd, unsigned long sym_index) { bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) - return ""; - - index *= 2; - if ((index / sdata->header.dshb_page_size) > sdata->header.dshb_nte.dti_page_count) - return "\009[INVALID]"; - - return ((const unsigned char *) sdata->name_table + index); + if (sym_index == 0) + return (const unsigned char *) ""; + + sym_index *= 2; + if ((sym_index / sdata->header.dshb_page_size) + > sdata->header.dshb_nte.dti_page_count) + return (const unsigned char *) "\09[INVALID]"; + + return (const unsigned char *) sdata->name_table + sym_index; } const unsigned char * -bfd_sym_module_name (abfd, index) - bfd *abfd; - unsigned long index; +bfd_sym_module_name (bfd *abfd, unsigned long sym_index) { bfd_sym_modules_table_entry entry; - - if (bfd_sym_fetch_modules_table_entry (abfd, &entry, index) < 0) - return "\011[INVALID]"; + + if (bfd_sym_fetch_modules_table_entry (abfd, &entry, sym_index) < 0) + return (const unsigned char *) "\09[INVALID]"; return bfd_sym_symbol_name (abfd, entry.mte_nte_index); } const char * -bfd_sym_unparse_storage_kind (kind) - enum bfd_sym_storage_kind kind; +bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind) { switch (kind) { @@ -1216,8 +1188,7 @@ bfd_sym_unparse_storage_kind (kind) } const char * -bfd_sym_unparse_storage_class (kind) - enum bfd_sym_storage_class kind; +bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind) { switch (kind) { @@ -1234,8 +1205,7 @@ bfd_sym_unparse_storage_class (kind) } const char * -bfd_sym_unparse_module_kind (kind) - enum bfd_sym_module_kind kind; +bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind) { switch (kind) { @@ -1251,8 +1221,7 @@ bfd_sym_unparse_module_kind (kind) } const char * -bfd_sym_unparse_symbol_scope (scope) - enum bfd_sym_symbol_scope scope; +bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope) { switch (scope) { @@ -1264,15 +1233,15 @@ bfd_sym_unparse_symbol_scope (scope) } void -bfd_sym_print_file_reference (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_file_reference *entry; +bfd_sym_print_file_reference (bfd *abfd, + FILE *f, + bfd_sym_file_reference *entry) { bfd_sym_file_references_table_entry frtentry; int ret; - ret = bfd_sym_fetch_file_references_table_entry (abfd, &frtentry, entry->fref_frte_index); + ret = bfd_sym_fetch_file_references_table_entry (abfd, &frtentry, + entry->fref_frte_index); fprintf (f, "FILE "); if ((ret < 0) || (frtentry.generic.type != BFD_SYM_FILE_NAME_INDEX)) @@ -1286,49 +1255,48 @@ bfd_sym_print_file_reference (abfd, f, entry) } void -bfd_sym_print_resources_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_resources_table_entry *entry; +bfd_sym_print_resources_table_entry (bfd *abfd, + FILE *f, + bfd_sym_resources_table_entry *entry) { fprintf (f, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu", bfd_sym_symbol_name (abfd, entry->rte_nte_index)[0], &bfd_sym_symbol_name (abfd, entry->rte_nte_index)[1], entry->rte_nte_index, entry->rte_res_type, entry->rte_res_number, entry->rte_res_size, entry->rte_mte_first, entry->rte_mte_last); -} +} void -bfd_sym_print_modules_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_modules_table_entry *entry; +bfd_sym_print_modules_table_entry (bfd *abfd, + FILE *f, + bfd_sym_modules_table_entry *entry) { fprintf (f, "\"%.*s\" (NTE %lu)", bfd_sym_symbol_name (abfd, entry->mte_nte_index)[0], &bfd_sym_symbol_name (abfd, entry->mte_nte_index)[1], entry->mte_nte_index); - - fprintf (f, "\n "); + + fprintf (f, "\n "); bfd_sym_print_file_reference (abfd, f, &entry->mte_imp_fref); - fprintf (f, " range %lu -- %lu", entry->mte_imp_fref.fref_offset, entry->mte_imp_end); + fprintf (f, " range %lu -- %lu", + entry->mte_imp_fref.fref_offset, entry->mte_imp_end); - fprintf (f, "\n "); + fprintf (f, "\n "); fprintf (f, "kind %s", bfd_sym_unparse_module_kind (entry->mte_kind)); fprintf (f, ", scope %s", bfd_sym_unparse_symbol_scope (entry->mte_scope)); - + fprintf (f, ", RTE %lu, offset %lu, size %lu", entry->mte_rte_index, entry->mte_res_offset, entry->mte_size); - fprintf (f, "\n "); + fprintf (f, "\n "); - fprintf (f, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu", + fprintf (f, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu", entry->mte_cmte_index, entry->mte_cvte_index, entry->mte_clte_index, entry->mte_ctte_index, entry->mte_csnte_idx_1, entry->mte_csnte_idx_2); - + if (entry->mte_parent != 0) fprintf (f, ", parent %lu", entry->mte_parent); else @@ -1338,33 +1306,17 @@ bfd_sym_print_modules_table_entry (abfd, f, entry) fprintf (f, ", child %lu", entry->mte_cmte_index); else fprintf (f, ", no child"); - -#if 0 - { - MTE bfd_sym_modules_table_entry pentry; - - ret = bfd_sym_fetch_modules_table_entry (abfd, &pentry, entry->mte_parent); - if (ret < 0) - fprintf (f, " parent MTE %lu [INVALID]\n", entry->mte_parent); - else - fprintf (f, " parent MTE %lu \"%.*s\"\n", - entry->mte_parent, - bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[0], - &bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[1]); - } -#endif } void -bfd_sym_print_file_references_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_file_references_table_entry *entry; +bfd_sym_print_file_references_table_entry (bfd *abfd, + FILE *f, + bfd_sym_file_references_table_entry *entry) { switch (entry->generic.type) { case BFD_SYM_FILE_NAME_INDEX: - fprintf (f, "FILE \"%.*s\" (NTE %lu), modtime ", + fprintf (f, "FILE \"%.*s\" (NTE %lu), modtime ", bfd_sym_symbol_name (abfd, entry->filename.nte_index)[0], &bfd_sym_symbol_name (abfd, entry->filename.nte_index)[1], entry->filename.nte_index); @@ -1389,10 +1341,9 @@ bfd_sym_print_file_references_table_entry (abfd, f, entry) } void -bfd_sym_print_contained_modules_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_contained_modules_table_entry *entry; +bfd_sym_print_contained_modules_table_entry (bfd *abfd, + FILE *f, + bfd_sym_contained_modules_table_entry *entry) { switch (entry->generic.type) { @@ -1411,29 +1362,28 @@ bfd_sym_print_contained_modules_table_entry (abfd, f, entry) } void -bfd_sym_print_contained_variables_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_contained_variables_table_entry *entry; +bfd_sym_print_contained_variables_table_entry (bfd *abfd, + FILE *f, + bfd_sym_contained_variables_table_entry *entry) { if (entry->generic.type == BFD_SYM_END_OF_LIST) { fprintf (f, "END"); return; } - + if (entry->generic.type == BFD_SYM_SOURCE_FILE_CHANGE) { bfd_sym_print_file_reference (abfd, f, &entry->file.fref); fprintf (f, " offset %lu", entry->file.fref.fref_offset); return; } - + fprintf (f, "\"%.*s\" (NTE %lu)", bfd_sym_symbol_name (abfd, entry->entry.nte_index)[0], &bfd_sym_symbol_name (abfd, entry->entry.nte_index)[1], entry->entry.nte_index); - + fprintf (f, ", TTE %lu", entry->entry.tte_index); fprintf (f, ", offset %lu", entry->entry.file_delta); fprintf (f, ", scope %s", bfd_sym_unparse_symbol_scope (entry->entry.scope)); @@ -1454,7 +1404,7 @@ bfd_sym_print_contained_variables_table_entry (abfd, f, entry) } else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA) fprintf (f, ", bigla %lu, biglakind %u", - entry->entry.address.biglastruct.big_la, + entry->entry.address.biglastruct.big_la, entry->entry.address.biglastruct.big_la_kind); else @@ -1462,17 +1412,16 @@ bfd_sym_print_contained_variables_table_entry (abfd, f, entry) } void -bfd_sym_print_contained_statements_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_contained_statements_table_entry *entry; +bfd_sym_print_contained_statements_table_entry (bfd *abfd, + FILE *f, + bfd_sym_contained_statements_table_entry *entry) { if (entry->generic.type == BFD_SYM_END_OF_LIST) { fprintf (f, "END"); return; } - + if (entry->generic.type == BFD_SYM_SOURCE_FILE_CHANGE) { bfd_sym_print_file_reference (abfd, f, &entry->file.fref); @@ -1489,10 +1438,9 @@ bfd_sym_print_contained_statements_table_entry (abfd, f, entry) } void -bfd_sym_print_contained_labels_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_contained_labels_table_entry *entry; +bfd_sym_print_contained_labels_table_entry (bfd *abfd, + FILE *f, + bfd_sym_contained_labels_table_entry *entry) { if (entry->generic.type == BFD_SYM_END_OF_LIST) { @@ -1517,17 +1465,15 @@ bfd_sym_print_contained_labels_table_entry (abfd, f, entry) } void -bfd_sym_print_contained_types_table_entry (abfd, f, entry) - bfd *abfd ATTRIBUTE_UNUSED; - FILE *f; - bfd_sym_contained_types_table_entry *entry ATTRIBUTE_UNUSED; +bfd_sym_print_contained_types_table_entry (bfd *abfd ATTRIBUTE_UNUSED, + FILE *f, + bfd_sym_contained_types_table_entry *entry ATTRIBUTE_UNUSED) { fprintf (f, "[UNIMPLEMENTED]"); } const char * -bfd_sym_type_operator_name (num) - unsigned char num; +bfd_sym_type_operator_name (unsigned char num) { switch (num) { @@ -1550,8 +1496,7 @@ bfd_sym_type_operator_name (num) } const char * -bfd_sym_type_basic_name (num) - unsigned char num; +bfd_sym_type_basic_name (unsigned char num) { switch (num) { @@ -1578,12 +1523,11 @@ bfd_sym_type_basic_name (num) } int -bfd_sym_fetch_long (buf, len, offset, offsetptr, value) - unsigned char *buf; - unsigned long len; - unsigned long offset; - unsigned long *offsetptr; - long *value; +bfd_sym_fetch_long (unsigned char *buf, + unsigned long len, + unsigned long offset, + unsigned long *offsetptr, + long *value) { int ret; @@ -1645,13 +1589,12 @@ bfd_sym_fetch_long (buf, len, offset, offsetptr, value) } void -bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) - bfd *abfd; - FILE *f; - unsigned char *buf; - unsigned long len; - unsigned long offset; - unsigned long *offsetptr; +bfd_sym_print_type_information (bfd *abfd, + FILE *f, + unsigned char *buf, + unsigned long len, + unsigned long offset, + unsigned long *offsetptr) { unsigned int type; @@ -1661,9 +1604,9 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) if (offsetptr != NULL) *offsetptr = offset; - return; + return; } - + type = buf[offset]; offset++; @@ -1688,7 +1631,7 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) long value; bfd_sym_type_information_table_entry tinfo; - bfd_sym_fetch_long (buf, len, offset, &offset, &value); + bfd_sym_fetch_long (buf, len, offset, &offset, &value); if (value <= 0) fprintf (f, "[INVALID]"); else @@ -1696,11 +1639,11 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) if (bfd_sym_fetch_type_table_information (abfd, &tinfo, value) < 0) fprintf (f, "[INVALID]"); else - fprintf (f, "\"%.*s\"", + fprintf (f, "\"%.*s\"", bfd_sym_symbol_name (abfd, tinfo.nte_index)[0], &bfd_sym_symbol_name (abfd, tinfo.nte_index)[1]); } - fprintf (f, " (TTE %lu)", value); + fprintf (f, " (TTE %lu)", (unsigned long) value); break; } @@ -1711,26 +1654,28 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) case 3: { - unsigned long value; + long value; fprintf (f, "scalar (0x%x) of ", type); bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); bfd_sym_fetch_long (buf, len, offset, &offset, &value); - fprintf (f, " (%lu)", value); + fprintf (f, " (%lu)", (unsigned long) value); break; } - + case 5: { - unsigned long lower, upper, nelem; - unsigned long i; + long lower, upper, nelem; + int i; fprintf (f, "enumeration (0x%x) of ", type); bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); - bfd_sym_fetch_long (buf, len, offset, &offset, &lower); - bfd_sym_fetch_long (buf, len, offset, &offset, &upper); - bfd_sym_fetch_long (buf, len, offset, &offset, &nelem); - fprintf (f, " from %lu to %lu with %lu elements: ", lower, upper, nelem); + bfd_sym_fetch_long (buf, len, offset, &offset, &lower); + bfd_sym_fetch_long (buf, len, offset, &offset, &upper); + bfd_sym_fetch_long (buf, len, offset, &offset, &nelem); + fprintf (f, " from %lu to %lu with %lu elements: ", + (unsigned long) lower, (unsigned long) upper, + (unsigned long) nelem); for (i = 0; i < nelem; i++) { @@ -1757,15 +1702,15 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) fprintf (f, "record (0x%x) of ", type); else fprintf (f, "union (0x%x) of ", type); - - bfd_sym_fetch_long (buf, len, offset, &offset, &nrec); - fprintf (f, "%lu elements: ", nrec); + + bfd_sym_fetch_long (buf, len, offset, &offset, &nrec); + fprintf (f, "%lu elements: ", (unsigned long) nrec); for (i = 0; i < nrec; i++) { - bfd_sym_fetch_long (buf, len, offset, &offset, &eloff); + bfd_sym_fetch_long (buf, len, offset, &offset, &eloff); fprintf (f, "\n "); - fprintf (f, "offset %lu: ", eloff); + fprintf (f, "offset %lu: ", (unsigned long) eloff); bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); } break; @@ -1785,15 +1730,15 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) long value; fprintf (f, "named type (0x%x) ", type); - bfd_sym_fetch_long (buf, len, offset, &offset, &value); + bfd_sym_fetch_long (buf, len, offset, &offset, &value); if (value <= 0) fprintf (f, "[INVALID]"); else - fprintf (f, "\"%.*s\"", + fprintf (f, "\"%.*s\"", bfd_sym_symbol_name (abfd, value)[0], &bfd_sym_symbol_name (abfd, value)[1]); - fprintf (f, " (NTE %lu) with type ", value); + fprintf (f, " (NTE %lu) with type ", (unsigned long) value); bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); break; } @@ -1802,7 +1747,7 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) fprintf (f, "%s (0x%x)", bfd_sym_type_operator_name (type), type); break; } - + if (type == (0x40 | 0x6)) { /* Vector. */ @@ -1810,14 +1755,14 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) long l; long i; - bfd_sym_fetch_long (buf, len, offset, &offset, &n); - bfd_sym_fetch_long (buf, len, offset, &offset, &width); - bfd_sym_fetch_long (buf, len, offset, &offset, &m); + bfd_sym_fetch_long (buf, len, offset, &offset, &n); + bfd_sym_fetch_long (buf, len, offset, &offset, &width); + bfd_sym_fetch_long (buf, len, offset, &offset, &m); /* fprintf (f, "\n "); */ fprintf (f, " N %ld, width %ld, M %ld, ", n, width, m); for (i = 0; i < m; i++) { - bfd_sym_fetch_long (buf, len, offset, &offset, &l); + bfd_sym_fetch_long (buf, len, offset, &offset, &l); if (i != 0) fprintf (f, " "); fprintf (f, "%ld", l); @@ -1828,8 +1773,8 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) /* Other packed type. */ long msb, lsb; - bfd_sym_fetch_long (buf, len, offset, &offset, &msb); - bfd_sym_fetch_long (buf, len, offset, &offset, &lsb); + bfd_sym_fetch_long (buf, len, offset, &offset, &msb); + bfd_sym_fetch_long (buf, len, offset, &offset, &lsb); /* fprintf (f, "\n "); */ fprintf (f, " msb %ld, lsb %ld", msb, lsb); } @@ -1841,10 +1786,9 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) } void -bfd_sym_print_type_information_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - bfd_sym_type_information_table_entry *entry; +bfd_sym_print_type_information_table_entry (bfd *abfd, + FILE *f, + bfd_sym_type_information_table_entry *entry) { unsigned char *buf; unsigned long offset; @@ -1856,7 +1800,7 @@ bfd_sym_print_type_information_table_entry (abfd, f, entry) entry->nte_index, entry->physical_size, entry->offset, entry->logical_size); - fprintf (f, "\n "); + fprintf (f, "\n "); buf = alloca (entry->physical_size); if (buf == NULL) @@ -1885,55 +1829,53 @@ bfd_sym_print_type_information_table_entry (abfd, f, entry) } fprintf (f, "]"); - fprintf (f, "\n "); + fprintf (f, "\n "); bfd_sym_print_type_information (abfd, f, buf, entry->physical_size, 0, &offset); if (offset != entry->physical_size) - fprintf (f, "\n [parser used %lu bytes instead of %lu]", offset, entry->physical_size); } + fprintf (f, "\n [parser used %lu bytes instead of %lu]", offset, entry->physical_size); +} void -bfd_sym_print_file_references_index_table_entry (abfd, f, entry) - bfd *abfd ATTRIBUTE_UNUSED; - FILE *f; - bfd_sym_file_references_index_table_entry *entry ATTRIBUTE_UNUSED; +bfd_sym_print_file_references_index_table_entry (bfd *abfd ATTRIBUTE_UNUSED, + FILE *f, + bfd_sym_file_references_index_table_entry *entry ATTRIBUTE_UNUSED) { fprintf (f, "[UNIMPLEMENTED]"); } void -bfd_sym_print_constant_pool_entry (abfd, f, entry) - bfd *abfd ATTRIBUTE_UNUSED; - FILE *f; - bfd_sym_constant_pool_entry *entry ATTRIBUTE_UNUSED; +bfd_sym_print_constant_pool_entry (bfd *abfd ATTRIBUTE_UNUSED, + FILE *f, + bfd_sym_constant_pool_entry *entry ATTRIBUTE_UNUSED) { fprintf (f, "[UNIMPLEMENTED]"); } unsigned char * -bfd_sym_display_name_table_entry (abfd, f, entry) - bfd *abfd; - FILE *f; - unsigned char *entry; +bfd_sym_display_name_table_entry (bfd *abfd, + FILE *f, + unsigned char *entry) { - unsigned long index; + unsigned long sym_index; unsigned long offset; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - index = (entry - sdata->name_table) / 2; - - if ((sdata->version >= BFD_SYM_VERSION_3_4) && (entry[0] == 255) && (entry[1] == 0)) + sym_index = (entry - sdata->name_table) / 2; + + if (sdata->version >= BFD_SYM_VERSION_3_4 && entry[0] == 255 && entry[1] == 0) { - unsigned short length = bfd_getb16 (entry + 2); - fprintf (f, "[%8lu] \"%.*s\"\n", index, length, entry + 4); + unsigned short length = bfd_getb16 (entry + 2); + fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, length, entry + 4); offset = 2 + length + 1; } else { - if (! ((entry[0] == 0) || ((entry[0] == 1) && (entry[1] == '\0')))) - fprintf (f, "[%8lu] \"%.*s\"\n", index, entry[0], entry + 1); + if (! (entry[0] == 0 || (entry[0] == 1 && entry[1] == '\0'))) + fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, entry[0], entry + 1); if (sdata->version >= BFD_SYM_VERSION_3_4) offset = entry[0] + 2; @@ -1945,9 +1887,7 @@ bfd_sym_display_name_table_entry (abfd, f, entry) } void -bfd_sym_display_name_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_name_table (bfd *abfd, FILE *f) { unsigned long name_table_len; unsigned char *name_table, *name_table_end, *cur; @@ -1959,9 +1899,9 @@ bfd_sym_display_name_table (abfd, f) name_table_len = sdata->header.dshb_nte.dti_page_count * sdata->header.dshb_page_size; name_table = sdata->name_table; name_table_end = name_table + name_table_len; - + fprintf (f, "name table (NTE) contains %lu bytes:\n\n", name_table_len); - + cur = name_table; for (;;) { @@ -1972,9 +1912,7 @@ bfd_sym_display_name_table (abfd, f) } void -bfd_sym_display_resources_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_resources_table (bfd *abfd, FILE *f) { unsigned long i; bfd_sym_resources_table_entry entry; @@ -1985,7 +1923,7 @@ bfd_sym_display_resources_table (abfd, f) fprintf (f, "resource table (RTE) contains %lu objects:\n\n", sdata->header.dshb_rte.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_rte.dti_object_count; i++) { if (bfd_sym_fetch_resources_table_entry (abfd, &entry, i) < 0) @@ -2000,9 +1938,7 @@ bfd_sym_display_resources_table (abfd, f) } void -bfd_sym_display_modules_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_modules_table (bfd *abfd, FILE *f) { unsigned long i; bfd_sym_modules_table_entry entry; @@ -2028,9 +1964,7 @@ bfd_sym_display_modules_table (abfd, f) } void -bfd_sym_display_file_references_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_file_references_table (bfd *abfd, FILE *f) { unsigned long i; bfd_sym_file_references_table_entry entry; @@ -2056,12 +1990,10 @@ bfd_sym_display_file_references_table (abfd, f) } void -bfd_sym_display_contained_modules_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_contained_modules_table (bfd *abfd, FILE *f) { unsigned long i; - bfd_sym_contained_modules_table_entry entry; + bfd_sym_contained_modules_table_entry entry; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); @@ -2069,7 +2001,7 @@ bfd_sym_display_contained_modules_table (abfd, f) fprintf (f, "contained modules table (CMTE) contains %lu objects:\n\n", sdata->header.dshb_cmte.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_cmte.dti_object_count; i++) { if (bfd_sym_fetch_contained_modules_table_entry (abfd, &entry, i) < 0) @@ -2084,9 +2016,7 @@ bfd_sym_display_contained_modules_table (abfd, f) } void -bfd_sym_display_contained_variables_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_contained_variables_table (bfd *abfd, FILE *f) { unsigned long i; bfd_sym_contained_variables_table_entry entry; @@ -2097,7 +2027,7 @@ bfd_sym_display_contained_variables_table (abfd, f) fprintf (f, "contained variables table (CVTE) contains %lu objects:\n\n", sdata->header.dshb_cvte.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_cvte.dti_object_count; i++) { if (bfd_sym_fetch_contained_variables_table_entry (abfd, &entry, i) < 0) @@ -2114,12 +2044,10 @@ bfd_sym_display_contained_variables_table (abfd, f) } void -bfd_sym_display_contained_statements_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_contained_statements_table (bfd *abfd, FILE *f) { unsigned long i; - bfd_sym_contained_statements_table_entry entry; + bfd_sym_contained_statements_table_entry entry; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); @@ -2127,7 +2055,7 @@ bfd_sym_display_contained_statements_table (abfd, f) fprintf (f, "contained statements table (CSNTE) contains %lu objects:\n\n", sdata->header.dshb_csnte.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_csnte.dti_object_count; i++) { if (bfd_sym_fetch_contained_statements_table_entry (abfd, &entry, i) < 0) @@ -2142,9 +2070,7 @@ bfd_sym_display_contained_statements_table (abfd, f) } void -bfd_sym_display_contained_labels_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_contained_labels_table (bfd *abfd, FILE *f) { unsigned long i; bfd_sym_contained_labels_table_entry entry; @@ -2155,7 +2081,7 @@ bfd_sym_display_contained_labels_table (abfd, f) fprintf (f, "contained labels table (CLTE) contains %lu objects:\n\n", sdata->header.dshb_clte.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_clte.dti_object_count; i++) { if (bfd_sym_fetch_contained_labels_table_entry (abfd, &entry, i) < 0) @@ -2170,12 +2096,10 @@ bfd_sym_display_contained_labels_table (abfd, f) } void -bfd_sym_display_contained_types_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_contained_types_table (bfd *abfd, FILE *f) { unsigned long i; - bfd_sym_contained_types_table_entry entry; + bfd_sym_contained_types_table_entry entry; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); @@ -2183,7 +2107,7 @@ bfd_sym_display_contained_types_table (abfd, f) fprintf (f, "contained types table (CTTE) contains %lu objects:\n\n", sdata->header.dshb_ctte.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_ctte.dti_object_count; i++) { if (bfd_sym_fetch_contained_types_table_entry (abfd, &entry, i) < 0) @@ -2198,12 +2122,10 @@ bfd_sym_display_contained_types_table (abfd, f) } void -bfd_sym_display_file_references_index_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_file_references_index_table (bfd *abfd, FILE *f) { unsigned long i; - bfd_sym_file_references_index_table_entry entry; + bfd_sym_file_references_index_table_entry entry; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); @@ -2211,7 +2133,7 @@ bfd_sym_display_file_references_index_table (abfd, f) fprintf (f, "file references index table (FITE) contains %lu objects:\n\n", sdata->header.dshb_fite.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_fite.dti_object_count; i++) { if (bfd_sym_fetch_file_references_index_table_entry (abfd, &entry, i) < 0) @@ -2226,12 +2148,10 @@ bfd_sym_display_file_references_index_table (abfd, f) } void -bfd_sym_display_constant_pool (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_constant_pool (bfd *abfd, FILE *f) { unsigned long i; - bfd_sym_constant_pool_entry entry; + bfd_sym_constant_pool_entry entry; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); @@ -2239,7 +2159,7 @@ bfd_sym_display_constant_pool (abfd, f) fprintf (f, "constant pool (CONST) contains %lu objects:\n\n", sdata->header.dshb_const.dti_object_count); - + for (i = 1; i <= sdata->header.dshb_const.dti_object_count; i++) { if (bfd_sym_fetch_constant_pool_entry (abfd, &entry, i) < 0) @@ -2254,13 +2174,11 @@ bfd_sym_display_constant_pool (abfd, f) } void -bfd_sym_display_type_information_table (abfd, f) - bfd *abfd; - FILE *f; +bfd_sym_display_type_information_table (bfd *abfd, FILE *f) { unsigned long i; - bfd_sym_type_table_entry index; - bfd_sym_type_information_table_entry entry; + bfd_sym_type_table_entry sym_index; + bfd_sym_type_information_table_entry entry; bfd_sym_data_struct *sdata = NULL; BFD_ASSERT (bfd_sym_valid (abfd)); @@ -2274,16 +2192,16 @@ bfd_sym_display_type_information_table (abfd, f) fprintf (f, "type table (TINFO) contains [INVALID] objects:\n\n"); return; } - + for (i = 100; i <= sdata->header.dshb_tte.dti_object_count; i++) { - if (bfd_sym_fetch_type_table_entry (abfd, &index, i - 100) < 0) + if (bfd_sym_fetch_type_table_entry (abfd, &sym_index, i - 100) < 0) fprintf (f, " [%8lu] [INVALID]\n", i); else { - fprintf (f, " [%8lu] (TINFO %lu) ", i, index); + fprintf (f, " [%8lu] (TINFO %lu) ", i, sym_index); - if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, index) < 0) + if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, sym_index) < 0) fprintf (f, "[INVALID]"); else bfd_sym_print_type_information_table_entry (abfd, f, &entry); @@ -2293,139 +2211,132 @@ bfd_sym_display_type_information_table (abfd, f) } } -const bfd_target * -bfd_sym_object_p (abfd) - bfd *abfd; +int +bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata) { - bfd_sym_data_struct *mdata = NULL; asection *bfdsec; const char *name = "symbols"; - - mdata = ((bfd_sym_data_struct *) - bfd_alloc (abfd, sizeof (bfd_sym_data_struct))); - if (mdata == NULL) - return NULL; - - abfd->tdata.sym_data = mdata; mdata->name_table = 0; mdata->sbfd = abfd; + mdata->version = version; bfd_seek (abfd, 0, SEEK_SET); - if (bfd_sym_read_version (abfd, &mdata->version) != 0) - { - abfd->tdata.sym_data = NULL; - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - bfd_seek (abfd, 0, SEEK_SET); if (bfd_sym_read_header (abfd, &mdata->header, mdata->version) != 0) - { - abfd->tdata.sym_data = NULL; - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + return -1; mdata->name_table = bfd_sym_read_name_table (abfd, &mdata->header); if (mdata->name_table == NULL) - { - abfd->tdata.sym_data = NULL; - bfd_set_error (bfd_error_wrong_format); - return NULL; - } + return -1; - bfdsec = bfd_make_section_anyway (abfd, name); + bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS); if (bfdsec == NULL) - { - abfd->tdata.sym_data = NULL; - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - + return -1; + bfdsec->vma = 0; bfdsec->lma = 0; - bfdsec->_raw_size = 0; + bfdsec->size = 0; bfdsec->filepos = 0; bfdsec->alignment_power = 0; - - bfdsec->flags = SEC_HAS_CONTENTS; - return abfd->xvec; + abfd->tdata.sym_data = mdata; + + return 0; } -asymbol * -bfd_sym_make_empty_symbol (abfd) - bfd *abfd; +const bfd_target * +bfd_sym_object_p (bfd *abfd) { - return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); + struct bfd_preserve preserve; + bfd_sym_version version = -1; + + preserve.marker = NULL; + bfd_seek (abfd, 0, SEEK_SET); + if (bfd_sym_read_version (abfd, &version) != 0) + goto wrong; + + preserve.marker = bfd_alloc (abfd, sizeof (bfd_sym_data_struct)); + if (preserve.marker == NULL + || ! bfd_preserve_save (abfd, &preserve)) + goto fail; + + if (bfd_sym_scan (abfd, version, + (bfd_sym_data_struct *) preserve.marker) != 0) + goto wrong; + + bfd_preserve_finish (abfd, &preserve); + return abfd->xvec; + + wrong: + bfd_set_error (bfd_error_wrong_format); + + fail: + if (preserve.marker != NULL) + bfd_preserve_restore (abfd, &preserve); + return NULL; } +#define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol + void -bfd_sym_get_symbol_info (abfd, symbol, ret) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +bfd_sym_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, asymbol *symbol, symbol_info *ret) { bfd_symbol_info (symbol, ret); } long -bfd_sym_get_symtab_upper_bound (abfd) - bfd *abfd ATTRIBUTE_UNUSED; +bfd_sym_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED) { return 0; } long -bfd_sym_get_symtab (abfd, sym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol **sym ATTRIBUTE_UNUSED; +bfd_sym_canonicalize_symtab (bfd *abfd ATTRIBUTE_UNUSED, asymbol **sym ATTRIBUTE_UNUSED) { return 0; } int -bfd_sym_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - boolean exec ATTRIBUTE_UNUSED; +bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } const bfd_target sym_vec = { - "sym", /* name */ - bfd_target_sym_flavour, /* flavour */ - BFD_ENDIAN_BIG, /* byteorder */ - BFD_ENDIAN_BIG, /* header_byteorder */ - (HAS_RELOC | EXEC_P | /* object flags */ + "sym", /* Name. */ + bfd_target_sym_flavour, /* Flavour. */ + BFD_ENDIAN_BIG, /* Byteorder. */ + BFD_ENDIAN_BIG, /* Header byteorder. */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA - | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ - 0, /* symbol_leading_char */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + | SEC_ROM | SEC_HAS_CONTENTS), /* Section_flags. */ + 0, /* Symbol_leading_char. */ + ' ', /* AR_pad_char. */ + 16, /* AR_max_namelen. */ + 0, /* match priority. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ - { /* bfd_check_format */ + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */ + { /* bfd_check_format. */ _bfd_dummy_target, - bfd_sym_object_p, /* bfd_check_format */ + bfd_sym_object_p, /* bfd_check_format. */ _bfd_dummy_target, _bfd_dummy_target, }, - { /* bfd_set_format */ + { /* bfd_set_format. */ bfd_false, bfd_sym_mkobject, bfd_false, bfd_false, }, - { /* bfd_write_contents */ + { /* bfd_write_contents. */ bfd_false, bfd_true, bfd_false, @@ -2437,13 +2348,12 @@ const bfd_target sym_vec = BFD_JUMP_TABLE_CORE (_bfd_nocore), BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), BFD_JUMP_TABLE_SYMBOLS (bfd_sym), - BFD_JUMP_TABLE_RELOCS (bfd_sym), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), BFD_JUMP_TABLE_WRITE (bfd_sym), BFD_JUMP_TABLE_LINK (bfd_sym), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - + NULL }; -