diff options
author | Itamar <itamar8910@gmail.com> | 2021-04-30 13:31:42 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-30 18:47:39 +0200 |
commit | 101ac45c1a1e0bcfe67c95c16590dbe970b24abc (patch) | |
tree | 853f0ad3b3928b7b980a63e8a4f51e7323922c11 /Userland/Libraries/LibELF/DynamicLinker.cpp | |
parent | 6bbd2ebf83c4b8c0a11462f9abd65352c592b976 (diff) | |
download | serenity-101ac45c1a1e0bcfe67c95c16590dbe970b24abc.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibELF/DynamicLinker.cpp')
-rw-r--r-- | Userland/Libraries/LibELF/DynamicLinker.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 5b5126b0df..ba6d1dbccd 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -170,7 +170,7 @@ static void allocate_tls() // Initialize TLS data for (const auto& entry : s_loaders) { - entry.value->copy_initial_tls_data_into(initial_tls_data, s_total_tls_size); + entry.value->copy_initial_tls_data_into(initial_tls_data); } void* master_tls = ::allocate_tls((char*)initial_tls_data.data(), initial_tls_data.size()); @@ -282,14 +282,14 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> load_main_library(co } for (auto& loader : loaders) { - bool success = loader.link(flags, s_total_tls_size); + bool success = loader.link(flags); if (!success) { return DlErrorMessage { String::formatted("Failed to link library {}", loader.filename()) }; } } for (auto& loader : loaders) { - auto result = loader.load_stage_3(flags, s_total_tls_size); + auto result = loader.load_stage_3(flags); VERIFY(!result.is_error()); auto& object = result.value(); |