Check if function call is within the same section.

This commit is contained in:
Skyth 2024-09-18 22:33:45 +03:00
parent 39a0b6ab4d
commit 476dfb5307

View File

@ -183,9 +183,9 @@ int main(int argc, char* argv[])
{ {
size_t address = base + (data - section.data) + PPC_BI(insn); size_t address = base + (data - section.data) + PPC_BI(insn);
if (image.symbols.find(address) == image.symbols.end()) if (address >= section.base && address < section.base + section.size && image.symbols.find(address) == image.symbols.end())
{ {
auto& fn = functions.emplace_back(Function::Analyze(section.data + address - section.base, section.size - (address - section.base), address)); auto& fn = functions.emplace_back(Function::Analyze(section.data + address - section.base, section.base + section.size - address, address));
hardcodedFuncCheck(fn); hardcodedFuncCheck(fn);
image.symbols.emplace(std::format("sub_{:X}", fn.base), fn.base, fn.size, Symbol_Function); image.symbols.emplace(std::format("sub_{:X}", fn.base), fn.base, fn.size, Symbol_Function);
} }