1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibELF: Avoid calling strlen() in DynamicObject::hash_section()

The long-term fix here is to make StringView recognize compile-time
string literals and do the right thing automatically.
This commit is contained in:
Andreas Kling 2021-02-23 18:52:27 +01:00
parent d6af3302e8
commit cc00df0f0f

View file

@ -235,7 +235,9 @@ DynamicObject::Section DynamicObject::fini_array_section() const
DynamicObject::HashSection DynamicObject::hash_section() const
{
const char* section_name = m_hash_type == HashType::SYSV ? "DT_HASH" : "DT_GNU_HASH";
auto section_name = m_hash_type == HashType::SYSV
? StringView { "DT_HASH", 7 }
: StringView { "DT_GNU_HASH", 11 };
return HashSection(Section(*this, m_hash_table_offset, 0, 0, section_name), m_hash_type);
}