aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-05-19 14:46:59 +0000
committerNick Clifton <nickc@redhat.com>2004-05-19 14:46:59 +0000
commit1b09e940ece9cf4f29580025373ae19c9c640e2a (patch)
tree0dae08847a8739c843965a2456a09880e796f849 /bfd/archive.c
parent35835446e4115755fc48a367d58ea57f1b88dd1e (diff)
downloadfsf-binutils-gdb-1b09e940ece9cf4f29580025373ae19c9c640e2a.zip
fsf-binutils-gdb-1b09e940ece9cf4f29580025373ae19c9c640e2a.tar.gz
fsf-binutils-gdb-1b09e940ece9cf4f29580025373ae19c9c640e2a.tar.bz2
Add code to cope with nested archives.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index a8d53c6..ec8a086d 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1,24 +1,24 @@
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003
+ 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (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.
+ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
@setfilename archive-info
@@ -467,6 +467,12 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
struct areltdata *new_areldata;
bfd *n_nfd;
+ if (archive->my_archive)
+ {
+ filepos += archive->origin;
+ archive = archive->my_archive;
+ }
+
n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos);
if (n_nfd)
return n_nfd;
@@ -549,10 +555,12 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file)
else
{
unsigned int size = arelt_size (last_file);
+ filestart = last_file->origin + size;
+ if (archive->my_archive)
+ filestart -= archive->origin;
/* Pad to an even boundary...
Note that last_file->origin can be odd in the case of
BSD-4.4-style element with a long odd size. */
- filestart = last_file->origin + size;
filestart += filestart % 2;
}