aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitry <dimitry@google.com>2018-01-29 15:32:37 +0100
committerdimitry <dimitry@google.com>2018-01-29 15:32:37 +0100
commit321476a3ecc6b25579b2ddfb86b10a405f90eb8c (patch)
treec0b4a8781d1fc16eecb53950a497d12d993b7ec0
parentfb56e048971e9955f902f2036299af726c02beab (diff)
downloadbionic-321476a3ecc6b25579b2ddfb86b10a405f90eb8c.tar.gz
Test ld-android.so directly
This CL addresses review comments from https://android-review.googlesource.com/c/platform/bionic/+/595067 Test: bionic-unit-tests --gtest_filter=dl* Change-Id: I2c0fdf2a89fe6ff134308e202fb99a74080ee0ed
-rw-r--r--libdl/libdl.arm.map5
-rw-r--r--libdl/libdl.arm64.map5
-rw-r--r--libdl/libdl.cpp11
-rw-r--r--libdl/libdl.map.txt5
-rw-r--r--libdl/libdl.mips.map5
-rw-r--r--libdl/libdl.mips64.map5
-rw-r--r--libdl/libdl.x86.map5
-rw-r--r--libdl/libdl.x86_64.map5
-rw-r--r--linker/ld_android.cpp8
-rw-r--r--tests/Android.bp1
-rw-r--r--tests/dlext_test.cpp13
11 files changed, 9 insertions, 59 deletions
diff --git a/libdl/libdl.arm.map b/libdl/libdl.arm.map
index 7ed950361..1fcfc584d 100644
--- a/libdl/libdl.arm.map
+++ b/libdl/libdl.arm.map
@@ -41,11 +41,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/libdl/libdl.arm64.map b/libdl/libdl.arm64.map
index 199f2e344..8d4019ce4 100644
--- a/libdl/libdl.arm64.map
+++ b/libdl/libdl.arm64.map
@@ -40,11 +40,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/libdl/libdl.cpp b/libdl/libdl.cpp
index 4c2415f1f..c8340888e 100644
--- a/libdl/libdl.cpp
+++ b/libdl/libdl.cpp
@@ -93,11 +93,6 @@ bool __loader_android_link_namespaces(
const char* shared_libs_sonames);
__attribute__((__weak__, visibility("default")))
-bool __loader_android_link_namespaces_all_libs(
- struct android_namespace_t* namespace_from,
- struct android_namespace_t* namespace_to);
-
-__attribute__((__weak__, visibility("default")))
void __loader_android_dlwarning(void* obj, void (*f)(void*, const char*));
__attribute__((__weak__, visibility("default")))
@@ -210,12 +205,6 @@ bool android_link_namespaces(struct android_namespace_t* namespace_from,
}
__attribute__((__weak__))
-bool android_link_namespaces_all_libs(struct android_namespace_t* namespace_from,
- struct android_namespace_t* namespace_to) {
- return __loader_android_link_namespaces_all_libs(namespace_from, namespace_to);
-}
-
-__attribute__((__weak__))
void android_dlwarning(void* obj, void (*f)(void*, const char*)) {
__loader_android_dlwarning(obj, f);
}
diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt
index 579ffa709..002e9f828 100644
--- a/libdl/libdl.map.txt
+++ b/libdl/libdl.map.txt
@@ -40,11 +40,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/libdl/libdl.mips.map b/libdl/libdl.mips.map
index 199f2e344..8d4019ce4 100644
--- a/libdl/libdl.mips.map
+++ b/libdl/libdl.mips.map
@@ -40,11 +40,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/libdl/libdl.mips64.map b/libdl/libdl.mips64.map
index 199f2e344..8d4019ce4 100644
--- a/libdl/libdl.mips64.map
+++ b/libdl/libdl.mips64.map
@@ -40,11 +40,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/libdl/libdl.x86.map b/libdl/libdl.x86.map
index 199f2e344..8d4019ce4 100644
--- a/libdl/libdl.x86.map
+++ b/libdl/libdl.x86.map
@@ -40,11 +40,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/libdl/libdl.x86_64.map b/libdl/libdl.x86_64.map
index 199f2e344..8d4019ce4 100644
--- a/libdl/libdl.x86_64.map
+++ b/libdl/libdl.x86_64.map
@@ -40,11 +40,6 @@ LIBC_OMR1 { # introduced=27
__cfi_slowpath_diag;
} LIBC_N;
-LIBC_PRIVATE {
- global:
- android_link_namespaces_all_libs;
-} LIBC_OMR1;
-
LIBC_PLATFORM {
global:
__cfi_init;
diff --git a/linker/ld_android.cpp b/linker/ld_android.cpp
index 4a0577214..e2499b300 100644
--- a/linker/ld_android.cpp
+++ b/linker/ld_android.cpp
@@ -29,14 +29,6 @@
#include <stdlib.h>
#include <sys/cdefs.h>
-extern "C" void __somehow_you_managed_to_not_get_the_actual_symbols_from_the_linker();
-
-extern "C" void __ld_android_init() __attribute__((constructor));
-
-void __ld_android_init() {
- __somehow_you_managed_to_not_get_the_actual_symbols_from_the_linker();
-}
-
extern "C" void __internal_linker_error() {
abort();
}
diff --git a/tests/Android.bp b/tests/Android.bp
index 1521b73c4..25377df9d 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -413,6 +413,7 @@ cc_defaults {
target: {
android: {
shared_libs: [
+ "ld-android",
"libdl",
"libdl_preempt_test_1",
"libdl_preempt_test_2",
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index bb2d8a3dc..9ed1a56a6 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -1737,6 +1737,9 @@ TEST(dlext, ns_inaccessible_error_message) {
ASSERT_EQ(expected_dlerror, dlerror());
}
+extern "C" bool __loader_android_link_namespaces_all_libs(android_namespace_t* namespace_from,
+ android_namespace_t* namespace_to);
+
TEST(dlext, ns_link_namespaces_invalid_arguments) {
ASSERT_TRUE(android_init_anonymous_namespace(g_core_shared_libs.c_str(), nullptr));
@@ -1764,16 +1767,16 @@ TEST(dlext, ns_link_namespaces_invalid_arguments) {
"error linking namespaces \"private\"->\"(default)\": "
"the list of shared libraries is empty.", dlerror());
- // Test android_link_namespaces_all_libs()
- ASSERT_FALSE(android_link_namespaces_all_libs(nullptr, nullptr));
+ // Test __loader_android_link_namespaces_all_libs()
+ ASSERT_FALSE(__loader_android_link_namespaces_all_libs(nullptr, nullptr));
ASSERT_STREQ("android_link_namespaces_all_libs failed: "
"error linking namespaces: namespace_from is null.", dlerror());
- ASSERT_FALSE(android_link_namespaces_all_libs(nullptr, ns));
+ ASSERT_FALSE(__loader_android_link_namespaces_all_libs(nullptr, ns));
ASSERT_STREQ("android_link_namespaces_all_libs failed: "
"error linking namespaces: namespace_from is null.", dlerror());
- ASSERT_FALSE(android_link_namespaces_all_libs(ns, nullptr));
+ ASSERT_FALSE(__loader_android_link_namespaces_all_libs(ns, nullptr));
ASSERT_STREQ("android_link_namespaces_all_libs failed: "
"error linking namespaces: namespace_to is null.", dlerror());
}
@@ -1802,7 +1805,7 @@ TEST(dlext, ns_allow_all_shared_libs) {
ASSERT_TRUE(android_link_namespaces(ns_b, nullptr, g_core_shared_libs.c_str())) << dlerror();
ASSERT_TRUE(android_link_namespaces(ns_b, ns_a, "libnstest_ns_a_public1.so")) << dlerror();
- ASSERT_TRUE(android_link_namespaces_all_libs(ns_a, ns_b)) << dlerror();
+ ASSERT_TRUE(__loader_android_link_namespaces_all_libs(ns_a, ns_b)) << dlerror();
// Load libs with android_dlopen_ext() from namespace b
android_dlextinfo extinfo;