aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2014-05-06 20:13:03 +0100
committerRichard Sandiford <rdsandiford@googlemail.com>2014-05-06 20:13:03 +0100
commit757a636fb585824699b1cc4f8f23dbc3a6a6d914 (patch)
tree15953a6dfe98f06376da2abe15580ba510cc0e79 /bfd
parent5e824b358f831b0cc4352ed6a3079c6f540fc107 (diff)
downloadgdb-757a636fb585824699b1cc4f8f23dbc3a6a6d914.zip
gdb-757a636fb585824699b1cc4f8f23dbc3a6a6d914.tar.gz
gdb-757a636fb585824699b1cc4f8f23dbc3a6a6d914.tar.bz2
bfd/
* elfxx-mips.h (elfxx-mips.h): Declare. * elfxx-mips.c (mips_elf_merge_obj_attributes): Use it to report Tag_GNU_MIPS_ABI_FP mismatches. (_bfd_mips_fp_abi_string): New function.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elfxx-mips.c236
-rw-r--r--bfd/elfxx-mips.h2
3 files changed, 77 insertions, 168 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index db4c6fb..902dc73 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2014-05-06 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * elfxx-mips.h (elfxx-mips.h): Declare.
+ * elfxx-mips.c (mips_elf_merge_obj_attributes): Use it to report
+ Tag_GNU_MIPS_ABI_FP mismatches.
+ (_bfd_mips_fp_abi_string): New function.
+
2014-05-02 Alan Modra <amodra@gmail.com>
* targets.c: Sort bfd_target vectors somewhat alphabetically.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index d939444..f8c1e64 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -14364,176 +14364,49 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
if (in_attr[Tag_GNU_MIPS_ABI_FP].i != out_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- out_attr[Tag_GNU_MIPS_ABI_FP].type = 1;
- if (out_attr[Tag_GNU_MIPS_ABI_FP].i == Val_GNU_MIPS_ABI_FP_ANY)
- out_attr[Tag_GNU_MIPS_ABI_FP].i = in_attr[Tag_GNU_MIPS_ABI_FP].i;
- else if (in_attr[Tag_GNU_MIPS_ABI_FP].i != Val_GNU_MIPS_ABI_FP_ANY)
- switch (out_attr[Tag_GNU_MIPS_ABI_FP].i)
- {
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
- {
- case Val_GNU_MIPS_ABI_FP_SINGLE:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd, "-mdouble-float", "-msingle-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_SOFT:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_64:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- "-mdouble-float", "-mips32r2 -mfp64");
- break;
-
- default:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), "
- "%B uses unknown floating point ABI %d"),
- obfd, abi_fp_bfd, ibfd,
- "-mdouble-float", in_attr[Tag_GNU_MIPS_ABI_FP].i);
- break;
- }
- break;
-
- case Val_GNU_MIPS_ABI_FP_SINGLE:
- switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
- {
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd, "-msingle-float", "-mdouble-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_SOFT:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_64:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- "-msingle-float", "-mips32r2 -mfp64");
- break;
-
- default:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), "
- "%B uses unknown floating point ABI %d"),
- obfd, abi_fp_bfd, ibfd,
- "-msingle-float", in_attr[Tag_GNU_MIPS_ABI_FP].i);
- break;
- }
- break;
-
- case Val_GNU_MIPS_ABI_FP_SOFT:
- switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
- {
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- case Val_GNU_MIPS_ABI_FP_SINGLE:
- case Val_GNU_MIPS_ABI_FP_64:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd, "-msoft-float", "-mhard-float");
- break;
-
- default:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), "
- "%B uses unknown floating point ABI %d"),
- obfd, abi_fp_bfd, ibfd,
- "-msoft-float", in_attr[Tag_GNU_MIPS_ABI_FP].i);
- break;
- }
- break;
-
- case Val_GNU_MIPS_ABI_FP_64:
- switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
- {
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- "-mips32r2 -mfp64", "-mdouble-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_SINGLE:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- "-mips32r2 -mfp64", "-msingle-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_SOFT:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
- break;
-
- default:
- _bfd_error_handler
- (_("Warning: %B uses %s (set by %B), "
- "%B uses unknown floating point ABI %d"),
- obfd, abi_fp_bfd, ibfd,
- "-mips32r2 -mfp64", in_attr[Tag_GNU_MIPS_ABI_FP].i);
- break;
- }
- break;
-
- default:
- switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
- {
- case Val_GNU_MIPS_ABI_FP_DOUBLE:
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d "
- "(set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- out_attr[Tag_GNU_MIPS_ABI_FP].i, "-mdouble-float");
- break;
+ int out_fp, in_fp;
- case Val_GNU_MIPS_ABI_FP_SINGLE:
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d "
- "(set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- out_attr[Tag_GNU_MIPS_ABI_FP].i, "-msingle-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_SOFT:
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d "
- "(set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- out_attr[Tag_GNU_MIPS_ABI_FP].i, "-msoft-float");
- break;
-
- case Val_GNU_MIPS_ABI_FP_64:
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d "
- "(set by %B), %B uses %s"),
- obfd, abi_fp_bfd, ibfd,
- out_attr[Tag_GNU_MIPS_ABI_FP].i, "-mips32r2 -mfp64");
- break;
+ out_fp = out_attr[Tag_GNU_MIPS_ABI_FP].i;
+ in_fp = in_attr[Tag_GNU_MIPS_ABI_FP].i;
+ out_attr[Tag_GNU_MIPS_ABI_FP].type = 1;
+ if (out_fp == Val_GNU_MIPS_ABI_FP_ANY)
+ out_attr[Tag_GNU_MIPS_ABI_FP].i = in_fp;
+ else if (in_fp != Val_GNU_MIPS_ABI_FP_ANY)
+ {
+ const char *out_string, *in_string;
- default:
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d "
- "(set by %B), %B uses unknown floating point ABI %d"),
- obfd, abi_fp_bfd, ibfd,
- out_attr[Tag_GNU_MIPS_ABI_FP].i,
- in_attr[Tag_GNU_MIPS_ABI_FP].i);
- break;
- }
- break;
- }
+ out_string = _bfd_mips_fp_abi_string (out_fp);
+ in_string = _bfd_mips_fp_abi_string (in_fp);
+ /* First warn about cases involving unrecognised ABIs. */
+ if (!out_string && !in_string)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd, out_fp, in_fp);
+ else if (!out_string)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, out_fp, in_string);
+ else if (!in_string)
+ _bfd_error_handler
+ (_("Warning: %B uses %s (set by %B), "
+ "%B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd, out_string, in_fp);
+ else
+ {
+ /* If one of the bfds is soft-float, the other must be
+ hard-float. The exact choice of hard-float ABI isn't
+ really relevant to the error message. */
+ if (in_fp == Val_GNU_MIPS_ABI_FP_SOFT)
+ out_string = "-mhard-float";
+ else if (out_fp == Val_GNU_MIPS_ABI_FP_SOFT)
+ in_string = "-mhard-float";
+ _bfd_error_handler
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, out_string, in_string);
+ }
+ }
}
/* Check for conflicting Tag_GNU_MIPS_ABI_MSA attributes and merge
@@ -14944,6 +14817,33 @@ _bfd_mips_elf_get_target_dtag (bfd_vma dtag)
}
}
+/* Return the meaning of Tag_GNU_MIPS_ABI_FP value FP, or null if
+ not known. */
+
+const char *
+_bfd_mips_fp_abi_string (int fp)
+{
+ switch (fp)
+ {
+ /* These strings aren't translated because they're simply
+ option lists. */
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
+ return "-mdouble-float";
+
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
+ return "-msingle-float";
+
+ case Val_GNU_MIPS_ABI_FP_SOFT:
+ return "-msoft-float";
+
+ case Val_GNU_MIPS_ABI_FP_64:
+ return "-mips32r2 -mfp64";
+
+ default:
+ return 0;
+ }
+}
+
bfd_boolean
_bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr)
{
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index e6ec673..95b98ac 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -108,6 +108,8 @@ extern bfd_boolean _bfd_mips_elf_merge_private_bfd_data
(bfd *, bfd *);
extern bfd_boolean _bfd_mips_elf_set_private_flags
(bfd *, flagword);
+extern const char * _bfd_mips_fp_abi_string
+ (int);
extern bfd_boolean _bfd_mips_elf_print_private_bfd_data
(bfd *, void *);
extern bfd_boolean _bfd_mips_elf_discard_info