diff options
author | Elliott Hughes <enh@google.com> | 2017-10-25 15:02:36 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-10-25 23:08:10 +0000 |
commit | bcbce9b453b99316c851a2792695b73e863465ef (patch) | |
tree | bfb87224630c47d0ef7b9472c17d03f709116056 /android-changes-for-ndk-developers.md | |
parent | 88c5ddb6d20d8eec56bfff3a209a86ef2bfce60b (diff) |
Document the dlclose/thread locals with non-trivial destructors problem.
Bug: https://github.com/android-ndk/ndk/issues/360
Test: N/A
Change-Id: I964a6c9abd1ae65d74c6aee1c842b2f3d24b5556
Diffstat (limited to 'android-changes-for-ndk-developers.md')
-rw-r--r-- | android-changes-for-ndk-developers.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md index c30185735..0620d9e5b 100644 --- a/android-changes-for-ndk-developers.md +++ b/android-changes-for-ndk-developers.md @@ -376,3 +376,22 @@ adb shell setprop debug.ld.all dlerror,dlopen ``` enables logging of all errors and dlopen calls + +## dlclose interacts badly with thread local variables with non-trivial destructors + +Android allows `dlclose` to unload a library even if there are still +thread-local variables with non-trivial destructors. This leads to +crashes when a thread exits and attempts to call the destructor, the +code for which has been unloaded (as in [issue 360]). + +[issue 360]: https://github.com/android-ndk/ndk/issues/360 + +Not calling `dlclose` or ensuring that your library has `RTLD_NODELETE` +set (so that calls to `dlclose` don't actually unload the library) +are possible workarounds. + +| | Pre-M | M+ | +| ----------------- | -------------------------- | ------- | +| No workaround | Works for static STL | Broken | +| `-Wl,-z,nodelete` | Works for static STL | Works | +| No `dlclose` | Works | Works | |