Don't check the plugin target twice
diff --git a/ChangeLog.lto-mixed b/ChangeLog.lto-mixed
index 246511e..be66879 100644
--- a/ChangeLog.lto-mixed
+++ b/ChangeLog.lto-mixed
@@ -1,5 +1,10 @@
 bfd/
 
+2014-03-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* format.c (bfd_check_format_matches): Don't check the plugin
+	target twice.
+
 2012-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* plugin.c (add_symbols): Set tdata.plugin_data before calling
diff --git a/bfd/format.c b/bfd/format.c
index 97cbd22..55ab44c 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -230,6 +230,9 @@
 bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
 {
   extern const bfd_target binary_vec;
+#if BFD_SUPPORTS_PLUGINS
+  extern const bfd_target plugin_vec;
+#endif
   const bfd_target * const *target;
   const bfd_target **matching_vector = NULL;
   const bfd_target *save_targ, *right_targ, *ar_right_targ, *match_targ;
@@ -315,6 +318,13 @@
 	  || (*target)->match_priority > best_match)
 	continue;
 
+#if BFD_SUPPORTS_PLUGINS
+      /* Since the plugin target is explicitly specified when a BFD file
+	 is opened,  don't check it twice.  */
+      if (*target == &plugin_vec)
+	continue;
+#endif
+
       /* If we already tried a match, the bfd is modified and may
 	 have sections attached, which will confuse the next
 	 _bfd_check_format call.  */