From 365ae2aac987c8a2acd4f0a2c81fea52f4d4d5d2 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 26 Mar 2024 00:21:38 +0200 Subject: [PATCH] some elf improvements --- src/core/linker.h | 7 +++++++ src/core/loader/elf.cpp | 4 ++++ src/core/loader/elf.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/core/linker.h b/src/core/linker.h index 9d97648a..d9833852 100644 --- a/src/core/linker.h +++ b/src/core/linker.h @@ -20,6 +20,10 @@ struct EntryParams { }; struct ModuleInfo { + bool operator==(const ModuleInfo& other) const { + return version_major == other.version_major && version_minor == other.version_minor && + name == other.name; + } std::string name; union { u64 value; @@ -34,6 +38,9 @@ struct ModuleInfo { }; struct LibraryInfo { + bool operator==(const LibraryInfo& other) const { + return version == other.version && name == other.name; + } std::string name; union { u64 value; diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 2e6dd60d..0b58880a 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -538,4 +538,8 @@ void Elf::LoadSegment(u64 virtual_addr, u64 file_offset, u64 size) { UNREACHABLE(); } +bool Elf::IsSharedLib() { + return m_elf_header.e_type == ET_SCE_DYNAMIC; +} + } // namespace Core::Loader diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index 3a8df6be..b2d2ea59 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h @@ -490,6 +490,7 @@ public: std::string ElfPheaderFlagsStr(u32 flags); void LoadSegment(u64 virtual_addr, u64 file_offset, u64 size); + bool IsSharedLib(); private: Common::FS::IOFile m_f{};