From 8932be618b155e9b33c60bf181d9c0eb64c046b5 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Thu, 8 Jun 2023 13:25:24 +0300 Subject: [PATCH] parsing DT_OS_HASHZ, DT_OS_STRTAB , DT_OS_STRSZ for dynamic loader --- src/Core/PS4/Linker.cpp | 9 +++++++++ src/Core/PS4/Linker.h | 4 ++++ src/Loader/Elf.h | 3 +++ 3 files changed, 16 insertions(+) diff --git a/src/Core/PS4/Linker.cpp b/src/Core/PS4/Linker.cpp index 8476bdbb..2365509d 100644 --- a/src/Core/PS4/Linker.cpp +++ b/src/Core/PS4/Linker.cpp @@ -171,6 +171,15 @@ void Linker::LoadDynamicInfo(Module* m) case DT_OS_HASH: m->dynamic_info->hash_table = reinterpret_cast(static_cast(m->m_dynamic_data) + dyn->d_un.d_ptr); break; + case DT_OS_HASHSZ: + m->dynamic_info->hash_table_size = dyn->d_un.d_val; + break; + case DT_OS_STRTAB: + m->dynamic_info->str_table = reinterpret_cast(static_cast(m->m_dynamic_data) + dyn->d_un.d_ptr); + break; + case DT_OS_STRSZ: + m->dynamic_info->str_table_size = dyn->d_un.d_val; + 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 7add71c2..38fbd38b 100644 --- a/src/Core/PS4/Linker.h +++ b/src/Core/PS4/Linker.h @@ -19,6 +19,10 @@ struct Module struct DynamicModuleInfo { void* hash_table = nullptr; + u64 hash_table_size = 0; + + char* str_table = nullptr; + u64 str_table_size = 0; }; class Linker diff --git a/src/Loader/Elf.h b/src/Loader/Elf.h index b425e794..cf1e7df8 100644 --- a/src/Loader/Elf.h +++ b/src/Loader/Elf.h @@ -326,6 +326,9 @@ struct elf_program_id_header constexpr s64 DT_NULL = 0; constexpr s64 DT_OS_HASH = 0x61000025; +constexpr s64 DT_OS_HASHSZ = 0x6100003d; +constexpr s64 DT_OS_STRTAB = 0x61000035; +constexpr s64 DT_OS_STRSZ = 0x61000037; struct elf_dynamic {