[PATCH] D124271: [lld-macho] Fix crash on invalid framework tbd
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 10:27:11 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d8cf26d0870: [lld-macho] Fix crash on invalid framework tbd (authored by keith).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124271/new/
https://reviews.llvm.org/D124271
Files:
lld/MachO/Driver.cpp
lld/test/MachO/invalid/invalid-stub.s
Index: lld/test/MachO/invalid/invalid-stub.s
===================================================================
--- lld/test/MachO/invalid/invalid-stub.s
+++ lld/test/MachO/invalid/invalid-stub.s
@@ -1,11 +1,14 @@
# REQUIRES: x86
-# RUN: mkdir -p %t
+# RUN: mkdir -p %t/invalidYAML.framework
# RUN: echo "--- !tapi-tbd-v3" > %t/libinvalidYAML.tbd
# RUN: echo "invalid YAML" >> %t/libinvalidYAML.tbd
+# RUN: cp %t/libinvalidYAML.tbd %t/invalidYAML.framework/invalidYAML.tbd
# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %s -o %t/test.o
# RUN: not %lld -L%t -linvalidYAML %t/test.o -o %t/test 2>&1 | FileCheck %s -DDIR=%t
+# RUN: not %lld -F%t -framework invalidYAML %t/test.o -o %t/test 2>&1 | FileCheck %s -DDIR=%t --check-prefix=CHECK-FRAMEWORK
# CHECK: could not load TAPI file at [[DIR]]{{[\\/]}}libinvalidYAML.tbd: malformed file
+# CHECK-FRAMEWORK: could not load TAPI file at [[DIR]]{{[\\/]}}invalidYAML.framework{{[\\/]}}invalidYAML.tbd: malformed file
.globl _main
_main:
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -408,7 +408,8 @@
config->hasReexports = true;
dylibFile->reexport = true;
}
- } else if (isa<ObjFile>(file) || isa<BitcodeFile>(file)) {
+ } else if (isa_and_nonnull<ObjFile>(file) ||
+ isa_and_nonnull<BitcodeFile>(file)) {
// Cache frameworks containing object or bitcode files to avoid duplicate
// symbols. Frameworks containing static archives are cached separately
// in addFile() to share caching with libraries, and frameworks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124271.424522.patch
Type: text/x-patch
Size: 1653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/885a9626/attachment.bin>
More information about the llvm-commits
mailing list