mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibELF: Simplify DynamicObject::Symbol class a bit
We no longer need the create_undefined() helper function. Also we don't need a member field for is_undefined().
This commit is contained in:
parent
1997d5de1a
commit
c5d93e55d0
Notes:
sideshowbarker
2024-07-18 22:04:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c5d93e55d09
1 changed files with 2 additions and 24 deletions
|
@ -72,27 +72,8 @@ public:
|
|||
, m_sym(sym)
|
||||
, m_index(index)
|
||||
{
|
||||
if (section_index() == 0)
|
||||
m_is_undefined = true;
|
||||
}
|
||||
|
||||
Symbol(const Symbol& other)
|
||||
: m_dynamic(other.m_dynamic)
|
||||
, m_sym(other.m_sym)
|
||||
, m_index(other.m_index)
|
||||
, m_is_undefined(other.m_is_undefined)
|
||||
{
|
||||
}
|
||||
|
||||
static Symbol create_undefined(const DynamicObject& dynamic)
|
||||
{
|
||||
auto s = Symbol(dynamic, 0, {});
|
||||
s.m_is_undefined = true;
|
||||
return s;
|
||||
}
|
||||
|
||||
~Symbol() { }
|
||||
|
||||
StringView name() const { return m_dynamic.symbol_string_table_string(m_sym.st_name); }
|
||||
unsigned section_index() const { return m_sym.st_shndx; }
|
||||
unsigned value() const { return m_sym.st_value; }
|
||||
|
@ -101,10 +82,8 @@ public:
|
|||
unsigned type() const { return ELF32_ST_TYPE(m_sym.st_info); }
|
||||
unsigned bind() const { return ELF32_ST_BIND(m_sym.st_info); }
|
||||
|
||||
bool is_undefined() const
|
||||
{
|
||||
return m_is_undefined;
|
||||
}
|
||||
bool is_undefined() const { return section_index() == 0; }
|
||||
|
||||
VirtualAddress address() const
|
||||
{
|
||||
if (m_dynamic.elf_is_dynamic())
|
||||
|
@ -117,7 +96,6 @@ public:
|
|||
const DynamicObject& m_dynamic;
|
||||
const Elf32_Sym& m_sym;
|
||||
const unsigned m_index;
|
||||
bool m_is_undefined { false };
|
||||
};
|
||||
|
||||
class Section {
|
||||
|
|
Loading…
Reference in a new issue