[PATCH] D120689: [lld][WebAssembly] Improve error reporting for bad ar archive members
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 28 16:35:34 PST 2022
sbc100 updated this revision to Diff 411929.
sbc100 added a comment.
- require
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120689/new/
https://reviews.llvm.org/D120689
Files:
lld/test/wasm/bad-archive-member.s
lld/wasm/InputFiles.cpp
Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -87,7 +87,12 @@
if (magic == file_magic::bitcode)
return make<BitcodeFile>(mb, archiveName, offsetInArchive);
- fatal("unknown file type: " + mb.getBufferIdentifier());
+ std::string name = mb.getBufferIdentifier().str();
+ if (!archiveName.empty()) {
+ name = archiveName.str() + "(" + name + ")";
+ }
+
+ fatal("unknown file type: " + name);
}
// Relocations contain either symbol or type indices. This function takes a
Index: lld/test/wasm/bad-archive-member.s
===================================================================
--- /dev/null
+++ lld/test/wasm/bad-archive-member.s
@@ -0,0 +1,11 @@
+# REQUIRES: x86
+
+# RUN: rm -rf %t.dir
+# RUN: mkdir -p %t.dir
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux -o %t.dir/elf.o %s
+# RUN: llvm-ar rcs %t.dir/libfoo.a %t.dir/elf.o
+# RUN: not wasm-ld %t.dir/libfoo.a -o /dev/null 2>&1 | FileCheck %s
+# CHECK: error: unknown file type: {{.*}}libfoo.a(elf.o)
+
+.globl _start
+_start:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120689.411929.patch
Type: text/x-patch
Size: 1123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220301/755fd3e5/attachment.bin>
More information about the llvm-commits
mailing list