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_tls.h b/linker/linker_tls.h
index 4f48337..fbb1dcf 100644
--- a/linker/linker_tls.h
+++ b/linker/linker_tls.h
@@ -28,6 +28,9 @@
#pragma once
+#include <stdlib.h>
+
+struct TlsModule;
struct soinfo;
void linker_setup_exe_static_tls(const char* progname);
@@ -35,3 +38,5 @@
void register_soinfo_tls(soinfo* si);
void unregister_soinfo_tls(soinfo* si);
+
+const TlsModule& get_tls_module(size_t module_id);