Add secondary counter in place of tls_nodelete flag
The tls_nodelete state should apply to load_group not
isolated soinfo. This actually also means that multiple
soinfos may have tls_counter on their dso_handles.
This change replaces TLS_NODELETE flag with secondary counter.
Note that access to the secondary counter (located inside soinfo)
is pretty expensive because it requires soinfo lookup by dso_handle
whereas dso_handle counter is much faster. This is why it is updated
only when dso_handle counter starts or hits 0.
Bug: http://b/80278285
Test: bionic-unit-tests --gtest_filter=dl*
Change-Id: I535583f6714e45fa2a7eaf7bb3126da20ee7cba9
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index c1f5f1c..2d35c51 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -700,7 +700,7 @@
}
// -----------------------------------------------------------------------------
-// Library with non-trivial thread_local variable to test dlclose()
+// Libraries with non-trivial thread_local variable to test dlclose()
// -----------------------------------------------------------------------------
cc_test_library {
name: "libtest_thread_local_dtor",
@@ -708,6 +708,26 @@
srcs: ["thread_local_dtor.cpp"],
}
+cc_test_library {
+ name: "libtest_thread_local_dtor2",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["thread_local_dtor2.cpp"],
+}
+
+// -----------------------------------------------------------------------------
+// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
+// -----------------------------------------------------------------------------
+cc_test_library {
+ name: "libtest_indirect_thread_local_dtor",
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["empty.cpp"],
+ shared_libs: [
+ "libtest_thread_local_dtor",
+ "libtest_thread_local_dtor2",
+ ],
+}
+
+
// -----------------------------------------------------------------------------
// Tool to use to align the shared libraries in a zip file.
// -----------------------------------------------------------------------------