diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp index 21661a0..2063806 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp @@ -89,13 +89,17 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes, Triple AMDGPUTriple(sys::getDefaultTargetTriple()); + static bool init = false; + if (!init) { LLVMInitializeAMDGPUTargetInfo(); LLVMInitializeAMDGPUTarget(); LLVMInitializeAMDGPUTargetMC(); LLVMInitializeAMDGPUAsmPrinter(); + init = true; + } std::string err; - const Target * AMDGPUTarget = TargetRegistry::lookupTarget("r600", err); + static const Target * AMDGPUTarget = TargetRegistry::lookupTarget("r600", err); if(!AMDGPUTarget) { fprintf(stderr, "Can't find target: %s\n", err.c_str()); return 1;