[PATCH] D85403: [lld-macho] Add error handling for malformed TBD files
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 19:51:28 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3eb1e275470: [lld-macho] Add error handling for malformed TBD files (authored by int3).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85403/new/
https://reviews.llvm.org/D85403
Files:
lld/MachO/Driver.cpp
lld/test/MachO/invalid/invalid-stub.s
Index: lld/test/MachO/invalid/invalid-stub.s
===================================================================
--- /dev/null
+++ lld/test/MachO/invalid/invalid-stub.s
@@ -0,0 +1,12 @@
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: echo "--- !tapi-tbd-v3" > %t/libinvalidYAML.tbd
+# RUN: echo "invalid YAML" >> %t/libinvalidYAML.tbd
+# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %s -o %t/test.o
+# RUN: not lld -flavor darwinnew -Z -L%t -linvalidYAML %t/test.o -o %t/test -Z 2>&1 | FileCheck %s -DDIR=%t
+
+# CHECK: could not load TAPI file at [[DIR]]/libinvalidYAML.tbd: malformed file
+
+.globl _main
+_main:
+ ret
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -230,11 +230,12 @@
inputFiles.push_back(make<DylibFile>(mbref));
break;
case file_magic::tapi_file: {
- llvm::Expected<std::unique_ptr<llvm::MachO::InterfaceFile>> result =
- TextAPIReader::get(mbref);
- if (!result)
+ Expected<std::unique_ptr<InterfaceFile>> result = TextAPIReader::get(mbref);
+ if (!result) {
+ error("could not load TAPI file at " + mbref.getBufferIdentifier() +
+ ": " + toString(result.takeError()));
return;
-
+ }
inputFiles.push_back(make<DylibFile>(**result));
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85403.285243.patch
Type: text/x-patch
Size: 1345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/6339ed71/attachment.bin>
More information about the llvm-commits
mailing list