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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 11:14:12 PDT 2022


Author: Fangrui Song
Date: 2022-09-20T11:14:04-07:00
New Revision: 87792bdc38b58fefeaf88acc366344c1c3cdbc41

URL: https://github.com/llvm/llvm-project/commit/87792bdc38b58fefeaf88acc366344c1c3cdbc41
DIFF: https://github.com/llvm/llvm-project/commit/87792bdc38b58fefeaf88acc366344c1c3cdbc41.diff

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

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D134198

Added: 
    lld/test/ELF/riscv-flags.s

Modified: 
    lld/ELF/Arch/RISCV.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index a863e798ef474..17c77daae7688 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -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 
diff erent floating-point ABI");
+      error(
+          toString(f) +
+          ": cannot link object files with 
diff erent 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
index 0000000000000..eb4e8fc88a719
--- /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 
diff erent floating-point ABI from [[F1]]


        


More information about the llvm-commits mailing list