From 7ca8b67c21513d3cd236f47332afdd1be1cb1569 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 24 Apr 2020 15:43:48 +0100 Subject: Use ART_TARGET_ANDROID instead of __ANDROID__ On golem, we build for ART_TARGET_LINUX, which doesn't have support for linkerconfig. Therefore, guard all linker namespace code on ART_TARGET_ANDROID instead of __ANDROID__ (which is unfortunately not under ART's control). Test: build for golem and run Bug: 154074847 Change-Id: I7a2b81918177704b42d8aafbd6d7e9d06d34e5f4 --- libnativeloader/native_loader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libnativeloader/native_loader.cpp') diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 2a28a05c01..b187474c5b 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -33,7 +33,7 @@ #include #include -#ifdef __ANDROID__ +#ifdef ART_TARGET_ANDROID #include #include "library_namespaces.h" #include "nativeloader/dlext_namespaces.h" @@ -42,7 +42,7 @@ namespace android { namespace { -#if defined(__ANDROID__) +#if defined(ART_TARGET_ANDROID) using android::nativeloader::LibraryNamespaces; std::mutex g_namespaces_mutex; @@ -58,18 +58,18 @@ android_namespace_t* FindExportedNamespace(const char* caller_location) { } return nullptr; } -#endif // #if defined(__ANDROID__) +#endif // #if defined(ART_TARGET_ANDROID) } // namespace void InitializeNativeLoader() { -#if defined(__ANDROID__) +#if defined(ART_TARGET_ANDROID) std::lock_guard guard(g_namespaces_mutex); g_namespaces->Initialize(); #endif } void ResetNativeLoader() { -#if defined(__ANDROID__) +#if defined(ART_TARGET_ANDROID) std::lock_guard guard(g_namespaces_mutex); g_namespaces->Reset(); #endif @@ -78,7 +78,7 @@ void ResetNativeLoader() { jstring CreateClassLoaderNamespace(JNIEnv* env, int32_t target_sdk_version, jobject class_loader, bool is_shared, jstring dex_path, jstring library_path, jstring permitted_path) { -#if defined(__ANDROID__) +#if defined(ART_TARGET_ANDROID) std::lock_guard guard(g_namespaces_mutex); auto ns = g_namespaces->Create(env, target_sdk_version, class_loader, is_shared, dex_path, library_path, permitted_path); @@ -94,7 +94,7 @@ jstring CreateClassLoaderNamespace(JNIEnv* env, int32_t target_sdk_version, jobj void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* path, jobject class_loader, const char* caller_location, jstring library_path, bool* needs_native_bridge, char** error_msg) { -#if defined(__ANDROID__) +#if defined(ART_TARGET_ANDROID) UNUSED(target_sdk_version); if (class_loader == nullptr) { *needs_native_bridge = false; @@ -208,7 +208,7 @@ void NativeLoaderFreeErrorMessage(char* msg) { free(msg); } -#if defined(__ANDROID__) +#if defined(ART_TARGET_ANDROID) void* OpenNativeLibraryInNamespace(NativeLoaderNamespace* ns, const char* path, bool* needs_native_bridge, char** error_msg) { auto handle = ns->Load(path); -- cgit v1.2.3