elf symbols , bind ,type ,visibility

This commit is contained in:
georgemoralis 2023-06-19 06:58:22 +03:00
parent f333098231
commit 11bf9d7928
2 changed files with 31 additions and 2 deletions

View File

@ -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);
}
}
}

View File

@ -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;