[llvm] b7e50df - [lli] Mimic default LLJIT logic with explicit --jit-linker option (#76964)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 02:54:56 PST 2024


Author: Stefan Gränitz
Date: 2024-01-05T11:54:52+01:00
New Revision: b7e50df0262a9e563bc908e2bea06cd839a42140

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

LOG: [lli] Mimic default LLJIT logic with explicit --jit-linker option (#76964)

Forcing the JITLinker to the default configuration shouldn't affect the
configuration of the JIT. Since it's implemented by setting the
ObjectLinkingLayerCreator, it did have side-effects though. In
particular, we skipped the Code- and RelocationModel setting in
`LLJITBuilderState::prepareForConstruction()`.

Added: 
    

Modified: 
    llvm/tools/lli/lli.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 5f1fd15787642a..8a7ea2d3d0c582 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -965,9 +965,12 @@ int runOrcJIT(const char *ProgName) {
     EPC = ExitOnErr(orc::SelfExecutorProcessControl::Create(
         std::make_shared<orc::SymbolStringPool>()));
 
-    Builder.setObjectLinkingLayerCreator([&EPC, &P](orc::ExecutionSession &ES,
-                                                    const Triple &TT) {
-      auto L = std::make_unique<orc::ObjectLinkingLayer>(ES, EPC->getMemMgr());
+    Builder.getJITTargetMachineBuilder()
+        ->setRelocationModel(Reloc::PIC_)
+        .setCodeModel(CodeModel::Small);
+    Builder.setObjectLinkingLayerCreator([&P](orc::ExecutionSession &ES,
+                                              const Triple &TT) {
+      auto L = std::make_unique<orc::ObjectLinkingLayer>(ES);
       if (P != LLJITPlatform::ExecutorNative)
         L->addPlugin(std::make_unique<orc::EHFrameRegistrationPlugin>(
             ES, ExitOnErr(orc::EPCEHFrameRegistrar::Create(ES))));


        


More information about the llvm-commits mailing list