diff options
author | Martin Stjernholm <mast@google.com> | 2021-04-28 14:52:01 +0100 |
---|---|---|
committer | Martin Stjernholm <mast@google.com> | 2021-05-05 12:07:48 +0000 |
commit | 2207b7e7db463dfa96d071654c49268e22e8745f (patch) | |
tree | e01f687e8761a63d83b9858a02d529ddacc1b60f /libnativeloader/native_loader_namespace.cpp | |
parent | 107d22b9c7a97275e62bb5a97eb871713cfa0616 (diff) |
Extend Link() to allow linking to the default namespace.
The code path through native bridge and NDK translation should
propagate nullptr as well.
This to support a later change that changes the way native test
libraries are loaded in ART run tests.
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Bug: 130340935
Change-Id: I934d11942e41ccc6d140a7044faa160b006166f1
Diffstat (limited to 'libnativeloader/native_loader_namespace.cpp')
-rw-r--r-- | libnativeloader/native_loader_namespace.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libnativeloader/native_loader_namespace.cpp b/libnativeloader/native_loader_namespace.cpp index fe15c70ac8..669fa74dc2 100644 --- a/libnativeloader/native_loader_namespace.cpp +++ b/libnativeloader/native_loader_namespace.cpp @@ -139,18 +139,20 @@ Result<NativeLoaderNamespace> NativeLoaderNamespace::Create( is_bridged ? "bridged" : "native", name, search_paths, permitted_paths); } -Result<void> NativeLoaderNamespace::Link(const NativeLoaderNamespace& target, +Result<void> NativeLoaderNamespace::Link(const NativeLoaderNamespace* target, const std::string& shared_libs) const { LOG_ALWAYS_FATAL_IF(shared_libs.empty(), "empty share lib when linking %s to %s", - this->name().c_str(), target.name().c_str()); + this->name().c_str(), target == nullptr ? "default" : target->name().c_str()); if (!IsBridged()) { - if (android_link_namespaces(this->ToRawAndroidNamespace(), target.ToRawAndroidNamespace(), + if (android_link_namespaces(this->ToRawAndroidNamespace(), + target == nullptr ? nullptr : target->ToRawAndroidNamespace(), shared_libs.c_str())) { return {}; } } else { if (NativeBridgeLinkNamespaces(this->ToRawNativeBridgeNamespace(), - target.ToRawNativeBridgeNamespace(), shared_libs.c_str())) { + target == nullptr ? nullptr : target->ToRawNativeBridgeNamespace(), + shared_libs.c_str())) { return {}; } } |