[PATCH] D140930: [dsymutil] Avoid invalid keep chains due to pruning

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 15:06:22 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG45f347270caf: [dsymutil] Avoid invalid keep chains due to pruning (authored by JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D140930?vs=486068&id=486405#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140930/new/

https://reviews.llvm.org/D140930

Files:
  llvm/lib/DWARFLinker/DWARFLinker.cpp


Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -788,8 +788,14 @@
     unsigned Idx = Current.CU.getOrigUnit().getDIEIndex(Current.Die);
     CompileUnit::DIEInfo &MyInfo = Current.CU.getInfo(Idx);
 
-    if (MyInfo.Prune)
-      continue;
+    if (MyInfo.Prune) {
+      // We're walking the dependencies of a module forward declaration that was
+      // kept because there is no definition.
+      if (Current.Flags & TF_DependencyWalk)
+        MyInfo.Prune = false;
+      else
+        continue;
+    }
 
     // If the Keep flag is set, we are marking a required DIE's dependencies.
     // If our target is already marked as kept, we're all set.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140930.486405.patch
Type: text/x-patch
Size: 803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230104/ae66dc19/attachment.bin>


More information about the llvm-commits mailing list