[ELF] Name ctx->objectFiles[0] in the EF_RISCV_FLOAT_ABI mismatch error

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D134198
This commit is contained in:
Fangrui Song 2022-09-20 11:14:04 -07:00
parent 52887071ea
commit 87792bdc38
2 changed files with 11 additions and 2 deletions

View File

@ -139,8 +139,10 @@ uint32_t RISCV::calcEFlags() const {
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) +

View File

@ -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]]