Index: lib/ExecutionEngine/Orc/IndirectionUtils.cpp =================================================================== --- lib/ExecutionEngine/Orc/IndirectionUtils.cpp +++ lib/ExecutionEngine/Orc/IndirectionUtils.cpp @@ -54,7 +54,11 @@ std::function()> createLocalIndirectStubsManagerBuilder(const Triple &T) { switch (T.getArch()) { - default: return nullptr; + default: + return [](){ + return llvm::make_unique< + orc::LocalIndirectStubsManager>(); + }; case Triple::aarch64: return [](){ Index: unittests/ExecutionEngine/Orc/OrcCAPITest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/OrcCAPITest.cpp +++ unittests/ExecutionEngine/Orc/OrcCAPITest.cpp @@ -86,7 +86,7 @@ char *OrcCAPIExecutionTest::testFuncName = nullptr; TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) { - if (!TM) + if (!SupportsJIT) return; LLVMOrcJITStackRef JIT = @@ -112,7 +112,7 @@ } TEST_F(OrcCAPIExecutionTest, TestLazyIRCompilation) { - if (!TM) + if (!SupportsIndirection) return; LLVMOrcJITStackRef JIT = @@ -138,7 +138,7 @@ } TEST_F(OrcCAPIExecutionTest, TestAddObjectFile) { - if (!TM) + if (!SupportsJIT) return; auto ObjBuffer = createTestObject(); @@ -163,7 +163,7 @@ } TEST_F(OrcCAPIExecutionTest, TestDirectCallbacksAPI) { - if (!TM) + if (!SupportsIndirection) return; LLVMOrcJITStackRef JIT = Index: unittests/ExecutionEngine/Orc/OrcTestCommon.h =================================================================== --- unittests/ExecutionEngine/Orc/OrcTestCommon.h +++ unittests/ExecutionEngine/Orc/OrcTestCommon.h @@ -17,6 +17,7 @@ #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/JITSymbol.h" +#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h" #include "llvm/IR/Function.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/LLVMContext.h" @@ -24,6 +25,7 @@ #include "llvm/IR/TypeBuilder.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/TargetSelect.h" +#include "llvm/Support/TargetRegistry.h" #include namespace llvm { @@ -59,15 +61,20 @@ // If we found a TargetMachine, check that it's one that Orc supports. const Triple& TT = TM->getTargetTriple(); - if ((TT.getArch() != Triple::x86_64 && TT.getArch() != Triple::x86) || - TT.isOSWindows()) - TM = nullptr; + // Target can JIT? + SupportsJIT = TM->getTarget().hasJIT(); + // Use ability to create callback manager to detect whether Orc + // has indirection support on this platform. This way the test + // and Orc code do not get out of sync. + SupportsIndirection = !!orc::createLocalCompileCallbackManager(TT, 0); } }; protected: LLVMContext Context; std::unique_ptr TM; + bool SupportsJIT = false; + bool SupportsIndirection = false; }; class ModuleBuilder { Index: unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp +++ unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp @@ -121,7 +121,7 @@ } TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) { - if (!TM) + if (!SupportsJIT) return; SymbolStringPool SSP; @@ -206,7 +206,7 @@ } TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) { - if (!TM) + if (!SupportsJIT) return; SymbolStringPool SSP;