From d2371c2edabb7d70c2b31150bfa0e46d7acd1e5e Mon Sep 17 00:00:00 2001 From: kat Date: Wed, 12 Mar 2025 18:54:51 -0400 Subject: Add API for BinaryView::FinalizeNewSegments --- binaryninjaapi.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 2e4ec080..5fc2f5a6 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -5123,6 +5123,19 @@ namespace BinaryNinja { */ bool Save(const std::string& path); + /*! Performs "finalization" on segments added after initial Finalization (performed after an Init() has completed). + + Finalizing a segment involves optimizing the relocation info stored in that segment, so if a segment is added + and relocations are defined for that segment by some automated process, this function should be called afterwards. + + An example of this can be seen in the KernelCache plugin, in `KernelCache::LoadImageWithInstallName`. + After we load an image, map new segments, and define relocations for all of them, we call this function + to let core know it is now safe to finalize the new segments + + \return Whether finalization was successful. + */ + bool FinalizeNewSegments(); + void DefineRelocation(Architecture* arch, BNRelocationInfo& info, uint64_t target, uint64_t reloc); void DefineRelocation(Architecture* arch, BNRelocationInfo& info, Ref target, uint64_t reloc); std::vector> GetRelocationRanges() const; -- cgit v1.3.1