[Orc][LLJIT] Re-apply 298e183e813 (use JITLink for LLJIT where supported).
Patch d9220b580b3 fixed the underlying issue that casued 298e183e813 to fail.
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 5c39373..54473ab 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -24,11 +24,15 @@
JTMB = std::move(*JTMBOrErr);
else
return JTMBOrErr.takeError();
+ }
- // If no ObjectLinkingLayer creator was set and the target supports JITLink
- // then configure for JITLink.
+ // If the client didn't configure any linker options then auto-configure the
+ // JIT linker.
+ if (!CreateObjectLinkingLayer && JTMB->getCodeModel() == None &&
+ JTMB->getRelocationModel() == None) {
+
auto &TT = JTMB->getTargetTriple();
- if (!CreateObjectLinkingLayer && TT.isOSBinFormatMachO() &&
+ if (TT.isOSBinFormatMachO() &&
(TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64)) {
JTMB->setRelocationModel(Reloc::PIC_);