From 11bf9d7928506a11ed112cbe787a3894d90e45c9 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Mon, 19 Jun 2023 06:58:22 +0300 Subject: [PATCH] elf symbols , bind ,type ,visibility --- src/Core/PS4/Linker.cpp | 6 ++++-- src/Loader/Elf.h | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Core/PS4/Linker.cpp b/src/Core/PS4/Linker.cpp index d269a138..8e2d33ec 100644 --- a/src/Core/PS4/Linker.cpp +++ b/src/Core/PS4/Linker.cpp @@ -422,10 +422,12 @@ void Linker::LoadSymbols(Module* m) { const auto* library = FindLibrary(*m, ids.at(1)); const auto* module = FindModule(*m, ids.at(2)); - + auto bind = sym->GetBind(); + auto type = sym->GetType(); + auto visibility = sym->GetVisibility(); if (library != nullptr || module != nullptr) { - LOG_INFO_IF(debug_loader, "name {} library {} module {}\n", ids.at(0),library->name,module->name); + LOG_INFO_IF(debug_loader, "name {} library {} module {} bind {} type {} visibility {}\n", ids.at(0),library->name,module->name,bind,type,visibility); } } } diff --git a/src/Loader/Elf.h b/src/Loader/Elf.h index d13e3e1d..0e00f13e 100644 --- a/src/Loader/Elf.h +++ b/src/Loader/Elf.h @@ -396,8 +396,35 @@ struct elf_dynamic } d_un; }; +constexpr u08 STB_LOCAL = 0; +constexpr u08 STB_GLOBAL = 1; +constexpr u08 STB_WEAK = 2; + +constexpr u08 STT_NOTYPE = 0; +constexpr u08 STT_OBJECT = 1; +constexpr u08 STT_FUN = 2; +constexpr u08 STT_SECTION = 3; +constexpr u08 STT_FILE = 4; +constexpr u08 STT_COMMON = 5; +constexpr u08 STT_TLS = 6; +constexpr u08 STT_LOOS = 10; +constexpr u08 STT_SCE = 11; //module_start/module_stop +constexpr u08 STT_HIOS = 12; +constexpr u08 STT_LOPRO = 13; +constexpr u08 STT_SPARC_REGISTER = 13; +constexpr u08 STT_HIPROC = 15; + +constexpr u08 STV_DEFAULT = 0; +constexpr u08 STV_INTERNAL = 1; +constexpr u08 STV_HIDDEN = 2; +constexpr u08 STV_PROTECTED = 3; + struct elf_symbol { + u08 GetBind() const { return st_info >> 4u; } + u08 GetType() const { return st_info & 0xfu; } + u08 GetVisibility() const { return st_other & 3u; } + u32 st_name; u08 st_info; u08 st_other;