aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-10-11 06:30:20 +0000
committerAlan Modra <amodra@gmail.com>2011-10-11 06:30:20 +0000
commit98c53ba3060c6a4b0c7e5370cda665f2b450facb (patch)
tree2d47c9f9370fd7f3aedbcba28b1c185cf21a7440 /bfd/archive.c
parent0838fb575ec286250d500871c0a078e6bd25eacc (diff)
downloadgdb-98c53ba3060c6a4b0c7e5370cda665f2b450facb.zip
gdb-98c53ba3060c6a4b0c7e5370cda665f2b450facb.tar.gz
gdb-98c53ba3060c6a4b0c7e5370cda665f2b450facb.tar.bz2
PR binutils/13257
* archive.c (_bfd_find_nested_archive, _bfd_get_elt_at_filepos): Open thin archive element using container target if not defaulted.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 77f8829..44ac712 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -343,6 +343,7 @@ static bfd *
_bfd_find_nested_archive (bfd *arch_bfd, const char *filename)
{
bfd *abfd;
+ const char *target;
for (abfd = arch_bfd->nested_archives;
abfd != NULL;
@@ -351,7 +352,10 @@ _bfd_find_nested_archive (bfd *arch_bfd, const char *filename)
if (filename_cmp (filename, abfd->filename) == 0)
return abfd;
}
- abfd = bfd_openr (filename, NULL);
+ target = NULL;
+ if (!arch_bfd->target_defaulted)
+ target = arch_bfd->xvec->name;
+ abfd = bfd_openr (filename, target);
if (abfd)
{
abfd->archive_next = arch_bfd->nested_archives;
@@ -597,6 +601,8 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
if (bfd_is_thin_archive (archive))
{
+ const char *target;
+
/* This is a proxy entry for an external file. */
if (! IS_ABSOLUTE_PATH (filename))
{
@@ -628,7 +634,10 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
}
/* It's not an element of a nested archive;
open the external file as a bfd. */
- n_nfd = bfd_openr (filename, NULL);
+ target = NULL;
+ if (!archive->target_defaulted)
+ target = archive->xvec->name;
+ n_nfd = bfd_openr (filename, target);
if (n_nfd == NULL)
bfd_set_error (bfd_error_malformed_archive);
}