Merge "Do not resolve caller_ns when it is not needed" into nyc-dev
am: 5b19771009
* commit '5b19771009d4eb6dfc1e560ceff608cc06050137':
Do not resolve caller_ns when it is not needed
Change-Id: I8a9cff79a15699a9806e26b2efbdbb390280fdf6
diff --git a/linker/linker.cpp b/linker/linker.cpp
index af23d44..c9fa362 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2516,7 +2516,7 @@
// is still pointing to the default one.
android_namespace_t* anon_ns =
create_namespace(nullptr, "(anonymous)", nullptr, anon_ns_library_path,
- ANDROID_NAMESPACE_TYPE_REGULAR, nullptr, nullptr);
+ ANDROID_NAMESPACE_TYPE_REGULAR, nullptr, &g_default_namespace);
if (anon_ns == nullptr) {
g_public_namespace_initialized = false;
@@ -2539,15 +2539,13 @@
return nullptr;
}
- soinfo* caller_soinfo = find_containing_library(caller_addr);
-
- android_namespace_t* caller_ns = caller_soinfo != nullptr ?
- caller_soinfo->get_primary_namespace() :
- g_anonymous_namespace;
-
- // if parent_namespace is nullptr -> set it to the caller namespace
if (parent_namespace == nullptr) {
- parent_namespace = caller_ns;
+ // if parent_namespace is nullptr -> set it to the caller namespace
+ soinfo* caller_soinfo = find_containing_library(caller_addr);
+
+ parent_namespace = caller_soinfo != nullptr ?
+ caller_soinfo->get_primary_namespace() :
+ g_anonymous_namespace;
}
ProtectedDataGuard guard;