[Mlir-commits] [mlir] 3c4cdd0 - [mlir] ExecutionEngine needs special handling for COFF binaries

Kern Handa llvmlistbot at llvm.org
Tue Feb 23 17:34:27 PST 2021


Author: Kern Handa
Date: 2021-02-23T17:34:19-08:00
New Revision: 3c4cdd0b6a6fd760707be9b5dec32378ec55c549

URL: https://github.com/llvm/llvm-project/commit/3c4cdd0b6a6fd760707be9b5dec32378ec55c549
DIFF: https://github.com/llvm/llvm-project/commit/3c4cdd0b6a6fd760707be9b5dec32378ec55c549.diff

LOG: [mlir] ExecutionEngine needs special handling for COFF binaries

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97141

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/ExecutionEngine.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
index 706e041c482f..dc03f5b0ef55 100644
--- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -255,6 +255,15 @@ Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
     if (engine->perfListener)
       objectLayer->registerJITEventListener(*engine->perfListener);
 
+    // COFF format binaries (Windows) need special handling to deal with
+    // exported symbol visibility.
+    // cf llvm/lib/ExecutionEngine/Orc/LLJIT.cpp LLJIT::createObjectLinkingLayer
+    llvm::Triple targetTriple(llvm::Twine(llvmModule->getTargetTriple()));
+    if (targetTriple.isOSBinFormatCOFF()) {
+      objectLayer->setOverrideObjectFlagsWithResponsibilityFlags(true);
+      objectLayer->setAutoClaimResponsibilityForObjectSymbols(true);
+    }
+
     // Resolve symbols from shared libraries.
     for (auto libPath : sharedLibPaths) {
       auto mb = llvm::MemoryBuffer::getFile(libPath);


        


More information about the Mlir-commits mailing list