diff --git a/rpcs3/Emu/CPU/CPUTranslator.h b/rpcs3/Emu/CPU/CPUTranslator.h index f1625ed18a..4fe43b0a95 100644 --- a/rpcs3/Emu/CPU/CPUTranslator.h +++ b/rpcs3/Emu/CPU/CPUTranslator.h @@ -2458,7 +2458,7 @@ public: #ifdef _WIN32 func->setCallingConv(llvm::CallingConv::Win64); #endif - m_engine->addGlobalMapping({lame.data(), lame.size()}, reinterpret_cast(_func)); + m_engine->updateGlobalMapping({lame.data(), lame.size()}, reinterpret_cast(_func)); const auto inst = m_ir->CreateCall(func, {args...}); #ifdef _WIN32 diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index f430058b07..377a2d420d 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -3407,7 +3407,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator // Register under a unique linkable name const std::string ppname = fmt::format("%s-pp-%u", m_hash, m_pp_id++); - m_engine->addGlobalMapping(ppname, (u64)m_spurt->make_branch_patchpoint()); + m_engine->updateGlobalMapping(ppname, reinterpret_cast(m_spurt->make_branch_patchpoint())); // Create function with not exactly correct type const auto ppfunc = llvm::cast(m_module->getOrInsertFunction(ppname, m_finfo->chunk->getFunctionType()).getCallee()); @@ -4232,6 +4232,8 @@ public: using namespace llvm; + m_engine->clearAllGlobalMappings(); + // Create LLVM module std::unique_ptr module = std::make_unique(m_hash + ".obj", m_context); module->setTargetTriple(Triple::normalize("x86_64-unknown-linux-gnu")); @@ -4386,7 +4388,7 @@ public: entry_call->setCallingConv(entry_chunk->chunk->getCallingConv()); const auto dispatcher = llvm::cast(m_module->getOrInsertFunction("spu_dispatcher", main_func->getType()).getCallee()); - m_engine->addGlobalMapping("spu_dispatcher", reinterpret_cast(spu_runtime::tr_all)); + m_engine->updateGlobalMapping("spu_dispatcher", reinterpret_cast(spu_runtime::tr_all)); dispatcher->setCallingConv(main_func->getCallingConv()); // Proceed to the next code @@ -4663,7 +4665,7 @@ public: if (false && g_cfg.core.spu_verification) { const std::string ppname = fmt::format("%s-chunkpp-0x%05x", m_hash, i); - m_engine->addGlobalMapping(ppname, (u64)m_spurt->make_branch_patchpoint(i / 4)); + m_engine->updateGlobalMapping(ppname, reinterpret_cast(m_spurt->make_branch_patchpoint(i / 4))); const auto ppfunc = llvm::cast(m_module->getOrInsertFunction(ppname, m_finfo->chunk->getFunctionType()).getCallee()); ppfunc->setCallingConv(m_finfo->chunk->getCallingConv()); @@ -4836,6 +4838,8 @@ public: { using namespace llvm; + m_engine->clearAllGlobalMappings(); + // Create LLVM module std::unique_ptr module = std::make_unique("spu_interpreter.obj", m_context); module->setTargetTriple(Triple::normalize("x86_64-unknown-linux-gnu"));