+
+ if (entry->flags.search_dirs
+ && !bfd_arch_get_compatible (check, link_info.output_bfd,
+ command_line.accept_unknown_input_arch)
+ /* XCOFF archives can have 32 and 64 bit objects. */
+ && ! (bfd_get_flavour (check) == bfd_target_xcoff_flavour
+ && bfd_get_flavour (link_info.output_bfd) == bfd_target_xcoff_flavour
+ && bfd_check_format (entry->the_bfd, bfd_archive)))
+ {
+ if (command_line.warn_search_mismatch)
+ einfo (_("%P: skipping incompatible %s "
+ "when searching for %s\n"),
+ attempt, entry->local_sym_name);
+ bfd_close (entry->the_bfd);
+ entry->the_bfd = NULL;
+ return FALSE;
+ }
+ }
+ }
+success:
+#ifdef ENABLE_PLUGINS
+ /* If plugins are active, they get first chance to claim
+ any successfully-opened input file. We skip archives
+ here; the plugin wants us to offer it the individual
+ members when we enumerate them, not the whole file. We
+ also ignore corefiles, because that's just weird. It is
+ a needed side-effect of calling bfd_check_format with
+ bfd_object that it sets the bfd's arch and mach, which
+ will be needed when and if we want to bfd_create a new
+ one using this one as a template. */
+ if (bfd_check_format (entry->the_bfd, bfd_object)
+ && plugin_active_plugins_p ()
+ && !no_more_claiming)
+ {
+ int fd = open (attempt, O_RDONLY | O_BINARY);
+ if (fd >= 0)
+ {
+ struct ld_plugin_input_file file;
+
+ file.name = attempt;
+ file.offset = 0;
+ file.filesize = lseek (fd, 0, SEEK_END);
+ file.fd = fd;
+ plugin_maybe_claim (&file, entry);