+ abfd = plugin_get_ir_dummy_bfd (ibfd->filename, ibfd);
+
+ input = bfd_alloc (abfd, sizeof (*input));
+ if (input == NULL)
+ einfo (_("%P%F: plugin failed to allocate memory for input: %s\n"),
+ bfd_get_error ());
+
+ if (inarchive)
+ {
+ /* Offset and filesize must refer to the individual archive
+ member, not the whole file, and must exclude the header.
+ Fortunately for us, that is how the data is stored in the
+ origin field of the bfd and in the arelt_data. */
+ offset = ibfd->origin;
+ filesize = arelt_size (ibfd);
+ }
+ else
+ {
+ offset = 0;
+ filesize = lseek (fd, 0, SEEK_END);
+
+ /* We must copy filename attached to ibfd if it is not an archive
+ member since it may be freed by bfd_close below. */
+ name = plugin_strdup (abfd, name);
+ }
+
+ file.name = name;
+ file.offset = offset;
+ file.filesize = filesize;
+ file.fd = fd;
+ file.handle = input;
+
+ input->abfd = abfd;
+ input->view_buffer.addr = NULL;
+ input->view_buffer.filesize = 0;
+ input->view_buffer.offset = 0;
+ input->fd = fd;
+ input->use_mmap = FALSE;
+ input->offset = offset;
+ input->filesize = filesize;
+ input->name = plugin_strdup (abfd, ibfd->filename);
+
+ claimed = 0;
+
+ if (plugin_call_claim_file (&file, &claimed))