diff --git a/src/zipr.cpp b/src/zipr.cpp index 7c636fa2f391d65bcc27f16462734bb0667c9913..143c701c5696412f57a8ee86874291b746779190 100644 --- a/src/zipr.cpp +++ b/src/zipr.cpp @@ -827,16 +827,15 @@ void ZiprImpl_t::PlaceDollops() /* * used to check if a reference dollop needs to be added to the placement queue */ - const auto handle_reloc=[&](const Relocation_t* reloc) + const auto ensure_insn_is_placed=[&](Instruction_t* insn) { - auto wrt_insn=dynamic_cast<Instruction_t*>(reloc->getWRT()); - if(wrt_insn) + if(insn != nullptr) { - auto containing=m_dollop_mgr.getContainingDollop(wrt_insn); + auto containing=m_dollop_mgr.addNewDollops(insn); assert(containing!=nullptr); if(!containing->isPlaced()) { - placement_queue.insert({containing, wrt_insn->getAddress()->getVirtualOffset()}); + placement_queue.insert({containing, insn->getAddress()->getVirtualOffset()}); } } }; @@ -844,7 +843,13 @@ void ZiprImpl_t::PlaceDollops() // Make sure each instruction referenced in a relocation (regardless // of if that relocation is on an instruction or a scoop) gets placed. for(const auto &reloc : m_firp->getRelocations()) - handle_reloc(reloc); + ensure_insn_is_placed(dynamic_cast<Instruction_t*>(reloc->getWRT())); + + // Make sure each landing pad in a program gets placed. + for(const auto &cs : m_firp->getAllEhCallSites()) + ensure_insn_is_placed(cs->getLandingPad()); + + m_dollop_mgr.UpdateAllTargets(); while (!placement_queue.empty()) { diff --git a/src/zipr_dollop_man.cpp b/src/zipr_dollop_man.cpp index 72582ba43f370194c74eba6d3fc8e2f758555993..c7c374f9391860272aeba1b27d73eed76981afd0 100644 --- a/src/zipr_dollop_man.cpp +++ b/src/zipr_dollop_man.cpp @@ -159,11 +159,10 @@ namespace zipr { } } - Zipr_SDK::Dollop_t *ZiprDollopManager_t::getContainingDollop(IRDB_SDK::Instruction_t *insn) { - InsnToDollopMap_t::iterator it=m_insn_to_dollop.find(insn); - if(it!=m_insn_to_dollop.end()) - return it->second; - return nullptr; + Zipr_SDK::Dollop_t *ZiprDollopManager_t::getContainingDollop(IRDB_SDK::Instruction_t *insn) + { + const auto it=m_insn_to_dollop.find(insn); + return it!=m_insn_to_dollop.end() ? it->second : nullptr; }