Skip to content

Commit b7e50df

Browse files
[lli] Mimic default LLJIT logic with explicit --jit-linker option (llvm#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()`.
1 parent c458f92 commit b7e50df

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/tools/lli/lli.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,9 +965,12 @@ int runOrcJIT(const char *ProgName) {
965965
EPC = ExitOnErr(orc::SelfExecutorProcessControl::Create(
966966
std::make_shared<orc::SymbolStringPool>()));
967967

968-
Builder.setObjectLinkingLayerCreator([&EPC, &P](orc::ExecutionSession &ES,
969-
const Triple &TT) {
970-
auto L = std::make_unique<orc::ObjectLinkingLayer>(ES, EPC->getMemMgr());
968+
Builder.getJITTargetMachineBuilder()
969+
->setRelocationModel(Reloc::PIC_)
970+
.setCodeModel(CodeModel::Small);
971+
Builder.setObjectLinkingLayerCreator([&P](orc::ExecutionSession &ES,
972+
const Triple &TT) {
973+
auto L = std::make_unique<orc::ObjectLinkingLayer>(ES);
971974
if (P != LLJITPlatform::ExecutorNative)
972975
L->addPlugin(std::make_unique<orc::EHFrameRegistrationPlugin>(
973976
ES, ExitOnErr(orc::EPCEHFrameRegistrar::Create(ES))));

0 commit comments

Comments
 (0)