diff options
author | Jim Wilson <jimw@sifive.com> | 2018-11-13 15:50:38 -0800 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2018-11-13 15:56:29 -0800 |
commit | 0242af401093907f6f2bf49d90c1e5d1e23b4453 (patch) | |
tree | 92f5db99bde14ec437972e256cccf2a858177f27 /bfd | |
parent | 97b3f39201efc9029a9a27d65f13674964c51503 (diff) | |
download | gdb-0242af401093907f6f2bf49d90c1e5d1e23b4453.zip gdb-0242af401093907f6f2bf49d90c1e5d1e23b4453.tar.gz gdb-0242af401093907f6f2bf49d90c1e5d1e23b4453.tar.bz2 |
RISC-V: Improve linker error for FP mismatch.
bfd/
* elfnn-riscv.c (riscv_float_abi_string): New.
(_bfd_riscv_elf_merge_private_bfd_data): Use it for error message.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elfnn-riscv.c | 29 |
2 files changed, 33 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 554ca27..ffde4c9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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 diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 5cde72f..a3599d73 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -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; } |