From fb9ce2882b8837f918f3fa3d06befb5c23322da9 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 22 Apr 2019 08:57:36 -0700 Subject: [PATCH] Document __register_atfork. Bug: https://github.com/android-ndk/ndk/issues/964 Test: N/A Change-Id: I5f3fa4c7fa42abde05f5b5fe730748d8c5fb4bb2 --- android-changes-for-ndk-developers.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md index 4c13bec7e..1fdb1e48f 100644 --- a/android-changes-for-ndk-developers.md +++ b/android-changes-for-ndk-developers.md @@ -330,6 +330,16 @@ default. Ensure you're using the current NDK and that you haven't configured your build system to generate incorrect SONAME entries (using the -soname linker option). +## `__register_atfork` (Available in API level >= 23) + +To allow `atfork` and `pthread_atfork` handlers to be unregistered on +`dlclose`, the implementation changed in API level 23. Unfortunately this +requires a new libc function `__register_atfork`. Code using these functions +that is built with a target API level >= 23 therefore will not load on earlier +versions of Android, with an error referencing `__register_atfork`. + +*Resolution*: build your code with an NDK target API level that matches your +app's minimum API level, or avoid using `atfork`/`pthread_atfork`. ## DT_RUNPATH support (Available in API level >= 24)