[llvm] r367712 - [ORC] Turn on symbol-flags overrides for LLJIT on Windows by default.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 12:43:20 PDT 2019


Author: lhames
Date: Fri Aug  2 12:43:20 2019
New Revision: 367712

URL: http://llvm.org/viewvc/llvm-project?rev=367712&view=rev
Log:
[ORC] Turn on symbol-flags overrides for LLJIT on Windows by default.

libObject does not apply the Exported flag to symbols in COFF object files,
which can lead to assertions when the symbol flags initially derived from
IR added to the JIT clash with the flags seen by the JIT linker. Both
RTDyldObjectLinkingLayer and ObjectLinkingLayer have a workaround for this:
they can be told to override the flags seen by the linker with the flags
attached to the materialization responsibility object that was passed down
to the linker. This patch modifies LLJIT's setup code to enable this override
by default on platforms where COFF is the default object format.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
    llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h?rev=367712&r1=367711&r2=367712&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h Fri Aug  2 12:43:20 2019
@@ -184,8 +184,8 @@ private:
 
 class LLJITBuilderState {
 public:
-  using ObjectLinkingLayerCreator =
-      std::function<std::unique_ptr<ObjectLayer>(ExecutionSession &)>;
+  using ObjectLinkingLayerCreator = std::function<std::unique_ptr<ObjectLayer>(
+      ExecutionSession &, const Triple &TT)>;
 
   using CompileFunctionCreator =
       std::function<Expected<IRCompileLayer::CompileFunction>(

Modified: llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp?rev=367712&r1=367711&r2=367712&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp Fri Aug  2 12:43:20 2019
@@ -64,12 +64,18 @@ LLJIT::createObjectLinkingLayer(LLJITBui
 
   // If the config state provided an ObjectLinkingLayer factory then use it.
   if (S.CreateObjectLinkingLayer)
-    return S.CreateObjectLinkingLayer(ES);
+    return S.CreateObjectLinkingLayer(ES, S.JTMB->getTargetTriple());
 
   // Otherwise default to creating an RTDyldObjectLinkingLayer that constructs
   // a new SectionMemoryManager for each object.
   auto GetMemMgr = []() { return llvm::make_unique<SectionMemoryManager>(); };
-  return llvm::make_unique<RTDyldObjectLinkingLayer>(ES, std::move(GetMemMgr));
+  auto ObjLinkingLayer =
+      llvm::make_unique<RTDyldObjectLinkingLayer>(ES, std::move(GetMemMgr));
+
+  if (S.JTMB->getTargetTriple().isOSBinFormatCOFF())
+    ObjLinkingLayer->setOverrideObjectFlagsWithResponsibilityFlags(true);
+
+  return ObjLinkingLayer;
 }
 
 Expected<IRCompileLayer::CompileFunction>




More information about the llvm-commits mailing list