[lld] 73e575a - [lld][WebAssembly] Give better error message on bad archive member
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 21:36:54 PDT 2020
Author: Sam Clegg
Date: 2020-06-30T21:36:36-07:00
New Revision: 73e575a88e27c6ed8bdb1140893260aaf5f9dc7a
URL: https://github.com/llvm/llvm-project/commit/73e575a88e27c6ed8bdb1140893260aaf5f9dc7a
DIFF: https://github.com/llvm/llvm-project/commit/73e575a88e27c6ed8bdb1140893260aaf5f9dc7a.diff
LOG: [lld][WebAssembly] Give better error message on bad archive member
Include the archive name as well as the member name when an error
is encountered parsing bitcode archives.
Differential Revision: https://reviews.llvm.org/D82884
Added:
Modified:
lld/test/wasm/lto/incompatible.ll
lld/test/wasm/lto/libcall-truncsfhf2.ll
lld/wasm/InputFiles.cpp
Removed:
################################################################################
diff --git a/lld/test/wasm/lto/incompatible.ll b/lld/test/wasm/lto/incompatible.ll
index 335756420639..46d5c73dde66 100644
--- a/lld/test/wasm/lto/incompatible.ll
+++ b/lld/test/wasm/lto/incompatible.ll
@@ -2,7 +2,11 @@
; RUN: llvm-as %s -o %t.bc
; RUN: not wasm-ld %t.bc -o %t.wasm 2>&1 | FileCheck %s
+; RUN: llvm-ar rc %t.a %t.bc
+; RUN: not wasm-ld --whole-archive %t.a -o %t.wasm 2>&1 | FileCheck %s --check-prefix=CHECK-ARCHIVE
+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; CHECK: {{.*}}incompatible.ll.tmp.bc: machine type must be wasm32
+; CHECK-ARCHIVE: wasm-ld: error: {{.*}}.a(incompatible.ll.tmp.bc): machine type must be wasm32
diff --git a/lld/test/wasm/lto/libcall-truncsfhf2.ll b/lld/test/wasm/lto/libcall-truncsfhf2.ll
index a427acd139d8..a60af3b52f79 100644
--- a/lld/test/wasm/lto/libcall-truncsfhf2.ll
+++ b/lld/test/wasm/lto/libcall-truncsfhf2.ll
@@ -17,4 +17,4 @@ define void @_start() {
ret void
}
-; CHECK: wasm-ld: error: {{.*}}truncsfhf2.o: attempt to add bitcode file after LTO.
+; CHECK: wasm-ld: error: {{.*}}truncsfhf2.o): attempt to add bitcode file after LTO.
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index d6f01578465f..93d390a5457a 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -569,8 +569,7 @@ bool BitcodeFile::doneLTO = false;
void BitcodeFile::parse() {
if (doneLTO) {
- error(toString(mb.getBufferIdentifier()) +
- ": attempt to add bitcode file after LTO.");
+ error(toString(this) + ": attempt to add bitcode file after LTO.");
return;
}
@@ -578,7 +577,7 @@ void BitcodeFile::parse() {
mb.getBuffer(), saver.save(archiveName + mb.getBufferIdentifier()))));
Triple t(obj->getTargetTriple());
if (t.getArch() != Triple::wasm32) {
- error(toString(mb.getBufferIdentifier()) + ": machine type must be wasm32");
+ error(toString(this) + ": machine type must be wasm32");
return;
}
std::vector<bool> keptComdats;
More information about the llvm-commits
mailing list