aboutsummaryrefslogtreecommitdiff
path: root/bfd/plugin.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-09-15 17:12:59 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-09-15 17:12:59 +0000
commit028ed2b2b68055a3ff958dc0ff7d3daa95370434 (patch)
treefb79a96116d8826211dd4457fdb82d7bd7662b8f /bfd/plugin.c
parent492d5973f09a803b6829c5c7d0dde6ea0c77fbfd (diff)
downloadgdb-028ed2b2b68055a3ff958dc0ff7d3daa95370434.zip
gdb-028ed2b2b68055a3ff958dc0ff7d3daa95370434.tar.gz
gdb-028ed2b2b68055a3ff958dc0ff7d3daa95370434.tar.bz2
Handle NULL iostream in bfd_plugin_object_p.
2010-09-15 H.J. Lu <hongjiu.lu@intel.com> PR binutils/12004 * plugin.c (bfd_plugin_object_p): Handle NULL iostream.
Diffstat (limited to 'bfd/plugin.c')
-rw-r--r--bfd/plugin.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 4c24a7f..a46bf90 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -233,26 +233,31 @@ bfd_plugin_object_p (bfd *abfd)
int claimed = 0;
int t = load_plugin ();
struct ld_plugin_input_file file;
+ bfd *iobfd;
+
if (!t)
return NULL;
file.name = abfd->filename;
- if (abfd->iostream)
+ if (abfd->my_archive)
{
- file.fd = fileno ((FILE *) abfd->iostream);
- file.offset = 0;
- file.filesize = 0; /*FIXME*/
+ iobfd = abfd->my_archive;
+ file.offset = abfd->origin;
+ file.filesize = arelt_size (abfd);
}
else
{
- bfd *archive = abfd->my_archive;
- BFD_ASSERT (archive);
- file.fd = fileno ((FILE *) archive->iostream);
- file.offset = abfd->origin;
- file.filesize = arelt_size (abfd);
-
+ iobfd = abfd;
+ file.offset = 0;
+ file.filesize = 0; /*FIXME*/
}
+
+ if (!iobfd->iostream && !bfd_open_file (iobfd))
+ return NULL;
+
+ file.fd = fileno ((FILE *) iobfd->iostream);
+
file.handle = abfd;
claim_file (&file, &claimed);
if (!claimed)