diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -139,8 +139,10 @@ target |= EF_RISCV_RVC; if ((eflags & EF_RISCV_FLOAT_ABI) != (target & EF_RISCV_FLOAT_ABI)) - error(toString(f) + - ": cannot link object files with different floating-point ABI"); + error( + toString(f) + + ": cannot link object files with different floating-point ABI from " + + toString(ctx->objectFiles[0])); if ((eflags & EF_RISCV_RVE) != (target & EF_RISCV_RVE)) error(toString(f) + diff --git a/lld/test/ELF/riscv-flags.s b/lld/test/ELF/riscv-flags.s new file mode 100644 --- /dev/null +++ b/lld/test/ELF/riscv-flags.s @@ -0,0 +1,7 @@ +# REQUIRES: riscv + +# RUN: llvm-mc -filetype=obj -triple=riscv64 -target-abi=lp64d -mattr=+d %s -o %td.o +# RUN: llvm-mc -filetype=obj -triple=riscv64 -target-abi=lp64f -mattr=+f %s -o %tf.o +# RUN: not ld.lld %td.o %tf.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR -DF1=%td.o -DF2=%tf.o + +# ERR: error: [[F2]]: cannot link object files with different floating-point ABI from [[F1]]