binutils-gdb/bfd/xsym.c

2359 lines
61 KiB
C
Raw Normal View History

2002-11-06 21:26:29 +08:00
/* xSYM symbol-file support for BFD.
2016-01-01 19:25:12 +08:00
Copyright (C) 1999-2016 Free Software Foundation, Inc.
2002-11-06 21:26:29 +08:00
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 3 of the License, or
2002-11-06 21:26:29 +08:00
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
2002-11-06 21:26:29 +08:00
/* xSYM is the debugging format used by CodeWarrior on Mac OS classic. */
#include "sysdep.h"
PR 14072 * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * sysdep.h: Generate an error if included before config.h. * alpha-opc.c: Include sysdep.h before any other header file. * alpha-dis.c: Likewise. * avr-dis.c: Likewise. * cgen-opc.c: Likewise. * cr16-dis.c: Likewise. * cris-dis.c: Likewise. * crx-dis.c: Likewise. * d10v-dis.c: Likewise. * d10v-opc.c: Likewise. * d30v-dis.c: Likewise. * d30v-opc.c: Likewise. * h8500-dis.c: Likewise. * i370-dis.c: Likewise. * i370-opc.c: Likewise. * m10200-dis.c: Likewise. * m10300-dis.c: Likewise. * micromips-opc.c: Likewise. * mips-opc.c: Likewise. * mips61-opc.c: Likewise. * moxie-dis.c: Likewise. * or32-opc.c: Likewise. * pj-dis.c: Likewise. * ppc-dis.c: Likewise. * ppc-opc.c: Likewise. * s390-dis.c: Likewise. * sh-dis.c: Likewise. * sh64-dis.c: Likewise. * sparc-dis.c: Likewise. * sparc-opc.c: Likewise. * spu-dis.c: Likewise. * tic30-dis.c: Likewise. * tic54x-dis.c: Likewise. * tic80-dis.c: Likewise. * tic80-opc.c: Likewise. * tilegx-dis.c: Likewise. * tilepro-dis.c: Likewise. * v850-dis.c: Likewise. * v850-opc.c: Likewise. * vax-dis.c: Likewise. * w65-dis.c: Likewise. * xgate-dis.c: Likewise. * xtensa-dis.c: Likewise. * rl78-decode.opc: Likewise. * rl78-decode.c: Regenerate. * rx-decode.opc: Likewise. * rx-decode.c: Regenerate. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * sysdep.h: Generate an error if included before config.h. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * aclocal.m4: Regenerate. * bfd-in.h: Generate an error if included before config.h. * sysdep.h: Likewise. * bfd-in2.h: Regenerate. * compress.c: Remove #include "config.h". * plugin.c: Likewise. * elf32-m68hc1x.c: Include sysdep.h before alloca-conf.h. * elf64-hppa.c: Likewise. * som.c: Likewise. * xsymc.c: Likewise. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * aclocal.m4: Regenerate. * Makefile.am: Use wrappers around C files generated by flex. * Makefile.in: Regenerate. * doc/Makefile.in: Regenerate. * itbl-lex-wrapper.c: New file. * config/bfin-lex-wrapper.c: New file. * cgen.c: Include as.h before setjmp.h. * config/tc-dlx.c: Include as.h before any other header. * config/tc-h8300.c: Likewise. * config/tc-lm32.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mmix.c: Likewise. * config/tc-msp430.c: Likewise. * config/tc-or32.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-xtensa.c: Likewise. * configure.in: Add check that sysdep.h has been included before any system header files. * configure: Regenerate. * config.in: Regenerate. * unwind-ia64.h: Include config.h.
2012-05-17 23:13:28 +08:00
#include "alloca-conf.h"
2002-11-06 21:26:29 +08:00
#include "xsym.h"
#include "bfd.h"
#include "libbfd.h"
2005-04-11 16:23:05 +08:00
#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_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME. In https://www.sourceware.org/ml/binutils/2005-06/msg00082.html HJ implemented bfd_find_line for DWARF2, but cheated a little in not using the usual NAME##_find_line, saving quite a lot of boring editing. However that shortcut probably contributed to bfd_find_nearest_line_discriminator being implemented the same way, and missing support for some targets. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line. * aout-adobe.c (aout_32_find_line): Define. (aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup, aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define. * aout-target.h (MY_find_line): Define. * aout-tic30.c (MY_find_line): Define. * binary.c (binary_find_line): Define. * bout.c (aout_32_find_line): Define. * coff-rs6000.c (_bfd_xcoff_find_line): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line. (rs6000_xcoff64_aix_vec): Likewise. * elf-bfd.h (_bfd_generic_find_line): Don't define. * elfxx-target.h (bfd_elfNN_find_line): Define. * i386msdos.c (msdos_find_line): Define. * i386os9k.c (aout_32_find_line): Define. * ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func. (ieee_find_nearest_line, ieee_find_line, ieee_find_inliner_info): Define. * ihex.c (ihex_find_line): Define. * libbfd-in.h (_bfd_nosymbols_find_line): Define. (_bfd_generic_find_line): Don't define. * libbfd.c (_bfd_generic_find_line): Delete. * libcoff-in.h (coff_find_line): Define. * libecoff.h (_bfd_ecoff_find_line): Define. * mach-o.h (bfd_mach_o_find_line): Define. * mmo.c (mmo_find_line): Define. * nlm-target.h (nlm_find_line): Define. * oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete. (oasys_find_nearest_line, oasys_find_line, oasys_find_inliner_info): Define. * pef.c (bfd_pef_find_line): Define. * plugin.c (bfd_plugin_find_line): Define. * ppcboot.c (ppcboot_find_line): Define. * som.c (som_find_line): Define. * srec.c (srec_find_line): Define. * tekhex.c (tekhex_find_line): Define. * versados.c (versados_find_line): Define. * vms-alpha.c (alpha_vms_find_line): Define. * xsym.c (bfd_sym_find_line): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-10-15 13:10:45 +08:00
#define bfd_sym_find_line _bfd_nosymbols_find_line
Approved by nickc@redhat.com 2005-05-23 Fred Fish <fnf@specifixinc.com> * dwarf2.c (struct dwarf2_debug): Add inliner_chain member. (struct funcinfo): Add caller_func, caller_file, caller_line. tag, and nesting_level members. (lookup_address_in_function_table): Change first passed parameter from "struct funcinfo *" to "struct comp_unit *". (lookup_address_in_function_table): Dereference unit to find function table. (lookup_address_in_function_table): Traverse the function list to create a chain of inlined functions back to the first non inlined function. (scan_unit_for_functions): Remember tag and nesting level. Handle DW_AT_call_file and DW_AT_call_line. (comp_unit_find_nearest_line): Adjust lookup_address_in_function_table call to pass unit pointer instead of function table pointer. For inlined functions, save pointer to the inliner chain. (_bfd_dwarf2_find_nearest_line): Initialize inliner_chain to NULL. (_bfd_dwarf2_find_inliner_info): New function that returns information from the inliner chain after a call to bfd_find_nearest_line. * bfd.c (bfd_find_inliner_info): Define using BFD_SEND. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Add entry for NAME##_find_inliner_info. (bfd_target): Add _bfd_find_inliner_info. * bfd-in2.h: Regenerate. * libbfd-in.h (_bfd_nosymbols_find_inliner_info): Define as macro that always returns bfd_false. (_bfd_dwarf2_find_inliner_info): Declare. * libbfd.h: Regenerate. * elf32-arm.c (elf32_arm_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. (bfd_elf32_find_inliner_info): Define to elf32_arm_find_inliner_info. * elfxx-mips.c (_bfd_mips_elf_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * elfxx-mips.h (_bfd_mips_elf_find_inliner_info): Declare. * elfn32-mips.c (bfd_elf32_find_inliner_info): Define to _bfd_mips_elf_find_inliner_info. * elf64-mips.c (bfd_elf64_find_inliner_info): Ditto. * elf32-mips.c (bfd_elf32_find_inliner_info): Ditto. * elf.c (_bfd_elf_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * elf-bfd.h (_bfd_elf_find_inliner_info): Declare. * elfxx-target.h (bfd_elfNN_find_inliner_info): Define to _bfd_elf_find_inliner_info. * coffgen.c (coff_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * libcoff-in.h (coff_find_inliner_info): Declare. * libcoff.h: Regenerate. * coff-rs6000.c (rs6000coff_vec): Add coff_find_inliner_info. (pmac_xcoff_vec) Ditto. * coff64-rs6000.c (rs6000coff64_vec): Ditto. (aix5coff64_vec): Ditto. * aout-target.h (MY_find_inliner_info): Define as _bfd_nosymbols_find_inliner_info. * aout-tic30.c (MY_find_inliner_info): Ditto. * binary.c (binary_find_inliner_info): Ditto. * i386msdos.c (msdos_find_inliner_info): Ditto. * ihex.c (ihex_find_inliner_info): Ditto. * libaout.h (aout_32_find_inliner_info): Ditto. * libecoff.h (_bfd_ecoff_find_inliner_info): Ditto. * mach-o.c (bfd_mach_o_find_inliner_info): Ditto. * mmo.c (mmo_find_inliner_info): Ditto. * nlm-target.h (nlm_find_inliner_info): Ditto. * pef.c (bfd_pef_find_inliner_info): Ditto. * ppcboot.c (ppcboot_find_inliner_info): Ditto. * srec.c (srec_find_inliner_info): Ditto. * tekhex.c (tekhex_find_inliner_info): Ditto. * versados.c (versados_find_inliner_info): Ditto. * xsym.c (bfd_sym_find_inliner_info): Ditto. * ieee.c (ieee_find_inliner_info): New function that always returns FALSE. * oasys.c (oasys_find_inliner_info): Ditto. * vms.c (vms_find_inliner_info): Ditto.
2005-05-24 01:44:55 +08:00
#define bfd_sym_find_inliner_info _bfd_nosymbols_find_inliner_info
Use get_symbol_version_string in BFD_JUMP_TABLE_SYMBOLS This patch adds get_symbol_version_string to BFD_JUMP_TABLE_SYMBOLS so that we can use bfd_get_symbol_version_string in objdump for non-ELF targets. bfd/ * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_get_symbol_version_string. (bfd_get_symbol_version_string): New. * aout-adobe.c (aout_32_get_symbol_version_string): Define using _bfd_nosymbols define. * aout-target.h (MY_get_symbol_version_string): Likewise. * aout-tic30.c (MY_get_symbol_version_string): Likewise. * binary.c (binary_get_symbol_version_string): Likewise. * bout.c (aout_32_get_symbol_version_string): Likewise. * coff-rs6000.c (_bfd_xcoff_get_symbol_version_string): Likewise. * i386msdos.c (msdos_get_symbol_version_string): Likewise. * i386os9k.c (aout_32_get_symbol_version_string): Likewise. * ieee.c (ieee_get_symbol_version_string): Likewise. * ihex.c (ihex_get_symbol_version_string): Likewise. * libecoff.h (_bfd_ecoff_get_symbol_version_string): Likewise. * mach-o-target.c (bfd_mach_o_get_symbol_version_string): Likewise. * mmo.c (mmo_get_symbol_version_string): Likewise. * nlm-target.h (nlm_get_symbol_version_string): Likewise. * oasys.c (oasys_get_symbol_version_string): Likewise. * pef.c (bfd_pef_get_symbol_version_string): Likewise. * plugin.c (bfd_plugin_get_symbol_version_string): Likewise. * ppcboot.c (ppcboot_get_symbol_version_string): Likewise. * som.c (som_get_symbol_version_string): Likewise. * srec.c (srec_get_symbol_version_string): Likewise. * tekhex.c (tekhex_get_symbol_version_string): Likewise. * versados.c (versados_get_symbol_version_string): Likewise. * vms-alpha.c (alpha_vms_get_symbol_version_string): Likewise. * xsym.c (bfd_sym_get_symbol_version_string): Likewise. * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_get_symbol_version_string. (rs6000_xcoff64_aix_vec): Likewise. * elf-bfd.h (bfd_elf_get_symbol_version_string): Renamed to ... (_bfd_elf_get_symbol_version_string): This. * elf.c: Likewise. (bfd_elf_print_symbol): Updated. * elfxx-target.h (bfd_elfNN_get_symbol_version_string): Define. * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Define. * libcoff-in.h (coff_get_symbol_version_string): Likewise. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. * libcoff.h: Likewise. binutils/ * objdump.c (objdump_print_symname): Replace bfd_elf_get_symbol_version_string with bfd_get_symbol_version_string.
2014-11-26 01:28:32 +08:00
#define bfd_sym_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
2005-04-11 16:23:05 +08:00
#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
include/ChangeLog 2011-07-11 Catherine Moore <clm@codesourcery.com> * bfdlink.h (flag_type): New enumeration. (flag_info_list): New structure. (flag_info): New structure. bfd/ChangeLog 2011-07-11 Catherine Moore <clm@codesourcery.com> * aout-adobe.c (aout_32_bfd_lookup_section_flags): New definition. * aout-target.h (MY_bfd_lookup_section_flags): New definition. * aout-tic30.c (MY_bfd_lookup_section_flags): New definition. * bfd-in2.h: Regenerated. * bfd.c (bfd_lookup_section_flags): New definition. * binary.c (binary_bfd_lookup_section_flags): New definition. * bout.c (b_out_bfd_lookup_section_flags): New definition. * coff-alpha.c (_bfd_ecoff_bfd_lookup_section_flags): New definition. * coff-mips.c (_bfd_ecoff_bfd_lookup_section_flags): New definition. * coff-rs6000.c (rs6000coff_vec): Include bfd_generic_lookup_section_flags. (pmac_xcoff_vec): Likewise. * coffcode.h (coff_bfd_lookup_section_flags): New definition. * coff64-rs6000.c (rs6000coff64_vec): Include bfd_generic_lookup_section_flags. (aix5coff64_vec): Likewise. * ecoff.c (bfd_debug_section): Initialize flag_info field. * elf-bfd.h (elf_backend_lookup_section_flags_hook): Declare. (bfd_elf_lookup_section_flags): Declare. * elflink.c (bfd_elf_lookup_section_flags): New function. * elfxx-target.h (bfd_elfNN_bfd_lookup_section_flags): Define. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_data): Add elf_backend_lookup_section_flags_hook. * i386msdos.c (msdos_bfd_lookup_section_flags): New define. * i386os9k.c (os9k_bfd_lookup_section_flags): New define. * ieee.c (ieee_bfd_lookup_section_flags): New define. * ihex.c (ihex_bfd_lookup_section_flags): New define. * libbfd-in.h (_bfd_nolink_bfd_lookup_section_flags): Declare. (bfd_generic_lookup_section_flags): Declare. * libbfd.h: Regenerated. * mach-o-target.c (bfd_mach_o_bfd_lookup_section_flags): New. * mmo.c (mmo_bfd_lookup_section_flags): New definition. * nlm-target.h (nlm_bfd_lookup_section_flags): New definition. * oasys.c (oasys_bfd_lookup_section_flags): New definition. * pef.c (bfd_pef_bfd_lookup_section_flags): New definition. * plugin.c (bfd_plugin_bfd_lookup_section_flags): New definition. * ppcboot.c (ppcboot_bfd_lookup_section_flags): New definition. * reloc.c (bfd_generic_lookup_section_flags): New function. * som.c (som_bfd_lookup_section_flags): New definition. * srec.c (srec_bfd_lookup_section_flags): New definition. * targets.c (flag_info): Declare. (NAME##_bfd_lookup_section_flags): Add to LINK jump table. (_bfd_lookup_section_flags): New. * tekhex.c (tekhex_bfd_lookup_section_flags): New definition. * versados.c (versados_bfd_lookup_section_flags): New definition. * vms-alpha.c (alpha_vms_bfd_lookup_section_flag): New definition. * xsym.c (bfd_sym_bfd_lookup_section_flags): New definition. ld/ChangeLog 2011-07-11 Catherine Moore <clm@codesourcery.com> * ld.h (section_flag_list): Add field to struct wildcard_spec. * ld.texinfo (INPUT_SECTION_FLAGS): Document. * ldgram.y (flag_info_list, flag_info): Add to union. (INPUT_SECTION_FLAGS): New token. (wildcard_spec): Initialize section_flag_list to NULL for each alternative. (sect_flag_list, sect_flags): New rules. (input_section_spec_no_keep): Add alternatives to recognize sect_flags. * ldlang.c (walk_wild_consider_section): Initialize section_flag_info field of the section struct. (lang_add_section): Check input section flags. (lang_add_wild): Initialize section_flag_list field of the statement struct. * ldlang.h (lang_input_statement_struct): Add section_flag_list field. (lang_wild_statement_struct): Likewise. * ldlex.l (INPUT_SECTION_FLAGS): New token. * mri.c (mri_draw_tree): Initialize section_flag_list to NULL. * NEWS: Announce INPUT_SECTION_FLAGS enhancement. ld/testsuite/ChangeLog 2011-07-11 Catherine Moore <clm@cm00re.com> * ld-scripts/section-flags-1.s: New. * ld-scripts/section-flags-1.t: New. * ld-scripts/section-flags-2.s: New. * ld-scripts/section-flags-2.t: New. * ld-scripts/section-flags.exp: New.
2011-07-11 23:03:09 +08:00
#define bfd_sym_bfd_lookup_section_flags bfd_generic_lookup_section_flags
2005-04-11 16:23:05 +08:00
#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
bfd/ * aout-adobe.c (aout_32_bfd_define_common_symbol): Define. * aout-target.h (MY_bfd_define_common_symbol): Likewise. * aout-tic30.c (MY_bfd_define_common_symbol): Likewise. * binary.c (binary_bfd_define_common_symbol): Likewise. * bout.c (b_out_bfd_define_common_symbol): Likewise. * coff-alpha.c (_bfd_ecoff_bfd_define_common_symbol): Likewise. * coff-mips.c (_bfd_ecoff_bfd_define_common_symbol): Likewise. * coffcode.h (coff_bfd_define_common_symbol): Likewise. * elfxx-target.h (bfd_elfNN_bfd_define_common_symbol): Likewise. * i386msdos.c (msdos_bfd_define_common_symbol): Likewise. * i386os9k.c (os9k_bfd_define_common_symbol): Likewise. * ieee.c (ieee_bfd_define_common_symbol): Likewise. * ihex.c (ihex_bfd_define_common_symbol): Likewise. * libbfd-in.h (_bfd_nolink_bfd_define_common_symbol): Likewise. * mach-o.c (bfd_mach_o_bfd_define_common_symbol): Likewise. * mmo.c (mmo_bfd_define_common_symbol): Likewise. * nlm-target.h (nlm_bfd_define_common_symbol): Likewise. * oasys.c (oasys_bfd_define_common_symbol): Likewise. * pef.c (bfd_pef_bfd_define_common_symbol): Likewise. * ppcboot.c (ppcboot_bfd_define_common_symbol): Likewise. * som.c (som_bfd_define_common_symbol): Likewise. * srec.c (srec_bfd_define_common_symbol): Likewise. * tekhex.c (tekhex_bfd_define_common_symbol): Likewise. * versados.c (versados_bfd_define_common_symbol): Likewise. * vms.c (vms_bfd_define_common_symbol): Likewise. * xcoff-target.h (_bfd_xcoff_bfd_define_common_symbol): Likewise. * xsym.c (bfd_sym_bfd_define_common_symbol): Likewise. * coff-rs6000.c (rs6000coff_vec): Add _bfd_xcoff_define_common_symbol. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * linker.c (bfd_generic_define_common_symbol): New function. * targets.c (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_define_common_symbol. (_bfd_define_common_symbol): New field. * libcoff-in.h (_bfd_xcoff_define_common_symbol): Declare. * xcofflink.c (_bfd_xcoff_define_common_symbol): New function. (xcoff_build_ldsyms): Don't set XCOFF_DEF_REGULAR for common symbols here. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. * libcoff.h: Likewise. ld/ * ldlang.c (lang_one_common): Use bfd_define_common_symbol. ld/testsuite/ * ld-powerpc/aix-export-2.s, ld-powerpc/aix-export-2.nd: New test. * ld-powerpc/aix52.exp: Run it.
2009-04-17 07:07:00 +08:00
#define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol
2005-04-11 16:23:05 +08:00
#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
#define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
2009-11-23 Paul Brook <paul@codesourcery.com> ld/ * ldexp.c: Copy symbol type for simple assignments. bfd/ * libbfd-in.h (_bfd_generic_copy_link_hash_symbol_type): Add prototype. * elf-bfd.h (_bfd_elf_copy_link_hash_symbol_type): Add prototype. * linker.c (_bfd_generic_copy_link_hash_symbol_type): New function. * elflink.c (_bfd_elf_copy_link_hash_symbol_type): New function. * targets.c (BFD_JUMP_TABLE_LINK, struct bfd_target): Add _copy_link_hash_symbol_type. * bfd/coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add _bfd_generic_copy_link_hash_symbol_type. * bfd/coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add _bfd_generic_copy_link_hash_symbol_type. * aout-adobe.c (aout_32_bfd_copy_link_hash_symbol_type): Define. * aout-target.h (MY_bfd_copy_link_hash_symbol_type): Define. * aout-tic30.c (MY_bfd_copy_link_hash_symbol_type): Define. * binary.c (binary_bfd_copy_link_hash_symbol_type): Define. * bout.c (b_out_bfd_copy_link_hash_symbol_type): Define. * coffcode.h (coff_bfd_copy_link_hash_symbol_type): Define. * elfxx-target.h (bfd_elfNN_bfd_copy_link_hash_symbol_type): Define. * i386msdos.c (msdos_bfd_copy_link_hash_symbol_type): Define. * i386os9k.c (os9k_bfd_copy_link_hash_symbol_type): Define. * ieee.c (ieee_bfd_copy_link_hash_symbol_type): Define. * ihex.c (ihex_bfd_copy_link_hash_symbol_type): Define. * libecoff.h (_bfd_ecoff_bfd_copy_link_hash_symbol_type): Define. * mach-o.c (bfd_mach_o_bfd_copy_link_hash_symbol_type): Define. * mmo.c (mmo_bfd_copy_link_hash_symbol_type): Define. * nlm-target.h (nlm_bfd_copy_link_hash_symbol_type): Define. * oasys.c (oasys_bfd_copy_link_hash_symbol_type): Define. * pef.c (bfd_pef_bfd_copy_link_hash_symbol_type): Define. * ppcboot.c (ppcboot_bfd_copy_link_hash_symbol_type): Define. * som.c (som_bfd_copy_link_hash_symbol_type): Define. * srec.c (srec_bfd_copy_link_hash_symbol_type): Define. * tekhex.c (tekhex_bfd_copy_link_hash_symbol_type): Define. * versados.c (versados_bfd_copy_link_hash_symbol_type): Define. * vms.c (vms_bfd_copy_link_hash_symbol_type): Define. * xsym.c (bfd_sym_bfd_copy_link_hash_symbol_type): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/testsuite * ld-arm/script-type.sym: New test. * ld-arm/script-type.s: New test. * ld-arm/script-type.s: New test.
2009-11-23 22:41:33 +08:00
#define bfd_sym_bfd_copy_link_hash_symbol_type \
_bfd_generic_copy_link_hash_symbol_type
2005-04-11 16:23:05 +08:00
#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
2002-11-06 21:26:29 +08:00
extern const bfd_target sym_vec;
static int
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
pstrcmp (const char *as, const char *bs)
2002-11-06 21:26:29 +08:00
{
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
const unsigned char *a = (const unsigned char *) as;
const unsigned char *b = (const unsigned char *) bs;
2002-11-06 21:26:29 +08:00
unsigned char clen;
int ret;
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
clen = (a[0] > b[0]) ? b[0] : a[0];
2002-11-06 21:26:29 +08:00
ret = memcmp (a + 1, b + 1, clen);
if (ret != 0)
return ret;
if (a[0] == b[0])
return 0;
else if (a[0] < b[0])
return -1;
else
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
return 1;
2002-11-06 21:26:29 +08:00
}
static unsigned long
2005-04-11 16:23:05 +08:00
compute_offset (unsigned long first_page,
unsigned long page_size,
unsigned long entry_size,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
unsigned long entries_per_page = page_size / entry_size;
unsigned long page_number = first_page + (sym_index / entries_per_page);
unsigned long page_offset = (sym_index % entries_per_page) * entry_size;
2002-11-06 21:26:29 +08:00
return (page_number * page_size) + page_offset;
}
bfd_boolean
2005-04-11 16:23:05 +08:00
bfd_sym_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
return 1;
2002-11-06 21:26:29 +08:00
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_symbol (bfd *abfd ATTRIBUTE_UNUSED,
void * afile ATTRIBUTE_UNUSED,
asymbol *symbol ATTRIBUTE_UNUSED,
bfd_print_symbol_type how ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
return;
}
bfd_boolean
2005-04-11 16:23:05 +08:00
bfd_sym_valid (bfd *abfd)
2002-11-06 21:26:29 +08:00
{
if (abfd == NULL || abfd->xvec == NULL)
return 0;
return abfd->xvec == &sym_vec;
2002-11-06 21:26:29 +08:00
}
unsigned char *
2005-04-11 16:23:05 +08:00
bfd_sym_read_name_table (bfd *abfd, bfd_sym_header_block *dshb)
2002-11-06 21:26:29 +08:00
{
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;
2005-04-11 16:23:05 +08:00
rstr = bfd_alloc (abfd, table_size);
2002-11-06 21:26:29 +08:00
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)
2002-11-06 21:26:29 +08:00
{
bfd_release (abfd, rstr);
return NULL;
}
2002-11-06 21:26:29 +08:00
return rstr;
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_file_reference_v32 (unsigned char *buf,
size_t len,
bfd_sym_file_reference *entry)
2002-11-06 21:26:29 +08:00
{
BFD_ASSERT (len == 6);
entry->fref_frte_index = bfd_getb16 (buf);
entry->fref_offset = bfd_getb32 (buf + 2);
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_disk_table_v32 (unsigned char *buf,
size_t len,
bfd_sym_table_info *table)
2002-11-06 21:26:29 +08:00
{
BFD_ASSERT (len == 8);
2002-11-06 21:26:29 +08:00
table->dti_first_page = bfd_getb16 (buf);
table->dti_page_count = bfd_getb16 (buf + 2);
table->dti_object_count = bfd_getb32 (buf + 4);
}
2002-11-06 21:26:29 +08:00
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_header_v32 (unsigned char *buf,
size_t len,
bfd_sym_header_block *header)
2002-11-06 21:26:29 +08:00
{
BFD_ASSERT (len == 154);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
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);
bfd_sym_parse_disk_table_v32 (buf + 66, 8, &header->dshb_cmte);
bfd_sym_parse_disk_table_v32 (buf + 74, 8, &header->dshb_cvte);
bfd_sym_parse_disk_table_v32 (buf + 82, 8, &header->dshb_csnte);
bfd_sym_parse_disk_table_v32 (buf + 90, 8, &header->dshb_clte);
bfd_sym_parse_disk_table_v32 (buf + 98, 8, &header->dshb_ctte);
bfd_sym_parse_disk_table_v32 (buf + 106, 8, &header->dshb_tte);
bfd_sym_parse_disk_table_v32 (buf + 114, 8, &header->dshb_nte);
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);
2002-11-06 21:26:29 +08:00
memcpy (&header->dshb_file_creator, buf + 146, 4);
memcpy (&header->dshb_file_type, buf + 150, 4);
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_read_header_v32 (bfd *abfd, bfd_sym_header_block *header)
2002-11-06 21:26:29 +08:00
{
unsigned char buf[154];
long ret;
2002-11-06 21:26:29 +08:00
ret = bfd_bread (buf, 154, abfd);
if (ret != 154)
return -1;
2002-11-06 21:26:29 +08:00
bfd_sym_parse_header_v32 (buf, 154, header);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_read_header_v34 (bfd *abfd ATTRIBUTE_UNUSED,
bfd_sym_header_block *header ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
abort ();
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_read_header (bfd *abfd,
bfd_sym_header_block *header,
bfd_sym_version version)
2002-11-06 21:26:29 +08:00
{
switch (version)
{
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
return bfd_sym_read_header_v34 (abfd, header);
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
return bfd_sym_read_header_v32 (abfd, header);
case BFD_SYM_VERSION_3_1:
default:
2005-04-11 16:23:05 +08:00
return 0;
2002-11-06 21:26:29 +08:00
}
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_read_version (bfd *abfd, bfd_sym_version *version)
2002-11-06 21:26:29 +08:00
{
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
char version_string[32];
2002-11-06 21:26:29 +08:00
long ret;
2002-11-06 21:26:29 +08:00
ret = bfd_bread (version_string, sizeof (version_string), abfd);
if (ret != sizeof (version_string))
return -1;
2002-11-06 21:26:29 +08:00
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)
*version = BFD_SYM_VERSION_3_2;
else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_3) == 0)
*version = BFD_SYM_VERSION_3_3;
else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_4) == 0)
*version = BFD_SYM_VERSION_3_4;
else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_5) == 0)
*version = BFD_SYM_VERSION_3_5;
else
return -1;
2002-11-06 21:26:29 +08:00
return 0;
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_table_summary (FILE *f,
bfd_sym_table_info *dti,
const char *name)
2002-11-06 21:26:29 +08:00
{
fprintf (f, "%-6s %13ld %13ld %13ld\n",
name,
dti->dti_first_page,
dti->dti_page_count,
dti->dti_object_count);
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_header (FILE *f, bfd_sym_header_block *dshb)
2002-11-06 21:26:29 +08:00
{
fprintf (f, " Version: %.*s\n", dshb->dshb_id[0], dshb->dshb_id + 1);
fprintf (f, " Page Size: 0x%x\n", dshb->dshb_page_size);
fprintf (f, " Hash Page: %lu\n", dshb->dshb_hash_page);
fprintf (f, " Root MTE: %lu\n", dshb->dshb_root_mte);
fprintf (f, " Modification Date: ");
fprintf (f, "[unimplemented]");
fprintf (f, " (0x%lx)\n", dshb->dshb_mod_date);
fprintf (f, " File Creator: %.4s Type: %.4s\n\n",
dshb->dshb_file_creator, dshb->dshb_file_type);
2002-11-06 21:26:29 +08:00
fprintf (f, "Table Name First Page Page Count Object Count\n");
fprintf (f, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
2002-11-06 21:26:29 +08:00
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");
bfd_sym_display_table_summary (f, &dshb->dshb_frte, "FRTE");
bfd_sym_display_table_summary (f, &dshb->dshb_cmte, "CMTE");
bfd_sym_display_table_summary (f, &dshb->dshb_cvte, "CVTE");
bfd_sym_display_table_summary (f, &dshb->dshb_csnte, "CSNTE");
bfd_sym_display_table_summary (f, &dshb->dshb_clte, "CLTE");
bfd_sym_display_table_summary (f, &dshb->dshb_ctte, "CTTE");
bfd_sym_display_table_summary (f, &dshb->dshb_tte, "TTE");
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");
2002-11-06 21:26:29 +08:00
fprintf (f, "\n");
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_resources_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_resources_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
BFD_ASSERT (len == 18);
memcpy (&entry->rte_res_type, buf, 4);
entry->rte_res_number = bfd_getb16 (buf + 4);
entry->rte_nte_index = bfd_getb32 (buf + 6);
entry->rte_mte_first = bfd_getb16 (buf + 10);
entry->rte_mte_last = bfd_getb16 (buf + 12);
entry->rte_res_size = bfd_getb32 (buf + 14);
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_modules_table_entry_v33 (unsigned char *buf,
size_t len,
bfd_sym_modules_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
BFD_ASSERT (len == 46);
entry->mte_rte_index = bfd_getb16 (buf);
entry->mte_res_offset = bfd_getb32 (buf + 2);
entry->mte_size = bfd_getb32 (buf + 6);
entry->mte_kind = buf[10];
entry->mte_scope = buf[11];
entry->mte_parent = bfd_getb16 (buf + 12);
bfd_sym_parse_file_reference_v32 (buf + 14, 6, &entry->mte_imp_fref);
entry->mte_imp_end = bfd_getb32 (buf + 20);
entry->mte_nte_index = bfd_getb32 (buf + 24);
entry->mte_cmte_index = bfd_getb16 (buf + 28);
entry->mte_cvte_index = bfd_getb32 (buf + 30);
entry->mte_clte_index = bfd_getb16 (buf + 34);
entry->mte_ctte_index = bfd_getb16 (buf + 36);
entry->mte_csnte_idx_1 = bfd_getb32 (buf + 38);
entry->mte_csnte_idx_2 = bfd_getb32 (buf + 42);
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_file_references_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_file_references_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
unsigned int type;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (len == 10);
memset (entry, 0, sizeof (bfd_sym_file_references_table_entry));
type = bfd_getb16 (buf);
switch (type)
{
case BFD_SYM_END_OF_LIST_3_2:
entry->generic.type = BFD_SYM_END_OF_LIST;
break;
case BFD_SYM_FILE_NAME_INDEX_3_2:
entry->filename.type = BFD_SYM_FILE_NAME_INDEX;
entry->filename.nte_index = bfd_getb32 (buf + 2);
entry->filename.mod_date = bfd_getb32 (buf + 6);
break;
default:
entry->entry.mte_index = type;
entry->entry.file_offset = bfd_getb32 (buf + 2);
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_contained_modules_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_contained_modules_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
unsigned int type;
BFD_ASSERT (len == 6);
memset (entry, 0, sizeof (bfd_sym_contained_modules_table_entry));
type = bfd_getb16 (buf);
2002-11-06 21:26:29 +08:00
switch (type)
{
case BFD_SYM_END_OF_LIST_3_2:
entry->generic.type = BFD_SYM_END_OF_LIST;
break;
default:
entry->entry.mte_index = type;
entry->entry.nte_index = bfd_getb32 (buf + 2);
break;
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_contained_variables_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_contained_variables_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
unsigned int type;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (len == 26);
memset (entry, 0, sizeof (bfd_sym_contained_variables_table_entry));
type = bfd_getb16 (buf);
switch (type)
{
case BFD_SYM_END_OF_LIST_3_2:
entry->generic.type = BFD_SYM_END_OF_LIST;
break;
case BFD_SYM_SOURCE_FILE_CHANGE_3_2:
entry->file.type = BFD_SYM_SOURCE_FILE_CHANGE;
bfd_sym_parse_file_reference_v32 (buf + 2, 6, &entry->file.fref);
break;
default:
entry->entry.tte_index = type;
entry->entry.nte_index = bfd_getb32 (buf + 2);
entry->entry.file_delta = bfd_getb16 (buf + 6);
entry->entry.scope = buf[8];
entry->entry.la_size = buf[9];
if (entry->entry.la_size == BFD_SYM_CVTE_SCA)
{
entry->entry.address.scstruct.sca_kind = buf[10];
entry->entry.address.scstruct.sca_class = buf[11];
entry->entry.address.scstruct.sca_offset = bfd_getb32 (buf + 12);
}
else if (entry->entry.la_size <= BFD_SYM_CVTE_SCA)
{
#if BFD_SYM_CVTE_SCA > 0
2005-04-11 16:23:05 +08:00
memcpy (&entry->entry.address.lastruct.la, buf + 10,
BFD_SYM_CVTE_SCA);
#endif
2002-11-06 21:26:29 +08:00
entry->entry.address.lastruct.la_kind = buf[23];
}
else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA)
{
entry->entry.address.biglastruct.big_la = bfd_getb32 (buf + 10);
entry->entry.address.biglastruct.big_la_kind = buf[12];
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_contained_statements_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_contained_statements_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
unsigned int type;
BFD_ASSERT (len == 8);
memset (entry, 0, sizeof (bfd_sym_contained_statements_table_entry));
type = bfd_getb16 (buf);
2002-11-06 21:26:29 +08:00
switch (type)
{
case BFD_SYM_END_OF_LIST_3_2:
entry->generic.type = BFD_SYM_END_OF_LIST;
break;
case BFD_SYM_SOURCE_FILE_CHANGE_3_2:
entry->file.type = BFD_SYM_SOURCE_FILE_CHANGE;
bfd_sym_parse_file_reference_v32 (buf + 2, 6, &entry->file.fref);
break;
default:
entry->entry.mte_index = type;
entry->entry.mte_offset = bfd_getb16 (buf + 2);
entry->entry.file_delta = bfd_getb32 (buf + 4);
break;
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_contained_labels_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_contained_labels_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
unsigned int type;
BFD_ASSERT (len == 12);
memset (entry, 0, sizeof (bfd_sym_contained_labels_table_entry));
type = bfd_getb16 (buf);
2002-11-06 21:26:29 +08:00
switch (type)
{
case BFD_SYM_END_OF_LIST_3_2:
entry->generic.type = BFD_SYM_END_OF_LIST;
break;
case BFD_SYM_SOURCE_FILE_CHANGE_3_2:
entry->file.type = BFD_SYM_SOURCE_FILE_CHANGE;
bfd_sym_parse_file_reference_v32 (buf + 2, 6, &entry->file.fref);
break;
default:
entry->entry.mte_index = type;
entry->entry.mte_offset = bfd_getb16 (buf + 2);
entry->entry.nte_index = bfd_getb32 (buf + 4);
entry->entry.file_delta = bfd_getb16 (buf + 8);
entry->entry.scope = bfd_getb16 (buf + 10);
break;
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_parse_type_table_entry_v32 (unsigned char *buf,
size_t len,
bfd_sym_type_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
BFD_ASSERT (len == 4);
2002-11-06 21:26:29 +08:00
*entry = bfd_getb32 (buf);
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_resources_table_entry (bfd *abfd,
bfd_sym_resources_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_resources_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size;
unsigned char buf[18];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
return -1;
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 18;
parser = bfd_sym_parse_resources_table_entry_v32;
break;
case BFD_SYM_VERSION_3_1:
default:
return -1;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_rte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_modules_table_entry (bfd *abfd,
bfd_sym_modules_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_modules_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size;
unsigned char buf[46];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
return -1;
case BFD_SYM_VERSION_3_3:
entry_size = 46;
parser = bfd_sym_parse_modules_table_entry_v33;
break;
case BFD_SYM_VERSION_3_2:
case BFD_SYM_VERSION_3_1:
default:
return -1;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_mte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_file_references_table_entry (bfd *abfd,
bfd_sym_file_references_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_file_references_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[8];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 10;
parser = bfd_sym_parse_file_references_table_entry_v32;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_frte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_contained_modules_table_entry (bfd *abfd,
bfd_sym_contained_modules_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_contained_modules_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[6];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 6;
parser = bfd_sym_parse_contained_modules_table_entry_v32;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_cmte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_contained_variables_table_entry (bfd *abfd,
bfd_sym_contained_variables_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_contained_variables_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[26];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 26;
parser = bfd_sym_parse_contained_variables_table_entry_v32;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_cvte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_contained_statements_table_entry (bfd *abfd,
bfd_sym_contained_statements_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_contained_statements_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[8];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 8;
parser = bfd_sym_parse_contained_statements_table_entry_v32;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_csnte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_contained_labels_table_entry (bfd *abfd,
bfd_sym_contained_labels_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_contained_labels_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[12];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 12;
parser = bfd_sym_parse_contained_labels_table_entry_v32;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_clte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_contained_types_table_entry (bfd *abfd,
bfd_sym_contained_types_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_contained_types_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[0];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 0;
parser = NULL;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_ctte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_file_references_index_table_entry (bfd *abfd,
bfd_sym_file_references_index_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_file_references_index_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[0];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 0;
parser = NULL;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_constant_pool_entry (bfd *abfd,
bfd_sym_constant_pool_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_constant_pool_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[0];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
2002-11-06 21:26:29 +08:00
return -1;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 0;
parser = NULL;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_fite.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_type_table_entry (bfd *abfd,
bfd_sym_type_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
2005-04-11 16:23:05 +08:00
void (*parser) (unsigned char *, size_t, bfd_sym_type_table_entry *);
2002-11-06 21:26:29 +08:00
unsigned long offset;
unsigned long entry_size = 0;
unsigned char buf[4];
bfd_sym_data_struct *sdata = NULL;
parser = NULL;
2002-11-06 21:26:29 +08:00
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
switch (sdata->version)
{
case BFD_SYM_VERSION_3_3:
case BFD_SYM_VERSION_3_2:
entry_size = 4;
parser = bfd_sym_parse_type_table_entry_v32;
break;
case BFD_SYM_VERSION_3_5:
case BFD_SYM_VERSION_3_4:
case BFD_SYM_VERSION_3_1:
default:
break;
}
if (parser == NULL)
return -1;
offset = compute_offset (sdata->header.dshb_tte.dti_first_page,
sdata->header.dshb_page_size,
entry_size, sym_index);
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_type_information_table_entry (bfd *abfd,
bfd_sym_type_information_table_entry *entry,
unsigned long offset)
2002-11-06 21:26:29 +08:00
{
unsigned char buf[4];
BFD_ASSERT (bfd_sym_valid (abfd));
2003-03-12 17:59:52 +08:00
if (offset == 0)
2002-11-06 21:26:29 +08:00
return -1;
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
if (bfd_bread (buf, 4, abfd) != 4)
return -1;
entry->nte_index = bfd_getb32 (buf);
2002-11-06 21:26:29 +08:00
if (bfd_bread (buf, 2, abfd) != 2)
return -1;
entry->physical_size = bfd_getb16 (buf);
2002-11-06 21:26:29 +08:00
if (entry->physical_size & 0x8000)
{
if (bfd_bread (buf, 4, abfd) != 4)
return -1;
entry->physical_size &= 0x7fff;
entry->logical_size = bfd_getb32 (buf);
entry->offset = offset + 10;
}
else
{
if (bfd_bread (buf, 2, abfd) != 2)
return -1;
entry->physical_size &= 0x7fff;
entry->logical_size = bfd_getb16 (buf);
entry->offset = offset + 8;
}
return 0;
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_type_table_information (bfd *abfd,
bfd_sym_type_information_table_entry *entry,
unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
bfd_sym_type_table_entry tindex;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sdata->header.dshb_tte.dti_object_count <= 99)
return -1;
if (sym_index < 100)
2002-11-06 21:26:29 +08:00
return -1;
if (bfd_sym_fetch_type_table_entry (abfd, &tindex, sym_index - 100) < 0)
2002-11-06 21:26:29 +08:00
return -1;
if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0)
return -1;
return 0;
}
const unsigned char *
bfd_sym_symbol_name (bfd *abfd, unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sym_index == 0)
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
return (const unsigned char *) "";
sym_index *= 2;
if ((sym_index / sdata->header.dshb_page_size)
> sdata->header.dshb_nte.dti_page_count)
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
return (const unsigned char *) "\09[INVALID]";
return (const unsigned char *) sdata->name_table + sym_index;
2002-11-06 21:26:29 +08:00
}
const unsigned char *
bfd_sym_module_name (bfd *abfd, unsigned long sym_index)
2002-11-06 21:26:29 +08:00
{
bfd_sym_modules_table_entry entry;
if (bfd_sym_fetch_modules_table_entry (abfd, &entry, sym_index) < 0)
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
return (const unsigned char *) "\09[INVALID]";
2002-11-06 21:26:29 +08:00
return bfd_sym_symbol_name (abfd, entry.mte_nte_index);
}
const char *
2005-04-11 16:23:05 +08:00
bfd_sym_unparse_storage_kind (enum bfd_sym_storage_kind kind)
2002-11-06 21:26:29 +08:00
{
switch (kind)
{
case BFD_SYM_STORAGE_KIND_LOCAL: return "LOCAL";
case BFD_SYM_STORAGE_KIND_VALUE: return "VALUE";
case BFD_SYM_STORAGE_KIND_REFERENCE: return "REFERENCE";
case BFD_SYM_STORAGE_KIND_WITH: return "WITH";
default: return "[UNKNOWN]";
}
}
const char *
2005-04-11 16:23:05 +08:00
bfd_sym_unparse_storage_class (enum bfd_sym_storage_class kind)
2002-11-06 21:26:29 +08:00
{
switch (kind)
{
case BFD_SYM_STORAGE_CLASS_REGISTER: return "REGISTER";
case BFD_SYM_STORAGE_CLASS_GLOBAL: return "GLOBAL";
case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE: return "FRAME_RELATIVE";
case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE: return "STACK_RELATIVE";
case BFD_SYM_STORAGE_CLASS_ABSOLUTE: return "ABSOLUTE";
case BFD_SYM_STORAGE_CLASS_CONSTANT: return "CONSTANT";
case BFD_SYM_STORAGE_CLASS_RESOURCE: return "RESOURCE";
case BFD_SYM_STORAGE_CLASS_BIGCONSTANT: return "BIGCONSTANT";
default: return "[UNKNOWN]";
}
}
const char *
2005-04-11 16:23:05 +08:00
bfd_sym_unparse_module_kind (enum bfd_sym_module_kind kind)
2002-11-06 21:26:29 +08:00
{
switch (kind)
{
case BFD_SYM_MODULE_KIND_NONE: return "NONE";
case BFD_SYM_MODULE_KIND_PROGRAM: return "PROGRAM";
case BFD_SYM_MODULE_KIND_UNIT: return "UNIT";
case BFD_SYM_MODULE_KIND_PROCEDURE: return "PROCEDURE";
case BFD_SYM_MODULE_KIND_FUNCTION: return "FUNCTION";
case BFD_SYM_MODULE_KIND_DATA: return "DATA";
case BFD_SYM_MODULE_KIND_BLOCK: return "BLOCK";
default: return "[UNKNOWN]";
}
}
const char *
2005-04-11 16:23:05 +08:00
bfd_sym_unparse_symbol_scope (enum bfd_sym_symbol_scope scope)
2002-11-06 21:26:29 +08:00
{
switch (scope)
{
case BFD_SYM_SYMBOL_SCOPE_LOCAL: return "LOCAL";
case BFD_SYM_SYMBOL_SCOPE_GLOBAL: return "GLOBAL";
default:
return "[UNKNOWN]";
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_file_reference (bfd *abfd,
FILE *f,
bfd_sym_file_reference *entry)
2002-11-06 21:26:29 +08:00
{
bfd_sym_file_references_table_entry frtentry;
int ret;
ret = bfd_sym_fetch_file_references_table_entry (abfd, &frtentry,
entry->fref_frte_index);
2002-11-06 21:26:29 +08:00
fprintf (f, "FILE ");
if ((ret < 0) || (frtentry.generic.type != BFD_SYM_FILE_NAME_INDEX))
fprintf (f, "[INVALID]");
else
fprintf (f, "\"%.*s\"",
bfd_sym_symbol_name (abfd, frtentry.filename.nte_index)[0],
&bfd_sym_symbol_name (abfd, frtentry.filename.nte_index)[1]);
fprintf (f, " (FRTE %lu)", entry->fref_frte_index);
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_resources_table_entry (bfd *abfd,
FILE *f,
bfd_sym_resources_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
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);
}
2002-11-06 21:26:29 +08:00
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_modules_table_entry (bfd *abfd,
FILE *f,
bfd_sym_modules_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
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 ");
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
fprintf (f, "\n ");
2002-11-06 21:26:29 +08:00
fprintf (f, "kind %s", bfd_sym_unparse_module_kind (entry->mte_kind));
fprintf (f, ", scope %s", bfd_sym_unparse_symbol_scope (entry->mte_scope));
2002-11-06 21:26:29 +08:00
fprintf (f, ", RTE %lu, offset %lu, size %lu",
entry->mte_rte_index, entry->mte_res_offset, entry->mte_size);
fprintf (f, "\n ");
2002-11-06 21:26:29 +08:00
fprintf (f, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu",
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
if (entry->mte_parent != 0)
fprintf (f, ", parent %lu", entry->mte_parent);
else
fprintf (f, ", no parent");
if (entry->mte_cmte_index != 0)
fprintf (f, ", child %lu", entry->mte_cmte_index);
else
fprintf (f, ", no child");
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_file_references_table_entry (bfd *abfd,
FILE *f,
bfd_sym_file_references_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
switch (entry->generic.type)
{
case BFD_SYM_FILE_NAME_INDEX:
fprintf (f, "FILE \"%.*s\" (NTE %lu), modtime ",
2002-11-06 21:26:29 +08:00
bfd_sym_symbol_name (abfd, entry->filename.nte_index)[0],
&bfd_sym_symbol_name (abfd, entry->filename.nte_index)[1],
entry->filename.nte_index);
fprintf (f, "[UNIMPLEMENTED]");
/* printModDate (entry->filename.mod_date); */
fprintf (f, " (0x%lx)", entry->filename.mod_date);
break;
case BFD_SYM_END_OF_LIST:
fprintf (f, "END");
break;
default:
fprintf (f, "\"%.*s\" (MTE %lu), offset %lu",
bfd_sym_module_name (abfd, entry->entry.mte_index)[0],
&bfd_sym_module_name (abfd, entry->entry.mte_index)[1],
entry->entry.mte_index,
entry->entry.file_offset);
break;
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_contained_modules_table_entry (bfd *abfd,
FILE *f,
bfd_sym_contained_modules_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
switch (entry->generic.type)
{
case BFD_SYM_END_OF_LIST:
fprintf (f, "END");
break;
default:
fprintf (f, "\"%.*s\" (MTE %lu, NTE %lu)",
bfd_sym_module_name (abfd, entry->entry.mte_index)[0],
&bfd_sym_module_name (abfd, entry->entry.mte_index)[1],
entry->entry.mte_index,
entry->entry.nte_index);
break;
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_contained_variables_table_entry (bfd *abfd,
FILE *f,
bfd_sym_contained_variables_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
if (entry->generic.type == BFD_SYM_END_OF_LIST)
{
fprintf (f, "END");
return;
}
2002-11-06 21:26:29 +08:00
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;
}
2002-11-06 21:26:29 +08:00
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);
2002-11-06 21:26:29 +08:00
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));
if (entry->entry.la_size == BFD_SYM_CVTE_SCA)
fprintf (f, ", latype %s, laclass %s, laoffset %lu",
bfd_sym_unparse_storage_kind (entry->entry.address.scstruct.sca_kind),
bfd_sym_unparse_storage_class (entry->entry.address.scstruct.sca_class),
entry->entry.address.scstruct.sca_offset);
else if (entry->entry.la_size <= BFD_SYM_CVTE_LA_MAX_SIZE)
{
unsigned long i;
fprintf (f, ", la [");
for (i = 0; i < entry->entry.la_size; i++)
fprintf (f, "0x%02x ", entry->entry.address.lastruct.la[i]);
fprintf (f, "]");
}
else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA)
fprintf (f, ", bigla %lu, biglakind %u",
entry->entry.address.biglastruct.big_la,
2002-11-06 21:26:29 +08:00
entry->entry.address.biglastruct.big_la_kind);
else
fprintf (f, ", la [INVALID]");
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_contained_statements_table_entry (bfd *abfd,
FILE *f,
bfd_sym_contained_statements_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
if (entry->generic.type == BFD_SYM_END_OF_LIST)
{
fprintf (f, "END");
return;
}
2002-11-06 21:26:29 +08:00
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\" (MTE %lu), offset %lu, delta %lu",
bfd_sym_module_name (abfd, entry->entry.mte_index)[0],
&bfd_sym_module_name (abfd, entry->entry.mte_index)[1],
entry->entry.mte_index,
entry->entry.mte_offset,
entry->entry.file_delta);
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_contained_labels_table_entry (bfd *abfd,
FILE *f,
bfd_sym_contained_labels_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
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\" (MTE %lu), offset %lu, delta %lu, scope %s",
bfd_sym_module_name (abfd, entry->entry.mte_index)[0],
&bfd_sym_module_name (abfd, entry->entry.mte_index)[1],
entry->entry.mte_index,
entry->entry.mte_offset,
entry->entry.file_delta,
bfd_sym_unparse_symbol_scope (entry->entry.scope));
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_contained_types_table_entry (bfd *abfd ATTRIBUTE_UNUSED,
FILE *f,
bfd_sym_contained_types_table_entry *entry ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
fprintf (f, "[UNIMPLEMENTED]");
}
const char *
2005-04-11 16:23:05 +08:00
bfd_sym_type_operator_name (unsigned char num)
2002-11-06 21:26:29 +08:00
{
switch (num)
{
case 1: return "TTE";
case 2: return "PointerTo";
case 3: return "ScalarOf";
case 4: return "ConstantOf";
case 5: return "EnumerationOf";
case 6: return "VectorOf";
case 7: return "RecordOf";
case 8: return "UnionOf";
case 9: return "SubRangeOf";
case 10: return "SetOf";
case 11: return "NamedTypeOf";
case 12: return "ProcOf";
case 13: return "ValueOf";
case 14: return "ArrayOf";
default: return "[UNKNOWN OPERATOR]";
}
}
const char *
2005-04-11 16:23:05 +08:00
bfd_sym_type_basic_name (unsigned char num)
2002-11-06 21:26:29 +08:00
{
switch (num)
{
case 0: return "void";
case 1: return "pascal string";
case 2: return "unsigned long";
case 3: return "signed long";
case 4: return "extended (10 bytes)";
case 5: return "pascal boolean (1 byte)";
case 6: return "unsigned byte";
case 7: return "signed byte";
case 8: return "character (1 byte)";
case 9: return "wide character (2 bytes)";
case 10: return "unsigned short";
case 11: return "signed short";
case 12: return "singled";
case 13: return "double";
case 14: return "extended (12 bytes)";
case 15: return "computational (8 bytes)";
case 16: return "c string";
case 17: return "as-is string";
default: return "[UNKNOWN BASIC TYPE]";
}
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_fetch_long (unsigned char *buf,
unsigned long len,
unsigned long offset,
unsigned long *offsetptr,
long *value)
2002-11-06 21:26:29 +08:00
{
int ret;
if (offset >= len)
{
*value = 0;
offset += 0;
ret = -1;
}
else if (! (buf[offset] & 0x80))
{
*value = buf[offset];
offset += 1;
ret = 0;
}
else if (buf[offset] == 0xc0)
{
if ((offset + 5) > len)
{
*value = 0;
offset = len;
ret = -1;
}
else
{
*value = bfd_getb32 (buf + offset + 1);
offset += 5;
ret = 0;
}
}
else if ((buf[offset] & 0xc0) == 0xc0)
{
*value = -(buf[offset] & 0x3f);
offset += 1;
ret = 0;
}
else if ((buf[offset] & 0xc0) == 0x80)
{
if ((offset + 2) > len)
{
*value = 0;
offset = len;
ret = -1;
}
else
{
*value = bfd_getb16 (buf + offset) & 0x3fff;
offset += 2;
ret = 0;
}
}
else
abort ();
if (offsetptr != NULL)
*offsetptr = offset;
return ret;
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_type_information (bfd *abfd,
FILE *f,
unsigned char *buf,
unsigned long len,
unsigned long offset,
unsigned long *offsetptr)
2002-11-06 21:26:29 +08:00
{
unsigned int type;
if (offset >= len)
{
fprintf (f, "[NULL]");
if (offsetptr != NULL)
*offsetptr = offset;
return;
2002-11-06 21:26:29 +08:00
}
2002-11-06 21:26:29 +08:00
type = buf[offset];
offset++;
if (! (type & 0x80))
{
fprintf (f, "[%s] (0x%x)", bfd_sym_type_basic_name (type & 0x7f), type);
if (offsetptr != NULL)
*offsetptr = offset;
return;
}
if (type & 0x40)
fprintf (f, "[packed ");
else
fprintf (f, "[");
switch (type & 0x3f)
{
case 1:
{
long value;
bfd_sym_type_information_table_entry tinfo;
bfd_sym_fetch_long (buf, len, offset, &offset, &value);
2002-11-06 21:26:29 +08:00
if (value <= 0)
fprintf (f, "[INVALID]");
else
{
if (bfd_sym_fetch_type_table_information (abfd, &tinfo, value) < 0)
fprintf (f, "[INVALID]");
else
fprintf (f, "\"%.*s\"",
2002-11-06 21:26:29 +08:00
bfd_sym_symbol_name (abfd, tinfo.nte_index)[0],
&bfd_sym_symbol_name (abfd, tinfo.nte_index)[1]);
}
2008-07-30 12:34:58 +08:00
fprintf (f, " (TTE %lu)", (unsigned long) value);
2002-11-06 21:26:29 +08:00
break;
}
case 2:
fprintf (f, "pointer (0x%x) to ", type);
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
break;
case 3:
{
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
long value;
2002-11-06 21:26:29 +08:00
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);
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
fprintf (f, " (%lu)", (unsigned long) value);
2002-11-06 21:26:29 +08:00
break;
}
2002-11-06 21:26:29 +08:00
case 5:
{
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
long lower, upper, nelem;
int i;
2002-11-06 21:26:29 +08:00
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);
include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2005-02-20 22:59:07 +08:00
fprintf (f, " from %lu to %lu with %lu elements: ",
(unsigned long) lower, (unsigned long) upper,
(unsigned long) nelem);
2002-11-06 21:26:29 +08:00
for (i = 0; i < nelem; i++)
{
fprintf (f, "\n ");
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
}
break;
}
case 6:
fprintf (f, "vector (0x%x)", type);
fprintf (f, "\n index ");
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
fprintf (f, "\n target ");
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
break;
case 7:
case 8:
{
long nrec, eloff, i;
if ((type & 0x3f) == 7)
fprintf (f, "record (0x%x) of ", type);
else
fprintf (f, "union (0x%x) of ", type);
bfd_sym_fetch_long (buf, len, offset, &offset, &nrec);
2008-07-30 12:34:58 +08:00
fprintf (f, "%lu elements: ", (unsigned long) nrec);
2002-11-06 21:26:29 +08:00
for (i = 0; i < nrec; i++)
{
bfd_sym_fetch_long (buf, len, offset, &offset, &eloff);
2002-11-06 21:26:29 +08:00
fprintf (f, "\n ");
2008-07-30 12:34:58 +08:00
fprintf (f, "offset %lu: ", (unsigned long) eloff);
2002-11-06 21:26:29 +08:00
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
}
break;
}
case 9:
fprintf (f, "subrange (0x%x) of ", type);
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
fprintf (f, " lower ");
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
fprintf (f, " upper ");
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
break;
case 11:
{
long value;
fprintf (f, "named type (0x%x) ", type);
bfd_sym_fetch_long (buf, len, offset, &offset, &value);
2002-11-06 21:26:29 +08:00
if (value <= 0)
fprintf (f, "[INVALID]");
else
fprintf (f, "\"%.*s\"",
2002-11-06 21:26:29 +08:00
bfd_sym_symbol_name (abfd, value)[0],
&bfd_sym_symbol_name (abfd, value)[1]);
2008-07-30 12:34:58 +08:00
fprintf (f, " (NTE %lu) with type ", (unsigned long) value);
2002-11-06 21:26:29 +08:00
bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
break;
}
default:
fprintf (f, "%s (0x%x)", bfd_sym_type_operator_name (type), type);
break;
}
2002-11-06 21:26:29 +08:00
if (type == (0x40 | 0x6))
{
/* Vector. */
long n, width, m;
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);
2002-11-06 21:26:29 +08:00
/* 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);
2002-11-06 21:26:29 +08:00
if (i != 0)
fprintf (f, " ");
fprintf (f, "%ld", l);
}
}
else if (type & 0x40)
{
/* Other packed type. */
long msb, lsb;
bfd_sym_fetch_long (buf, len, offset, &offset, &msb);
bfd_sym_fetch_long (buf, len, offset, &offset, &lsb);
2002-11-06 21:26:29 +08:00
/* fprintf (f, "\n "); */
fprintf (f, " msb %ld, lsb %ld", msb, lsb);
}
fprintf (f, "]");
if (offsetptr != NULL)
*offsetptr = offset;
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_type_information_table_entry (bfd *abfd,
FILE *f,
bfd_sym_type_information_table_entry *entry)
2002-11-06 21:26:29 +08:00
{
unsigned char *buf;
unsigned long offset;
unsigned int i;
fprintf (f, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu",
bfd_sym_symbol_name (abfd, entry->nte_index)[0],
&bfd_sym_symbol_name (abfd, entry->nte_index)[1],
entry->nte_index,
entry->physical_size, entry->offset, entry->logical_size);
fprintf (f, "\n ");
2002-11-06 21:26:29 +08:00
buf = malloc (entry->physical_size);
2002-11-06 21:26:29 +08:00
if (buf == NULL)
{
fprintf (f, "[ERROR]\n");
return;
}
if (bfd_seek (abfd, entry->offset, SEEK_SET) < 0)
{
fprintf (f, "[ERROR]\n");
free (buf);
2002-11-06 21:26:29 +08:00
return;
}
if (bfd_bread (buf, entry->physical_size, abfd) != entry->physical_size)
{
fprintf (f, "[ERROR]\n");
free (buf);
2002-11-06 21:26:29 +08:00
return;
}
fprintf (f, "[");
for (i = 0; i < entry->physical_size; i++)
{
if (i == 0)
fprintf (f, "0x%02x", buf[i]);
else
fprintf (f, " 0x%02x", buf[i]);
}
fprintf (f, "]");
fprintf (f, "\n ");
2002-11-06 21:26:29 +08:00
bfd_sym_print_type_information (abfd, f, buf, entry->physical_size, 0, &offset);
if (offset != entry->physical_size)
2005-04-11 16:23:05 +08:00
fprintf (f, "\n [parser used %lu bytes instead of %lu]", offset, entry->physical_size);
free (buf);
2005-04-11 16:23:05 +08:00
}
2002-11-06 21:26:29 +08:00
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_file_references_index_table_entry (bfd *abfd ATTRIBUTE_UNUSED,
FILE *f,
bfd_sym_file_references_index_table_entry *entry ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
fprintf (f, "[UNIMPLEMENTED]");
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_print_constant_pool_entry (bfd *abfd ATTRIBUTE_UNUSED,
FILE *f,
bfd_sym_constant_pool_entry *entry ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
fprintf (f, "[UNIMPLEMENTED]");
}
unsigned char *
2005-04-11 16:23:05 +08:00
bfd_sym_display_name_table_entry (bfd *abfd,
FILE *f,
unsigned char *entry)
2002-11-06 21:26:29 +08:00
{
unsigned long sym_index;
2002-11-06 21:26:29 +08:00
unsigned long offset;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
sym_index = (entry - sdata->name_table) / 2;
if (sdata->version >= BFD_SYM_VERSION_3_4 && entry[0] == 255 && entry[1] == 0)
2002-11-06 21:26:29 +08:00
{
unsigned short length = bfd_getb16 (entry + 2);
fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, length, entry + 4);
2002-11-06 21:26:29 +08:00
offset = 2 + length + 1;
}
else
{
if (! (entry[0] == 0 || (entry[0] == 1 && entry[1] == '\0')))
fprintf (f, "[%8lu] \"%.*s\"\n", sym_index, entry[0], entry + 1);
2002-11-06 21:26:29 +08:00
if (sdata->version >= BFD_SYM_VERSION_3_4)
offset = entry[0] + 2;
else
offset = entry[0] + 1;
}
return (entry + offset + (offset % 2));
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_name_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long name_table_len;
unsigned char *name_table, *name_table_end, *cur;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
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;
2002-11-06 21:26:29 +08:00
fprintf (f, "name table (NTE) contains %lu bytes:\n\n", name_table_len);
2002-11-06 21:26:29 +08:00
cur = name_table;
for (;;)
{
cur = bfd_sym_display_name_table_entry (abfd, f, cur);
if (cur >= name_table_end)
break;
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_resources_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_resources_table_entry entry;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "resource table (RTE) contains %lu objects:\n\n",
sdata->header.dshb_rte.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_rte.dti_object_count; i++)
{
if (bfd_sym_fetch_resources_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_resources_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_modules_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_modules_table_entry entry;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "module table (MTE) contains %lu objects:\n\n",
sdata->header.dshb_mte.dti_object_count);
for (i = 1; i <= sdata->header.dshb_mte.dti_object_count; i++)
{
if (bfd_sym_fetch_modules_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_modules_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_file_references_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_file_references_table_entry entry;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "file reference table (FRTE) contains %lu objects:\n\n",
sdata->header.dshb_frte.dti_object_count);
for (i = 1; i <= sdata->header.dshb_frte.dti_object_count; i++)
{
if (bfd_sym_fetch_file_references_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_file_references_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_contained_modules_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_contained_modules_table_entry entry;
2002-11-06 21:26:29 +08:00
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "contained modules table (CMTE) contains %lu objects:\n\n",
sdata->header.dshb_cmte.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_cmte.dti_object_count; i++)
{
if (bfd_sym_fetch_contained_modules_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_contained_modules_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_contained_variables_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_contained_variables_table_entry entry;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "contained variables table (CVTE) contains %lu objects:\n\n",
sdata->header.dshb_cvte.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_cvte.dti_object_count; i++)
{
if (bfd_sym_fetch_contained_variables_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_contained_variables_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
fprintf (f, "\n");
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_contained_statements_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_contained_statements_table_entry entry;
2002-11-06 21:26:29 +08:00
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "contained statements table (CSNTE) contains %lu objects:\n\n",
sdata->header.dshb_csnte.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_csnte.dti_object_count; i++)
{
if (bfd_sym_fetch_contained_statements_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_contained_statements_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_contained_labels_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_contained_labels_table_entry entry;
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "contained labels table (CLTE) contains %lu objects:\n\n",
sdata->header.dshb_clte.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_clte.dti_object_count; i++)
{
if (bfd_sym_fetch_contained_labels_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_contained_labels_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_contained_types_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_contained_types_table_entry entry;
2002-11-06 21:26:29 +08:00
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "contained types table (CTTE) contains %lu objects:\n\n",
sdata->header.dshb_ctte.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_ctte.dti_object_count; i++)
{
if (bfd_sym_fetch_contained_types_table_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_contained_types_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_file_references_index_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_file_references_index_table_entry entry;
2002-11-06 21:26:29 +08:00
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "file references index table (FITE) contains %lu objects:\n\n",
sdata->header.dshb_fite.dti_object_count);
2002-11-06 21:26:29 +08:00
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)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_file_references_index_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_constant_pool (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_constant_pool_entry entry;
2002-11-06 21:26:29 +08:00
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
fprintf (f, "constant pool (CONST) contains %lu objects:\n\n",
sdata->header.dshb_const.dti_object_count);
2002-11-06 21:26:29 +08:00
for (i = 1; i <= sdata->header.dshb_const.dti_object_count; i++)
{
if (bfd_sym_fetch_constant_pool_entry (abfd, &entry, i) < 0)
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] ", i);
bfd_sym_print_constant_pool_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
void
2005-04-11 16:23:05 +08:00
bfd_sym_display_type_information_table (bfd *abfd, FILE *f)
2002-11-06 21:26:29 +08:00
{
unsigned long i;
bfd_sym_type_table_entry sym_index;
bfd_sym_type_information_table_entry entry;
2002-11-06 21:26:29 +08:00
bfd_sym_data_struct *sdata = NULL;
BFD_ASSERT (bfd_sym_valid (abfd));
sdata = abfd->tdata.sym_data;
if (sdata->header.dshb_tte.dti_object_count > 99)
fprintf (f, "type table (TINFO) contains %lu objects:\n\n",
sdata->header.dshb_tte.dti_object_count - 99);
else
{
fprintf (f, "type table (TINFO) contains [INVALID] objects:\n\n");
return;
}
2002-11-06 21:26:29 +08:00
for (i = 100; i <= sdata->header.dshb_tte.dti_object_count; i++)
{
if (bfd_sym_fetch_type_table_entry (abfd, &sym_index, i - 100) < 0)
2002-11-06 21:26:29 +08:00
fprintf (f, " [%8lu] [INVALID]\n", i);
else
{
fprintf (f, " [%8lu] (TINFO %lu) ", i, sym_index);
2002-11-06 21:26:29 +08:00
if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, sym_index) < 0)
2002-11-06 21:26:29 +08:00
fprintf (f, "[INVALID]");
else
bfd_sym_print_type_information_table_entry (abfd, f, &entry);
fprintf (f, "\n");
}
}
}
int
2005-04-11 16:23:05 +08:00
bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
2002-11-06 21:26:29 +08:00
{
asection *bfdsec;
const char *name = "symbols";
mdata->name_table = 0;
mdata->sbfd = abfd;
mdata->version = version;
2002-11-06 21:26:29 +08:00
bfd_seek (abfd, 0, SEEK_SET);
if (bfd_sym_read_header (abfd, &mdata->header, mdata->version) != 0)
return -1;
2002-11-06 21:26:29 +08:00
mdata->name_table = bfd_sym_read_name_table (abfd, &mdata->header);
if (mdata->name_table == NULL)
return -1;
2002-11-06 21:26:29 +08:00
bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
2002-11-06 21:26:29 +08:00
if (bfdsec == NULL)
return -1;
2002-11-06 21:26:29 +08:00
bfdsec->vma = 0;
bfdsec->lma = 0;
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 12:46:28 +08:00
bfdsec->size = 0;
2002-11-06 21:26:29 +08:00
bfdsec->filepos = 0;
bfdsec->alignment_power = 0;
abfd->tdata.sym_data = mdata;
return 0;
}
const bfd_target *
2005-04-11 16:23:05 +08:00
bfd_sym_object_p (bfd *abfd)
{
bfd_sym_version version = -1;
bfd_sym_data_struct *mdata;
bfd_seek (abfd, 0, SEEK_SET);
if (bfd_sym_read_version (abfd, &version) != 0)
goto wrong;
mdata = (bfd_sym_data_struct *) bfd_alloc (abfd, sizeof (*mdata));
if (mdata == NULL)
goto fail;
if (bfd_sym_scan (abfd, version, mdata) != 0)
goto wrong;
2002-11-06 21:26:29 +08:00
return abfd->xvec;
wrong:
bfd_set_error (bfd_error_wrong_format);
fail:
return NULL;
2002-11-06 21:26:29 +08:00
}
#define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
2002-11-06 21:26:29 +08:00
void
2005-04-11 16:23:05 +08:00
bfd_sym_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, asymbol *symbol, symbol_info *ret)
2002-11-06 21:26:29 +08:00
{
bfd_symbol_info (symbol, ret);
}
long
2005-04-11 16:23:05 +08:00
bfd_sym_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
return 0;
}
long
2005-04-11 16:23:05 +08:00
bfd_sym_canonicalize_symtab (bfd *abfd ATTRIBUTE_UNUSED, asymbol **sym ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
return 0;
}
int
bfd/ * elf-bfd.h (struct elf_backend_data): Add bfd_link_info pointer parameter. (_bfd_elf_sizeof_headers): Replace bfd_boolean param with bfd_link_info pointer. * targets.c (struct bfd_target <_bfd_sizeof_headers>): Likewise. * bfd.c (bfd_sizeof_headers): Tweak param name. * aout-adobe.c (aout_adobe_sizeof_headers): Adjust. * aoutx.h (NAME (aout, sizeof_headers)): Adjust. * binary.c (binary_sizeof_headers): Adjust. * bout.c (b_out_sizeof_headers): Adjust. * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust. * coff64-rs6000.c (xcoff64_sizeof_headers): Adjust. * coffgen.c (coff_sizeof_headers): Adjust. * ecoff.c (_bfd_ecoff_sizeof_headers): Adjust. (ecoff_compute_section_file_positions): Adjust. (_bfd_ecoff_write_object_contents): Adjust. * elf.c (get_program_header_size, _bfd_elf_sizeof_headers): Adjust. * elf32-arm.c (elf32_arm_additional_program_headers): Adjust. * elf32-i370.c (elf_backend_additional_program_headers): Adjust. * elf32-ppc.c (ppc_elf_additional_program_headers): Adjust. * elf64-hppa.c (elf64_hppa_additional_program_headers): Adjust. * elf64-x86-64.c (elf64_x86_64_additional_program_headers): Adjust. * elfxx-ia64.c (elfNN_ia64_additional_program_headers): Adjust. * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Adjust. * elfxx-mips.h (_bfd_mips_elf_additional_program_headers): Adjust. * i386msdos.c: Convert to ISO C. (msdos_sizeof_headers): Adjust. * i386os9k.c: Convert to ISO C. (os9k_sizeof_headers): Adjust. * ieee.c (ieee_sizeof_headers): Adjust. * ihex.c (ihex_sizeof_headers): Adjust. * libaout.h (NAME (aout, sizeof_headers)): Adjust. * libbfd-in.h (_bfd_nolink_sizeof_headers): Adjust. * libcoff-in.h (coff_sizeof_headers): Adjust. * libecoff.h (_bfd_ecoff_sizeof_headers): Adjust. * mach-o.c (bfd_mach_o_sizeof_headers): Adjust. * mmo.c (mmo_sizeof_headers): Adjust. * oasys.c (oasys_sizeof_headers): Adjust. * pdp11.c (NAME (aout, sizeof_headers)): Adjust. * pef.c (bfd_pef_sizeof_headers): Adjust. * ppcboot.c (ppcboot_sizeof_headers): Adjust. * som.c (som_sizeof_headers): Adjust. * srec.c (srec_sizeof_headers): Adjust. * tekhex.c (tekhex_sizeof_headers): Adjust. * versados.c (versados_sizeof_headers): Adjust. * vms.c (vms_sizeof_headers): Adjust. * xcoff-target.h (_bfd_xcoff_sizeof_headers): Adjust. * xsym.c (bfd_sym_sizeof_headers): Adjust. * xsym.h (bfd_sym_sizeof_headers): Adjust. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * ldexp.c (fold_name): Adjust bfd_sizeof_headers call.
2006-06-19 21:17:44 +08:00
bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info ATTRIBUTE_UNUSED)
2002-11-06 21:26:29 +08:00
{
return 0;
}
const bfd_target sym_vec =
{
2005-04-11 16:23:05 +08:00
"sym", /* Name. */
bfd_target_sym_flavour, /* Flavour. */
BFD_ENDIAN_BIG, /* Byteorder. */
BFD_ENDIAN_BIG, /* Header byteorder. */
(HAS_RELOC | EXEC_P | /* Object flags. */
2002-11-06 21:26:29 +08:00
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
2005-04-11 16:23:05 +08:00
| SEC_ROM | SEC_HAS_CONTENTS), /* Section_flags. */
0, /* Symbol_leading_char. */
' ', /* AR_pad_char. */
16, /* AR_max_namelen. */
0, /* match priority. */
2002-11-06 21:26:29 +08:00
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
2005-04-11 16:23:05 +08:00
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
2002-11-06 21:26:29 +08:00
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
2005-04-11 16:23:05 +08:00
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */
{ /* bfd_check_format. */
2002-11-06 21:26:29 +08:00
_bfd_dummy_target,
2005-04-11 16:23:05 +08:00
bfd_sym_object_p, /* bfd_check_format. */
2002-11-06 21:26:29 +08:00
_bfd_dummy_target,
_bfd_dummy_target,
},
2005-04-11 16:23:05 +08:00
{ /* bfd_set_format. */
2002-11-06 21:26:29 +08:00
bfd_false,
bfd_sym_mkobject,
bfd_false,
bfd_false,
},
2005-04-11 16:23:05 +08:00
{ /* bfd_write_contents. */
2002-11-06 21:26:29 +08:00
bfd_false,
bfd_true,
bfd_false,
bfd_false,
},
BFD_JUMP_TABLE_GENERIC (bfd_sym),
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
BFD_JUMP_TABLE_SYMBOLS (bfd_sym),
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
2002-11-06 21:26:29 +08:00
BFD_JUMP_TABLE_WRITE (bfd_sym),
BFD_JUMP_TABLE_LINK (bfd_sym),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
2002-11-06 21:26:29 +08:00
NULL
};