[PATCH] D133452: [ORC] Fix auto-claim of weak defs in ObjectLinkingLayer

Jonas Hahnfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 14:07:04 PDT 2022


Hahnfeld created this revision.
Hahnfeld added reviewers: lhames, sgraenitz.
Herald added subscribers: luke957, StephenFan, luismarques, s.egerton, PkmX, simoncook, hiraditya, arichardson.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The pass claiming symbols has to run before the pass that marks all
claimed symbols as active. This fixes JIT codegen of code involving
exceptions on RISC-V (which was failing with a missing definition of
`DW.ref.__gxx_personality_v0`), but actually throwing and then catching
exceptions will need more work to register EH frames with libunwind.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133452

Files:
  llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp


Index: llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
+++ llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
@@ -326,8 +326,9 @@
 
   Error modifyPassConfig(LinkGraph &LG, PassConfiguration &Config) override {
     // Add passes to mark duplicate defs as should-discard, and to walk the
-    // link graph to build the symbol dependence graph.
-    Config.PrePrunePasses.push_back([this](LinkGraph &G) {
+    // link graph to build the symbol dependence graph. This has to run before
+    // the MarkLivePass looks at the list of defined symbols.
+    Config.PrePrunePasses.insert(Config.PrePrunePasses.begin(), [this](LinkGraph &G) {
       return claimOrExternalizeWeakAndCommonSymbols(G);
     });
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133452.458554.patch
Type: text/x-patch
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220907/6d75dde1/attachment.bin>


More information about the llvm-commits mailing list