* bfd/archive.c (_bfd_find_nested_archive): New function.
(get_extended_arelt_filename): Add origin parameter.
(_bfd_generic_read_ar_hdr_mag): Deal with extended name
combined with a file offset.
(append_relative_path): New function.
(_bfd_get_elt_at_filepos): Deal with external members and
nested archives.
(bfd_generic_openr_next_archived_file): Thin archives.
(bfd_generic_archive_p): Recognize new magic string.
(adjust_relative_path): New function.
(_bfd_construct_extended_name_table): Construct extended
names for thin archive members.
(_bfd_write_archive_contents): Emit new magic string, skip
copying files for thin archives.
* bfd/bfd-in.h (bfd_is_thin_archive): New macro.
* bfd/bfd.c (struct bfd): New fields for thin archives.
* bfd/libbfd-in.h (struct areltdata): New field for thin archives.
* bfd/opncls.c (bfd_close): Delete BFDs for nested archives.
* binutils/ar.c (make_thin_archive): New global flag.
(map_over_members): Deal with full pathnames in thin archives.
(usage, main): Add 'T' option for building thin archives.
(replace_members): Pass thin archive flag to ar_emul_append.
* binutils/arsup.c (ar_open): Initialize new flag.
* binutils/binemul.c (ar_emul_append): Add new parameter for
flattening nested archives.
(do_ar_emul_default_append): New function.
(ar_emul_default_append): Factored out recursive code.
* binutils/binemul.h (ar_emul_default_append): Add new parameter.
(struct bin_emulation_xfer_struct): New parameter for ar_append.
* binutils/dlltool.c (gen_lib_file): Initialize thin archive flag.
* binutils/emul_aix.c (ar_emul_aix_internal): Add new flatten
parameter, currently unimplemented.
All callers changed.
* binutils/objcopy.c (copy_archive): Preserve thin archive flag.
* binutils/doc/binutils.texi: Update ar documentation.
* binutils/testsuite/binutils-all/ar.exp: Add thin archive tests.
* include/aout/ar.h (ARMAGT): New magic string for thin archives.
* libbfd.c (bfd_realloc_or_free): New function. Performs like
bfd_realloc, but if the (re)allocation fails, the pointer is
freed.
* libbfd-in.h: Prototype.
* libbfd.h: Regenerate.
* bfdio.c (bfd_bwrite): Use the new function.
(bfd_seek): Likewise.
* bfdwin.c:(bfd_get_file_window): Likewise.
* elf-strtab.c (_bfd_elf_strtab_add): Likewise.
* elf32-ppc.c (ppc_elf_relax_section): Likewise.
* elf32-xtensa.c (vsprintf_msg): Likewise.
* mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
* stabs.c (_bfd_link_seciton_stabs): Likewise.
* vms-misc.c (_bfd_vms_get_record): Likewise.
* vms-tir.c (check_section): Likewise.
* vms.c (vms_new_section_hook): Likewise.
* elf32-arm.c (elf32_arm_section_map_add): Check that the
allocation of sec_data->map succeeded before using it.
* elflink.c (elf_link_output_sym): Do not overwrite finfo->
symshndxbuf until it is known that the reallocation succeeded.
* linker.c (bfd_section_already_linked_table_insert): Change
return type from void to boolean. Return FALSE on failure.
(_bfd_generic_section_already_linked): Test return value of
bfd_section_already_linked_table_insert, call fatal on error.
* elflink.c (_bfd_elf_section_already_linked): Test return value
of bfd_section_already_linked_table_insert, call fatal on error.
* libbfd-in.h (bfd_section_already_linked_table_insert): Update
return type to bfd_boolean.
* libbfd.h: Regenerate.
* libbfd.h: Rebuilt.
* coff-rs600.c (_bfd_xcoff_archive_p): Don't clear fields in freshly
allocated object by bfd_zalloc.
* coff64-rs6000.c (xcoff64_archive_p): Likewise.
* ecoff.c (_bfd_ecoff_archive_p): Likewise.
* archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p): Likewise.
(get_extended_arelt_filename): Fail if index is bigger or equal to
extended_names_size.
(_bfd_generic_read_ar_hdr_mag): Don't set bfd_error_malformed_archive,
get_extended_arelt_filename already did that.
(_bfd_slurp_extended_name_table): Initialize extended_names_size field.
Allocate one extra byte and clear it, in case extended names table
is not terminated.
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.
(struct ar_cache): Rename `arelt' to `arbfd' and remove `next'.
(_bfd_look_for_bfd_in_cache): Reimplement using htab_find.
(hash_file_ptr): New function.
(eq_file_ptr): Likewise.
(_bfd_add_bfd_to_archive_cache): Reimplement using a hash table.
* libbfd-in.h: Include hashtab.h.
(struct artdata): Change `cache' member type to htab_t.
* libbfd.h: Rebuild.
* dwarf2.c (dwarf2_debug): Move info_ptr_unit to ...
(comp_unit): Here.
(read_unsigned_leb128): Removed.
(read_signed_leb128): Removed.
(find_abstract_instance_name): Updated.
(parse_comp_unit): Accept info_ptr_unit.
(_bfd_dwarf2_find_nearest_line): Set info_ptr_unit for each
comp unit and pass it to parse_comp_unit.
* elf-eh-frame.c (read_unsigned_leb128): Moved to ...
(read_signed_leb128): Moved to ...
* libbfd.c: Here.
* libbfd-in.h (read_unsigned_leb128): New prototype.
(read_signed_leb128): Likewise.
* libbfd.h: Regenerated.
* bfd.c (bfd_get_synthetic_symtab): Pass counts and both symbol tables.
* elf-bfd.h (_bfd_elf_get_synthetic_symtab): Adjust.
* elf.c (_bfd_elf_get_synthetic_symtab): Adjust.
* libbfd-in.h (_bfd_nodynamic_get_synthetic_symtab): Adjust.
* targets.c (struct bfd_target <_bfd_get_synthetic_symtab>): Adjust.
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't read symbols.
Use both symbol tables on non-relocatable objects. Use a common
error exit. Fix "mid" warning.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
binutils/
* objdump.c (dump_bfd): Pass both symbol tables to
bfd_get_synthetic_symtab.
Nick Clifton <nickc@redhat.com>
PR 290
* bfd.c (_bfd_default_error_handler): Make it global.
* elf-bfd.h (elf_backend_data): Add link_order_error_handler.
* elf.c (assign_section_numbers): Cope gracefully with sections
which have SHF_LINK_ORDER set but no sh_link set up.
* elflink.c (elf_get_linked_section_vma): Likewise.
* elfxx-ia64.c (elf_backend_link_order_error_handler): New. Set
it to NULL.
* elfxx-target.h (elf_backend_link_order_error_handler): New.
Set it to _bfd_default_error_handler.
(elfNN_bed): Add elf_backend_link_order_error_handler.
* libbfd-in.h (_bfd_default_error_handler): New.
* libbfd.h: Regenerated.
* bfd-in.h: Update copyright.
(bfd_tell): Change return type to file_ptr.
* bfd-in2.h: Re-generate.
* cache.c: Update copyright.
(bfd_cache_lookup_worker): Use real_fseek, do not cast offset
parameter.
(close_one): Use real_ftell.
* bfdio.c: Update copyright.
(real_ftell, real_fseek): New functions.
(bfd_tell): Use real_fseek and real_ftell, change return type to
file_ptr.
(bfd_seek): Use real_ftell and real_fseek, change type of
file_position to a file_ptr.
* libbfd-in.h: Update copyright.
(real_ftell, real_fseek): Declare.
* libbfd.h: Re-generate.