mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 10:36:06 +00:00
initial work on relocations
This commit is contained in:
parent
bc2facaee4
commit
6717482662
|
@ -78,6 +78,7 @@ Module* Linker::LoadModule(const std::string& elf_name)
|
|||
LoadModuleToMemory(m);
|
||||
LoadDynamicInfo(m);
|
||||
LoadSymbols(m);
|
||||
Relocate(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -495,4 +496,25 @@ void Linker::LoadSymbols(Module* m)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void Linker::Relocate(Module* m)
|
||||
{
|
||||
u32 idx = 0;
|
||||
for (auto* rel = m->dynamic_info->relocation_table; reinterpret_cast<u08*>(rel) < reinterpret_cast<u08*>(m->dynamic_info->relocation_table) + m->dynamic_info->relocation_table_size; rel++, idx++)
|
||||
{
|
||||
auto type = rel->GetType();
|
||||
auto symbol = rel->GetSymbol();
|
||||
auto addend = rel->rel_addend;
|
||||
|
||||
LOG_INFO_IF(debug_loader, "rel type {:#010x} rel symbol : {:#010x}\n", type, symbol);
|
||||
}
|
||||
idx = 0;
|
||||
for (auto* rel = m->dynamic_info->jmp_relocation_table; reinterpret_cast<u08*>(rel) < reinterpret_cast<u08*>(m->dynamic_info->jmp_relocation_table) + m->dynamic_info->jmp_relocation_table_size; rel++, idx++)
|
||||
{
|
||||
auto type = rel->GetType();
|
||||
auto symbol = rel->GetSymbol();
|
||||
auto addend = rel->rel_addend;
|
||||
|
||||
LOG_INFO_IF(debug_loader, "jmprel type {:#010x} rel symbol : {:#010x}\n", type, symbol);
|
||||
}
|
||||
}
|
|
@ -110,6 +110,7 @@ public:
|
|||
void LoadDynamicInfo(Module* m);
|
||||
void LoadSymbols(Module* m);
|
||||
SymbolsResolver* getHLESymbols() { return m_HLEsymbols; }
|
||||
void Relocate(Module* m);
|
||||
|
||||
private:
|
||||
const ModuleInfo* FindModule(const Module& m, const std::string& id);
|
||||
|
|
|
@ -435,6 +435,9 @@ struct elf_symbol
|
|||
|
||||
struct elf_relocation
|
||||
{
|
||||
u32 GetSymbol() const { return static_cast<u32>(rel_info >> 32u); }
|
||||
u32 GetType() const { return static_cast<u32>(rel_info & 0xffffffff); }
|
||||
|
||||
u64 rel_offset;
|
||||
u64 rel_info;
|
||||
s64 rel_addend;
|
||||
|
|
Loading…
Reference in a new issue