Add code to cope with nested archives.

This commit is contained in:
Nick Clifton
2004-05-19 14:46:59 +00:00
parent 35835446e4
commit 1b09e940ec
2 changed files with 27 additions and 14 deletions

View File

@@ -1,3 +1,8 @@
2004-05-19 Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
* archive.c (_bfd_get_elt_at_filepos): Cope with a nested archives.
(bfd_generic_openr_next_archived_file): Likewise.
2004-05-17 Bob Wilson <bob.wilson@acm.org> 2004-05-17 Bob Wilson <bob.wilson@acm.org>
* elf32-xtensa.c (xtensa_get_property_section_name): Determine linkonce * elf32-xtensa.c (xtensa_get_property_section_name): Determine linkonce

View File

@@ -1,6 +1,6 @@
/* BFD back-end for archive files (libraries). /* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
@@ -467,6 +467,12 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
struct areltdata *new_areldata; struct areltdata *new_areldata;
bfd *n_nfd; bfd *n_nfd;
if (archive->my_archive)
{
filepos += archive->origin;
archive = archive->my_archive;
}
n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos); n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd) if (n_nfd)
return n_nfd; return n_nfd;
@@ -549,10 +555,12 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
else else
{ {
unsigned int size = arelt_size (last_file); unsigned int size = arelt_size (last_file);
filestart = last_file->origin + size;
if (archive->my_archive)
filestart -= archive->origin;
/* Pad to an even boundary... /* Pad to an even boundary...
Note that last_file->origin can be odd in the case of Note that last_file->origin can be odd in the case of
BSD-4.4-style element with a long odd size. */ BSD-4.4-style element with a long odd size. */
filestart = last_file->origin + size;
filestart += filestart % 2; filestart += filestart % 2;
} }