aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/format.c17
-rw-r--r--bfd/plugin.c2
3 files changed, 23 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 29aac39..58a9de4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2016-02-16 Joseph Myers <joseph@codesourcery.com>
+
+ * plugin.c (plugin_vec): Set match priority to 255.
+ * format.c (bfd_check_format_matches) [BFD_SUPPORTS_PLUGINS]: When
+ matching against the plugin vector, take priority from there not
+ from TEMP.
+
2016-02-15 Nick Clifton <nickc@redhat.com>
* elf-bfd.h (struct bfd_elf_special_section): Use unsigned values
diff --git a/bfd/format.c b/bfd/format.c
index aad4dc2..f34b1d4 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -203,6 +203,9 @@ bfd_boolean
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;
@@ -305,6 +308,16 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (temp)
{
+ int match_priority = temp->match_priority;
+#if BFD_SUPPORTS_PLUGINS
+ /* If this object can be handled by a plugin, give that the
+ lowest priority; objects both handled by a plugin and
+ with an underlying object format will be claimed
+ separately by the plugin. */
+ if (*target == &plugin_vec)
+ match_priority = (*target)->match_priority;
+#endif
+
match_targ = temp;
if (preserve.marker != NULL)
bfd_preserve_finish (abfd, &preserve);
@@ -326,9 +339,9 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
matching_vector[match_count] = temp;
match_count++;
- if (temp->match_priority < best_match)
+ if (match_priority < best_match)
{
- best_match = temp->match_priority;
+ best_match = match_priority;
best_count = 0;
}
best_count++;
diff --git a/bfd/plugin.c b/bfd/plugin.c
index b832e23..82a87d6 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -566,7 +566,7 @@ const bfd_target plugin_vec =
0, /* symbol_leading_char. */
'/', /* ar_pad_char. */
15, /* ar_max_namelen. */
- 0, /* match priority. */
+ 255, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,