RISC-V: Improve linker error for FP mismatch.
authorJim Wilson <jimw@sifive.com>
Tue, 13 Nov 2018 23:50:38 +0000 (15:50 -0800)
committerJim Wilson <jimw@sifive.com>
Tue, 13 Nov 2018 23:56:29 +0000 (15:56 -0800)
bfd/
* elfnn-riscv.c (riscv_float_abi_string): New.
(_bfd_riscv_elf_merge_private_bfd_data): Use it for error message.

bfd/ChangeLog
bfd/elfnn-riscv.c

index 554ca2730ea6edf9705adab4d932f91c9e22e254..ffde4c90a76cac0461dfe58d1f4d1862aaaa9dfa 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-13  Jim Wilson  <jimw@sifive.com>
+
+       * elfnn-riscv.c (riscv_float_abi_string): New.
+       (_bfd_riscv_elf_merge_private_bfd_data): Use it for error message.
+
 2018-11-09  Bernhard M. Wiedemann  <bwiedemann@suse.de>
 
        * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Correct comment
index 5cde72f0034efd66867ab08672cc336895532760..a3599d73a9385b6ce1553232602199ee62d482de 100644 (file)
@@ -2638,6 +2638,31 @@ riscv_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
     }
 }
 
+/* Given the ELF header flags in FLAGS, it returns a string that describes the
+   float ABI.  */
+
+static const char *
+riscv_float_abi_string (flagword flags)
+{
+  switch (flags & EF_RISCV_FLOAT_ABI)
+    {
+    case EF_RISCV_FLOAT_ABI_SOFT:
+      return "soft-float";
+      break;
+    case EF_RISCV_FLOAT_ABI_SINGLE:
+      return "single-float";
+      break;
+    case EF_RISCV_FLOAT_ABI_DOUBLE:
+      return "double-float";
+      break;
+    case EF_RISCV_FLOAT_ABI_QUAD:
+      return "quad-float";
+      break;
+    default:
+      abort ();
+    }
+}
+
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 
@@ -2674,7 +2699,9 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   if ((old_flags ^ new_flags) & EF_RISCV_FLOAT_ABI)
     {
       (*_bfd_error_handler)
-       (_("%pB: can't link hard-float modules with soft-float modules"), ibfd);
+       (_("%pB: can't link %s modules with %s modules"), ibfd,
+        riscv_float_abi_string (new_flags),
+        riscv_float_abi_string (old_flags));
       goto fail;
     }
 
This page took 0.0351900000000001 seconds and 4 git commands to generate.