This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR binutils/13257: NM + plugin does not list correctly symbols in thin archives


Hi,

We never pass "plugin" when opening a new bfd on archive members.  This
patch fixes it.  OK to install?

Thanks.


H.J.
---
2011-10-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/13257
	* archive.c (_bfd_find_nested_archive): Support plugin target.
	(_bfd_get_elt_at_filepos): Likewise.

diff --git a/bfd/archive.c b/bfd/archive.c
index 77f8829..23f3409 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -141,6 +141,10 @@ SUBSECTION
 extern int errno;
 #endif
 
+#if BFD_SUPPORTS_PLUGINS
+extern const bfd_target plugin_vec;
+#endif
+
 /* We keep a cache of archive filepointers to archive elements to
    speed up searching the archive by filepos.  We only add an entry to
    the cache when we actually read one.  We also don't sort the cache;
@@ -343,6 +347,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 +356,13 @@ _bfd_find_nested_archive (bfd *arch_bfd, const char *filename)
       if (filename_cmp (filename, abfd->filename) == 0)
         return abfd;
     }
-  abfd = bfd_openr (filename, NULL);
+#if BFD_SUPPORTS_PLUGINS
+  if (arch_bfd->xvec == &plugin_vec)
+    target = plugin_vec.name;
+  else
+#endif
+    target = NULL;
+  abfd = bfd_openr (filename, target);
   if (abfd)
     {
       abfd->archive_next = arch_bfd->nested_archives;
@@ -597,6 +608,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 +641,13 @@ _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);
+#if BFD_SUPPORTS_PLUGINS
+      if (archive->xvec == &plugin_vec)
+	target = plugin_vec.name;
+      else
+#endif
+	target = NULL;
+      n_nfd = bfd_openr (filename, target);
       if (n_nfd == NULL)
 	bfd_set_error (bfd_error_malformed_archive);
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]