[PATCH] D114397: [lld-macho] Mark dylib symbols coming from -weak_framework as weak-def.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 14:16:27 PST 2021


oontvoo created this revision.
oontvoo added a reviewer: int3.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
oontvoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Details:
Symbols imported from weak framework should be marked as weak-def. Otherwise, we may get runtime crash due to symbols not found.

PR:52564


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114397

Files:
  lld/MachO/Symbols.h


Index: lld/MachO/Symbols.h
===================================================================
--- lld/MachO/Symbols.h
+++ lld/MachO/Symbols.h
@@ -228,8 +228,8 @@
 public:
   DylibSymbol(DylibFile *file, StringRefZ name, bool isWeakDef,
               RefState refState, bool isTlv)
-      : Symbol(DylibKind, name, file), refState(refState), weakDef(isWeakDef),
-        tlv(isTlv) {
+      : Symbol(DylibKind, name, file), refState(refState),
+        weakDef(isWeakDef || (file && file->forceWeakImport)), tlv(isTlv) {
     if (file && refState > RefState::Unreferenced)
       file->numReferencedSymbols++;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114397.389039.patch
Type: text/x-patch
Size: 616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211122/af649270/attachment.bin>


More information about the llvm-commits mailing list