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

LibELF: Change TLS offset calculation

This changes the TLS offset calculation logic to be based on the
symbol's size instead of the total size of the TLS.

Because of this change, we no longer need to pipe "m_tls_size" to so
many functions.

Also, After this patch, the TLS data of the main program exists at the
"end" of the TLS block (Highest addresses).

This fixes a part of #6609.
This commit is contained in:
Itamar 2021-04-30 13:31:42 +03:00 committed by Andreas Kling
parent 6bbd2ebf83
commit 101ac45c1a
5 changed files with 36 additions and 33 deletions

View file

@ -440,7 +440,7 @@ auto DynamicObject::lookup_symbol(const HashSymbol& symbol) const -> Optional<Sy
auto symbol_result = result.value();
if (symbol_result.is_undefined())
return {};
return SymbolLookupResult { symbol_result.value(), symbol_result.address(), symbol_result.bind(), this };
return SymbolLookupResult { symbol_result.value(), symbol_result.size(), symbol_result.address(), symbol_result.bind(), this };
}
NonnullRefPtr<DynamicObject> DynamicObject::create(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address)