mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
LibELF: Use correct accessor macros on x86_64 for some ELF fields
This commit is contained in:
parent
c81d959afb
commit
2eb025b2ea
Notes:
sideshowbarker
2024-07-18 11:20:31 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/2eb025b2eae Pull-request: https://github.com/SerenityOS/serenity/pull/8317
2 changed files with 64 additions and 8 deletions
|
@ -63,10 +63,24 @@ public:
|
|||
unsigned value() const { return m_sym.st_value; }
|
||||
unsigned size() const { return m_sym.st_size; }
|
||||
unsigned index() const { return m_index; }
|
||||
unsigned type() const { return ELF32_ST_TYPE(m_sym.st_info); }
|
||||
#if ARCH(I386)
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF32_ST_TYPE(m_sym.st_info);
|
||||
}
|
||||
unsigned bind() const { return ELF32_ST_BIND(m_sym.st_info); }
|
||||
#else
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF64_ST_TYPE(m_sym.st_info);
|
||||
}
|
||||
unsigned bind() const { return ELF64_ST_BIND(m_sym.st_info); }
|
||||
#endif
|
||||
|
||||
bool is_undefined() const { return section_index() == 0; }
|
||||
bool is_undefined() const
|
||||
{
|
||||
return section_index() == 0;
|
||||
}
|
||||
|
||||
VirtualAddress address() const
|
||||
{
|
||||
|
@ -146,9 +160,23 @@ public:
|
|||
|
||||
unsigned offset_in_section() const { return m_offset_in_section; }
|
||||
unsigned offset() const { return m_rel.r_offset; }
|
||||
unsigned type() const { return ELF32_R_TYPE(m_rel.r_info); }
|
||||
#if ARCH(I386)
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF32_R_TYPE(m_rel.r_info);
|
||||
}
|
||||
unsigned symbol_index() const { return ELF32_R_SYM(m_rel.r_info); }
|
||||
Symbol symbol() const { return m_dynamic.symbol(symbol_index()); }
|
||||
#else
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF64_R_TYPE(m_rel.r_info);
|
||||
}
|
||||
unsigned symbol_index() const { return ELF64_R_SYM(m_rel.r_info); }
|
||||
#endif
|
||||
Symbol symbol() const
|
||||
{
|
||||
return m_dynamic.symbol(symbol_index());
|
||||
}
|
||||
VirtualAddress address() const
|
||||
{
|
||||
if (m_dynamic.elf_is_dynamic())
|
||||
|
|
|
@ -54,9 +54,23 @@ public:
|
|||
unsigned value() const { return m_sym.st_value; }
|
||||
unsigned size() const { return m_sym.st_size; }
|
||||
unsigned index() const { return m_index; }
|
||||
unsigned type() const { return ELF32_ST_TYPE(m_sym.st_info); }
|
||||
#if ARCH(I386)
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF32_ST_TYPE(m_sym.st_info);
|
||||
}
|
||||
unsigned bind() const { return ELF32_ST_BIND(m_sym.st_info); }
|
||||
Section section() const { return m_image.section(section_index()); }
|
||||
#else
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF64_ST_TYPE(m_sym.st_info);
|
||||
}
|
||||
unsigned bind() const { return ELF64_ST_BIND(m_sym.st_info); }
|
||||
#endif
|
||||
Section section() const
|
||||
{
|
||||
return m_image.section(section_index());
|
||||
}
|
||||
bool is_undefined() const { return section_index() == 0; }
|
||||
StringView raw_data() const;
|
||||
|
||||
|
@ -151,9 +165,23 @@ public:
|
|||
~Relocation() { }
|
||||
|
||||
unsigned offset() const { return m_rel.r_offset; }
|
||||
unsigned type() const { return ELF32_R_TYPE(m_rel.r_info); }
|
||||
#if ARCH(I386)
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF32_R_TYPE(m_rel.r_info);
|
||||
}
|
||||
unsigned symbol_index() const { return ELF32_R_SYM(m_rel.r_info); }
|
||||
Symbol symbol() const { return m_image.symbol(symbol_index()); }
|
||||
#else
|
||||
unsigned type() const
|
||||
{
|
||||
return ELF64_R_TYPE(m_rel.r_info);
|
||||
}
|
||||
unsigned symbol_index() const { return ELF64_R_SYM(m_rel.r_info); }
|
||||
#endif
|
||||
Symbol symbol() const
|
||||
{
|
||||
return m_image.symbol(symbol_index());
|
||||
}
|
||||
|
||||
private:
|
||||
const Image& m_image;
|
||||
|
|
Loading…
Add table
Reference in a new issue