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);
     });