Ignore symbols of imported libs' dependencies

When a library is present in a namespace via the secondary_namespaces
list (i.e. the executable, LD_PRELOAD, DF_1_GLOBAL, or
android_create_namespace inheritance), then we want to search that
library's symbols, but not the symbols of its dependencies. Otherwise,
we want to search the dependencies to handle cross-NS dependency.

Bug: http://b/148569846
Test: bionic unit tests
Change-Id: If798d69de28ed5c0f1a155e4ff85c7e08934e531
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index 9be85c8..fdf2cca 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -469,6 +469,56 @@
 }
 
 // -----------------------------------------------------------------------------
+// ns_hidden_child linker namespace test
+// -----------------------------------------------------------------------------
+
+cc_test {
+    name: "ns_hidden_child_helper",
+    host_supported: false,
+    defaults: ["bionic_testlib_defaults"],
+    srcs: ["ns_hidden_child_helper.cpp"],
+    shared_libs: [
+        "libns_hidden_child_internal",
+        "libns_hidden_child_global",
+        "libdl_android",
+    ],
+    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
+}
+
+cc_test_library {
+    name: "libns_hidden_child_global",
+    defaults: ["bionic_testlib_defaults"],
+    host_supported: false,
+    srcs: ["ns_hidden_child_global.cpp"],
+    shared_libs: ["libns_hidden_child_internal"],
+    ldflags: ["-Wl,-z,global"],
+}
+
+cc_test_library {
+    name: "libns_hidden_child_internal",
+    defaults: ["bionic_testlib_defaults"],
+    host_supported: false,
+    srcs: ["ns_hidden_child_internal.cpp"],
+}
+
+cc_test_library {
+    name: "libns_hidden_child_public",
+    defaults: ["bionic_testlib_defaults"],
+    host_supported: false,
+    srcs: ["ns_hidden_child_public.cpp"],
+    shared_libs: ["libns_hidden_child_internal"],
+}
+
+cc_test_library {
+    name: "libns_hidden_child_app",
+    defaults: ["bionic_testlib_defaults"],
+    host_supported: false,
+    srcs: ["ns_hidden_child_app.cpp"],
+    shared_libs: ["libns_hidden_child_public"],
+    relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
+}
+
+// -----------------------------------------------------------------------------
 // Build DT_RUNPATH test helper libraries
 //
 // Dependencies