diff --git a/lld/test/wasm/lto/incompatible.ll b/lld/test/wasm/lto/incompatible.ll --- 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 --- a/lld/test/wasm/lto/libcall-truncsfhf2.ll +++ b/lld/test/wasm/lto/libcall-truncsfhf2.ll @@ -17,4 +17,4 @@ 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 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -569,8 +569,7 @@ 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 @@ 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 keptComdats;