Index: lib/scudo/CMakeLists.txt =================================================================== --- lib/scudo/CMakeLists.txt +++ lib/scudo/CMakeLists.txt @@ -17,6 +17,14 @@ # Use gc-sections by default to avoid unused code being pulled in. list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections) +if(ANDROID) +# Put the Scudo shared library in the global group. For more details, see +# android-changes-for-ndk-developers.md#changes-to-library-search-order + if (COMPILER_RT_HAS_Z_GLOBAL) + list(APPEND ASAN_DYNAMIC_LINK_FLAGS -Wl,-z,global) + endif() +endif() + # The minimal Scudo runtime does not inlude the UBSan runtime. set(SCUDO_MINIMAL_OBJECT_LIBS RTSanitizerCommonNoTermination