Fix soinfo_tls::module dangling reference

The field was pointing into an element of an std::vector, but the address
of a vector element is invalidated when the vector is resized.

This bug was caught by the new elftls.shared_ie and
elftls_dl.dlopen_shared_var_ie tests.

Bug: http://b/78026329
Test: bionic unit tests
Change-Id: I7232f6d703a9e339fe8966a95b7a68bae2c9c420
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 6687d23..412b8eb 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2925,8 +2925,9 @@
             // Unresolved weak relocation. Leave tpoff at 0 to resolve
             // &weak_tls_symbol to __get_tls().
           } else if (soinfo_tls* lsi_tls = lsi->get_tls()) {
-            if (lsi_tls->module->static_offset != SIZE_MAX) {
-              tpoff += lsi_tls->module->static_offset - tls_tp_base;
+            const TlsModule& mod = get_tls_module(lsi_tls->module_id);
+            if (mod.static_offset != SIZE_MAX) {
+              tpoff += mod.static_offset - tls_tp_base;
             } else {
               DL_ERR("TLS symbol \"%s\" in dlopened \"%s\" referenced from \"%s\" using IE access model",
                      sym_name, lsi->get_realpath(), get_realpath());