diff options
| author | Nicolas Geoffray <ngeoffray@google.com> | 2019-01-18 10:05:13 +0000 |
|---|---|---|
| committer | Nicolas Geoffray <ngeoffray@google.com> | 2019-01-18 14:07:27 +0000 |
| commit | 535350206212bbb1b86872f00fe9711ae4a21aaa (patch) | |
| tree | 47b1d1596e578e5f2380b2f052f4dbb4de9d239c | |
| parent | e0c7a8bbddf91dc79e3d493340aa1ca84aa5e623 (diff) | |
| download | system_core-535350206212bbb1b86872f00fe9711ae4a21aaa.tar.gz system_core-535350206212bbb1b86872f00fe9711ae4a21aaa.tar.bz2 system_core-535350206212bbb1b86872f00fe9711ae4a21aaa.zip | |
Pass the Java caller's location to OpenNativeLibrary.
Will be used to find the linker namespace to use.
Bug: 122874359
Test: m, gtest, run-test, CtsJdwpTests
Change-Id: I3f3be4a1d864741d585ab3ed9ffb93fab262516e
| -rw-r--r-- | libnativeloader/include/nativeloader/dlext_namespaces.h | 13 | ||||
| -rw-r--r-- | libnativeloader/include/nativeloader/native_loader.h | 2 | ||||
| -rw-r--r-- | libnativeloader/native_loader.cpp | 7 |
3 files changed, 5 insertions, 17 deletions
diff --git a/libnativeloader/include/nativeloader/dlext_namespaces.h b/libnativeloader/include/nativeloader/dlext_namespaces.h index ca026b3be..2d6ce8569 100644 --- a/libnativeloader/include/nativeloader/dlext_namespaces.h +++ b/libnativeloader/include/nativeloader/dlext_namespaces.h @@ -109,19 +109,6 @@ extern bool android_link_namespaces(struct android_namespace_t* from, struct android_namespace_t* to, const char* shared_libs_sonames); -/* - * Get the default library search path. - * The path will be copied into buffer, which must have space for at least - * buffer_size chars. Elements are separated with ':', and the path will always - * be null-terminated. - * - * If buffer_size is too small to hold the entire default search path and the - * null terminator, this function will abort. There is currently no way to find - * out what the required buffer size is. At the time of this writing, PATH_MAX - * is sufficient and used by all callers of this function. - */ -extern void android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size); - extern struct android_namespace_t* android_get_exported_namespace(const char* name); __END_DECLS diff --git a/libnativeloader/include/nativeloader/native_loader.h b/libnativeloader/include/nativeloader/native_loader.h index af53dc5a1..260f65520 100644 --- a/libnativeloader/include/nativeloader/native_loader.h +++ b/libnativeloader/include/nativeloader/native_loader.h @@ -47,7 +47,7 @@ jstring CreateClassLoaderNamespace(JNIEnv* env, __attribute__((visibility("default"))) void* OpenNativeLibrary( JNIEnv* env, int32_t target_sdk_version, const char* path, jobject class_loader, - jstring library_path, bool* needs_native_bridge, char** error_msg); + const char* caller_location, jstring library_path, bool* needs_native_bridge, char** error_msg); __attribute__((visibility("default"))) bool CloseNativeLibrary(void* handle, const bool needs_native_bridge, diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index af7df727a..0a808ce42 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -624,10 +624,11 @@ jstring CreateClassLoaderNamespace(JNIEnv* env, } void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* path, - jobject class_loader, jstring library_path, bool* needs_native_bridge, - char** error_msg) { + jobject class_loader, const char* caller_location, jstring library_path, + bool* needs_native_bridge, char** error_msg) { #if defined(__ANDROID__) UNUSED(target_sdk_version); + UNUSED(caller_location); if (class_loader == nullptr) { *needs_native_bridge = false; void* handle = dlopen(path, RTLD_NOW); @@ -654,7 +655,7 @@ void* OpenNativeLibrary(JNIEnv* env, int32_t target_sdk_version, const char* pat return OpenNativeLibraryInNamespace(ns, path, needs_native_bridge, error_msg); #else - UNUSED(env, target_sdk_version, class_loader); + UNUSED(env, target_sdk_version, class_loader, caller_location); // Do some best effort to emulate library-path support. It will not // work for dependencies. |
