From 15efde2badd80b8b124f8e1444165e4afbac17f0 Mon Sep 17 00:00:00 2001 From: Dmitriy Ivanov Date: Fri, 22 May 2015 18:03:34 -0700 Subject: [PATCH] Reset libc targetSdkVersion This will let libc/linker know which sdk version is targeted by the app. This is needed to work around incorrect DT_NEEDED entries in old apps. Bug: http://b/21364029 Change-Id: I2f2907104106aac6c8831381ca171dc0302e6a9d --- runtime/native/dalvik_system_VMRuntime.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc index 9736e1507..a172197d7 100644 --- a/runtime/native/dalvik_system_VMRuntime.cc +++ b/runtime/native/dalvik_system_VMRuntime.cc @@ -16,6 +16,9 @@ #include "dalvik_system_VMRuntime.h" +#ifdef HAVE_ANDROID_OS +extern "C" void android_set_application_target_sdk_version(uint32_t version); +#endif #include #include @@ -192,6 +195,12 @@ static void VMRuntime_setTargetSdkVersionNative(JNIEnv*, jobject, jint target_sd // Note that targetSdkVersion may be CUR_DEVELOPMENT (10000). // Note that targetSdkVersion may be 0, meaning "current". Runtime::Current()->SetTargetSdkVersion(target_sdk_version); + +#ifdef HAVE_ANDROID_OS + // This part is letting libc/dynamic linker know about current app's + // target sdk version to enable compatibility workarounds. + android_set_application_target_sdk_version(static_cast(target_sdk_version)); +#endif } static void VMRuntime_registerNativeAllocation(JNIEnv* env, jobject, jint bytes) { -- 2.11.0