mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:07:34 +00:00
LibELF: Handle DT_SONAME dynamic entries
Store the offset in the string table for the DT_SONAME entry. Now that the build uses cmake, cmake is helpfully passing --Wl,-soname to the linker for shared objects. This makes the LinkDemo run again.
This commit is contained in:
parent
3d153e5ed3
commit
e5ad6a491e
2 changed files with 12 additions and 0 deletions
|
@ -59,6 +59,9 @@ void DynamicObject::dump() const
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (m_has_soname)
|
||||||
|
builder.appendf("DT_SONAME: %s\n", soname()); // FIXME: Valdidate that this string is null terminated?
|
||||||
|
|
||||||
dbgprintf("Dynamic section at address 0x%x contains %zu entries:\n", m_dynamic_address.as_ptr(), num_dynamic_sections);
|
dbgprintf("Dynamic section at address 0x%x contains %zu entries:\n", m_dynamic_address.as_ptr(), num_dynamic_sections);
|
||||||
dbgprintf(builder.to_string().characters());
|
dbgprintf(builder.to_string().characters());
|
||||||
}
|
}
|
||||||
|
@ -135,6 +138,10 @@ void DynamicObject::parse()
|
||||||
case DT_TEXTREL:
|
case DT_TEXTREL:
|
||||||
m_dt_flags |= DF_TEXTREL; // This tag seems to exist for legacy reasons only?
|
m_dt_flags |= DF_TEXTREL; // This tag seems to exist for legacy reasons only?
|
||||||
break;
|
break;
|
||||||
|
case DT_SONAME:
|
||||||
|
m_soname_index = entry.val();
|
||||||
|
m_has_soname = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
dbgprintf("DynamicObject: DYNAMIC tag handling not implemented for DT_%s\n", name_for_dtag(entry.tag()));
|
dbgprintf("DynamicObject: DYNAMIC tag handling not implemented for DT_%s\n", name_for_dtag(entry.tag()));
|
||||||
printf("DynamicObject: DYNAMIC tag handling not implemented for DT_%s\n", name_for_dtag(entry.tag()));
|
printf("DynamicObject: DYNAMIC tag handling not implemented for DT_%s\n", name_for_dtag(entry.tag()));
|
||||||
|
|
|
@ -213,6 +213,8 @@ public:
|
||||||
VirtualAddress plt_got_base_address() const { return m_base_address.offset(m_procedure_linkage_table_offset); }
|
VirtualAddress plt_got_base_address() const { return m_base_address.offset(m_procedure_linkage_table_offset); }
|
||||||
VirtualAddress base_address() const { return m_base_address; }
|
VirtualAddress base_address() const { return m_base_address; }
|
||||||
|
|
||||||
|
const char* soname() const { return m_has_soname ? symbol_string_table_string(m_soname_index) : nullptr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* symbol_string_table_string(Elf32_Word) const;
|
const char* symbol_string_table_string(Elf32_Word) const;
|
||||||
void parse();
|
void parse();
|
||||||
|
@ -259,6 +261,9 @@ private:
|
||||||
|
|
||||||
// DT_FLAGS
|
// DT_FLAGS
|
||||||
Elf32_Word m_dt_flags { 0 };
|
Elf32_Word m_dt_flags { 0 };
|
||||||
|
|
||||||
|
bool m_has_soname { false };
|
||||||
|
Elf32_Word m_soname_index { 0 }; // Index into dynstr table for SONAME
|
||||||
// End Section information from DT_* entries
|
// End Section information from DT_* entries
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue