diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp index 32792138220..9821e3176d8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp @@ -279,6 +279,7 @@ private: static LPJit* jit; std::unique_ptr lljit; + std::unique_ptr tm_unique; /* avoid name conflict */ unsigned jit_dylib_count; @@ -318,7 +319,8 @@ LPJit::LPJit() :jit_dylib_count(0) { init_native_targets(); JITTargetMachineBuilder JTMB = create_jtdb(); - tm = wrap(ExitOnErr(JTMB.createTargetMachine()).release()); + tm_unique = ExitOnErr(JTMB.createTargetMachine()); + tm = wrap(tm_unique.get()); /* Create an LLJIT instance with an ObjectLinkingLayer (JITLINK) * or RuntimeDyld as the base layer.