]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR binutils/13257
authorAlan Modra <amodra@gmail.com>
Tue, 25 Oct 2011 03:03:14 +0000 (03:03 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 25 Oct 2011 03:03:14 +0000 (03:03 +0000)
2011-10-11  Alan Modra  <amodra@gmail.com>
* archive.c (_bfd_find_nested_archive, _bfd_get_elt_at_filepos): Open
thin archive element using container target if not defaulted.

bfd/ChangeLog
bfd/archive.c

index 93ca000f12aaa62a8e205aa5c005cd965132b9ec..ea5d79292d6bb1214534e8439dcfea0556b80798 100644 (file)
@@ -1,6 +1,11 @@
 2011-10-25  Alan Modra  <amodra@gmail.com>
 
        Apply mainline patches
+       2011-10-11  Alan Modra  <amodra@gmail.com>
+       PR binutils/13257
+       * archive.c (_bfd_find_nested_archive, _bfd_get_elt_at_filepos): Open
+       thin archive element using container target if not defaulted.
+
        2011-10-10  Alan Modra  <amodra@gmail.com>
        * elf64-ppc.c (ppc64_elf_howto_table): Add R_PPC64_TOCSAVE entry.
        (struct ppc_link_hash_table): Add tocsave_htab.
index 77f8829dc1f752681162131016f0bd8fc2d1c011..44ac712388d5a65b176271021df3c63f3be13b86 100644 (file)
@@ -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);
     }