added DT_INIT_ARRAY, DT_FINI_ARRAY,DT_INIT_ARRAYSZ,DT_FINI_ARRAYSZ,DT_PREINIT_ARRAY,DT_PREINIT_ARRAYSZ,DT_SCE_SYMENT

This commit is contained in:
georgemoralis 2023-06-09 13:37:46 +03:00
parent dd4dddded3
commit 94dff9b980
3 changed files with 56 additions and 17 deletions

View File

@ -221,6 +221,31 @@ void Linker::LoadDynamicInfo(Module* m)
LOG_WARN_IF(debug_loader, "DT_SCE_RELAENT is NOT 0x18 should check!"); LOG_WARN_IF(debug_loader, "DT_SCE_RELAENT is NOT 0x18 should check!");
} }
break; 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: default:
LOG_INFO_IF(debug_loader, "unsupported dynamic tag ..........: {:#018x}\n", dyn->d_tag); LOG_INFO_IF(debug_loader, "unsupported dynamic tag ..........: {:#018x}\n", dyn->d_tag);
} }

View File

@ -26,10 +26,17 @@ struct DynamicModuleInfo
elf_symbol* symbol_table = nullptr; elf_symbol* symbol_table = nullptr;
u64 symbol_table_total_size = 0; u64 symbol_table_total_size = 0;
u64 symbol_table_entries_size = 0;
u64 init_virtual_addr = 0; u64 init_virtual_addr = 0;
u64 fini_virtual_addr = 0; u64 fini_virtual_addr = 0;
u64 pltgot_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; elf_relocation* jmp_relocation_table = nullptr;
u64 jmp_relocation_table_size = 0; u64 jmp_relocation_table_size = 0;

View File

@ -328,6 +328,12 @@ constexpr s64 DT_NULL = 0;
constexpr s64 DT_RELA = 0x00000007; constexpr s64 DT_RELA = 0x00000007;
constexpr s64 DT_INIT = 0x0000000c; constexpr s64 DT_INIT = 0x0000000c;
constexpr s64 DT_FINI = 0x0000000d; 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_HASH = 0x61000025;
constexpr s64 DT_SCE_PLTGOT = 0x61000027; constexpr s64 DT_SCE_PLTGOT = 0x61000027;
constexpr s64 DT_SCE_JMPREL = 0x61000029; constexpr s64 DT_SCE_JMPREL = 0x61000029;
@ -336,6 +342,7 @@ constexpr s64 DT_SCE_PLTRELSZ = 0x6100002d;
constexpr s64 DT_SCE_RELA = 0x6100002f; constexpr s64 DT_SCE_RELA = 0x6100002f;
constexpr s64 DT_SCE_RELASZ = 0x61000031; constexpr s64 DT_SCE_RELASZ = 0x61000031;
constexpr s64 DT_SCE_RELAENT = 0x61000033; constexpr s64 DT_SCE_RELAENT = 0x61000033;
constexpr s64 DT_SCE_SYMENT = 0x6100003b;
constexpr s64 DT_SCE_HASHSZ = 0x6100003d; constexpr s64 DT_SCE_HASHSZ = 0x6100003d;
constexpr s64 DT_SCE_STRTAB = 0x61000035; constexpr s64 DT_SCE_STRTAB = 0x61000035;
constexpr s64 DT_SCE_STRSZ = 0x61000037; constexpr s64 DT_SCE_STRSZ = 0x61000037;