diff options
author | Ryan Prichard <rprichard@google.com> | 2019-01-01 18:53:48 -0800 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2019-01-16 16:52:47 -0800 |
commit | e5e69e09128e2e89bcafec45be343674adf983bf (patch) | |
tree | 3bddb0f2bd3ccb8e6cbb6b55adbe121d6936f825 /linker/linker.cpp | |
parent | 977e47d01897be06c2b5fc30267d29f86eeb5fc1 (diff) |
Record TLS modules and layout static TLS memory
Bug: http://b/78026329
Test: bionic unit tests
Change-Id: Ibf1bf5ec864c7830e4cd1cb882842b644e6182ae
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 1f259e16c..38f15c389 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -65,8 +65,10 @@ #include "linker_phdr.h" #include "linker_relocs.h" #include "linker_reloc_iterators.h" +#include "linker_tls.h" #include "linker_utils.h" +#include "private/bionic_globals.h" #include "android-base/macros.h" #include "android-base/strings.h" #include "android-base/stringprintf.h" @@ -1652,6 +1654,7 @@ bool find_libraries(android_namespace_t* ns, if (!si->is_linked() && !si->prelink_image()) { return false; } + register_soinfo_tls(si); } // Step 4: Construct the global group. Note: DF_1_GLOBAL bit of a library is @@ -1887,6 +1890,7 @@ static void soinfo_unload_impl(soinfo* root) { si->get_realpath(), si); notify_gdb_of_unload(si); + unregister_soinfo_tls(si); get_cfi_shadow()->BeforeUnload(si); soinfo_free(si); } @@ -3073,6 +3077,12 @@ bool soinfo::prelink_image() { &ARM_exidx, &ARM_exidx_count); #endif + TlsSegment tls_segment; + if (__bionic_get_tls_segment(phdr, phnum, load_bias, get_realpath(), &tls_segment)) { + tls_ = std::make_unique<soinfo_tls>(); + tls_->segment = tls_segment; + } + // Extract useful information from dynamic section. // Note that: "Except for the DT_NULL element at the end of the array, // and the relative order of DT_NEEDED elements, entries may appear in any order." |