diff --git a/src/Core/PS4/Linker.cpp b/src/Core/PS4/Linker.cpp index 75fa89b1..95f877d4 100644 --- a/src/Core/PS4/Linker.cpp +++ b/src/Core/PS4/Linker.cpp @@ -221,6 +221,31 @@ void Linker::LoadDynamicInfo(Module* m) LOG_WARN_IF(debug_loader, "DT_SCE_RELAENT is NOT 0x18 should check!"); } break; + case DT_INIT_ARRAY: + m->dynamic_info->init_array_virtual_addr = dyn->d_un.d_ptr; + break; + case DT_FINI_ARRAY: + m->dynamic_info->fini_array_virtual_addr = dyn->d_un.d_ptr; + break; + case DT_INIT_ARRAYSZ: + m->dynamic_info->init_array_size = dyn->d_un.d_val; + break; + case DT_FINI_ARRAYSZ: + m->dynamic_info->fini_array_size = dyn->d_un.d_val; + break; + case DT_PREINIT_ARRAY: + m->dynamic_info->preinit_array_virtual_addr = dyn->d_un.d_ptr; + break; + case DT_PREINIT_ARRAYSZ: + m->dynamic_info->preinit_array_size = dyn->d_un.d_val; + break; + case DT_SCE_SYMENT: //The size of symbol table entries + m->dynamic_info->symbol_table_entries_size = dyn->d_un.d_val; + if (m->dynamic_info->symbol_table_entries_size != 0x18) //this value should always be 0x18 + { + LOG_WARN_IF(debug_loader, "DT_SCE_SYMENT is NOT 0x18 should check!"); + } + break; default: LOG_INFO_IF(debug_loader, "unsupported dynamic tag ..........: {:#018x}\n", dyn->d_tag); } diff --git a/src/Core/PS4/Linker.h b/src/Core/PS4/Linker.h index 09c6a2f3..09abe4b4 100644 --- a/src/Core/PS4/Linker.h +++ b/src/Core/PS4/Linker.h @@ -26,10 +26,17 @@ struct DynamicModuleInfo elf_symbol* symbol_table = nullptr; u64 symbol_table_total_size = 0; + u64 symbol_table_entries_size = 0; u64 init_virtual_addr = 0; u64 fini_virtual_addr = 0; u64 pltgot_virtual_addr = 0; + u64 init_array_virtual_addr = 0; + u64 fini_array_virtual_addr = 0; + u64 preinit_array_virtual_addr = 0; + u64 init_array_size = 0; + u64 fini_array_size = 0; + u64 preinit_array_size = 0; elf_relocation* jmp_relocation_table = nullptr; u64 jmp_relocation_table_size = 0; diff --git a/src/Loader/Elf.h b/src/Loader/Elf.h index 9568b2d7..558c9748 100644 --- a/src/Loader/Elf.h +++ b/src/Loader/Elf.h @@ -324,23 +324,30 @@ struct elf_program_id_header u08 digest[32]; }; -constexpr s64 DT_NULL = 0; -constexpr s64 DT_RELA = 0x00000007; -constexpr s64 DT_INIT = 0x0000000c; -constexpr s64 DT_FINI = 0x0000000d; -constexpr s64 DT_SCE_HASH = 0x61000025; -constexpr s64 DT_SCE_PLTGOT = 0x61000027; -constexpr s64 DT_SCE_JMPREL = 0x61000029; -constexpr s64 DT_SCE_PLTREL = 0x6100002b; -constexpr s64 DT_SCE_PLTRELSZ = 0x6100002d; -constexpr s64 DT_SCE_RELA = 0x6100002f; -constexpr s64 DT_SCE_RELASZ = 0x61000031; -constexpr s64 DT_SCE_RELAENT = 0x61000033; -constexpr s64 DT_SCE_HASHSZ = 0x6100003d; -constexpr s64 DT_SCE_STRTAB = 0x61000035; -constexpr s64 DT_SCE_STRSZ = 0x61000037; -constexpr s64 DT_SCE_SYMTAB = 0x61000039; -constexpr s64 DT_SCE_SYMTABSZ = 0x6100003f; +constexpr s64 DT_NULL = 0; +constexpr s64 DT_RELA = 0x00000007; +constexpr s64 DT_INIT = 0x0000000c; +constexpr s64 DT_FINI = 0x0000000d; +constexpr s64 DT_INIT_ARRAY = 0x00000019; +constexpr s64 DT_FINI_ARRAY = 0x0000001a; +constexpr s64 DT_INIT_ARRAYSZ = 0x0000001b; +constexpr s64 DT_FINI_ARRAYSZ = 0x0000001c; +constexpr s64 DT_PREINIT_ARRAY = 0x00000020; +constexpr s64 DT_PREINIT_ARRAYSZ = 0x00000021; +constexpr s64 DT_SCE_HASH = 0x61000025; +constexpr s64 DT_SCE_PLTGOT = 0x61000027; +constexpr s64 DT_SCE_JMPREL = 0x61000029; +constexpr s64 DT_SCE_PLTREL = 0x6100002b; +constexpr s64 DT_SCE_PLTRELSZ = 0x6100002d; +constexpr s64 DT_SCE_RELA = 0x6100002f; +constexpr s64 DT_SCE_RELASZ = 0x61000031; +constexpr s64 DT_SCE_RELAENT = 0x61000033; +constexpr s64 DT_SCE_SYMENT = 0x6100003b; +constexpr s64 DT_SCE_HASHSZ = 0x6100003d; +constexpr s64 DT_SCE_STRTAB = 0x61000035; +constexpr s64 DT_SCE_STRSZ = 0x61000037; +constexpr s64 DT_SCE_SYMTAB = 0x61000039; +constexpr s64 DT_SCE_SYMTABSZ = 0x6100003f; struct elf_dynamic