diff options
author | Jiyong Park <jiyong@google.com> | 2017-04-03 23:10:37 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2017-04-28 10:14:28 +0900 |
commit | 01de74e76d1131b5c5b0120d07e8f468ac5f8fac (patch) | |
tree | 1cd468876895e1ed149efcde3382edeaddcdab31 /libdl | |
parent | 627ed9162538d847ea4e530fd443570d37f57d65 (diff) | |
download | bionic-01de74e76d1131b5c5b0120d07e8f468ac5f8fac.tar.gz |
linker: add android_get_exported_namespace
Depending on how ld.config.txt is configured, there can be multiple
built-in namespaces created by the linker from the beginning of a
process. android_get_exported_namespace is a platform only API for
getting a handle (android_namespace_t*) to one of the built-in namespaces
with given name. The returned namespace can then be given to
android_dlopen_ext in order to explicitly specify the target namespace
where the library is searched and loaded from.
Note that this function only returns 'exported' namespaces created via
ld.config.txt file. In order to export a namespace, the visible property
should be set to true:
namespace.<name>.visible = true
Namespaces are hidden by default. Hidden namespaces and namespaces
that are created programmatically, notably 'classloader-namespace',
aren't returned by this function.
Bug: 36851137
Test: confirmed that namespaces created with ld.config.txt is retrieved.
Test: linker-unit-tests passes
Merged-in: I714b510fa24f77e42c3dfc4c827b3befa8bb2951
Change-Id: I0d05fa7e0e116009edf8ea362ab46774bc617cbf
(cherry picked from commit d7c4832e6a640be972017e85ab21e72950dfeddd)
Diffstat (limited to 'libdl')
-rw-r--r-- | libdl/libdl.arm.map | 1 | ||||
-rw-r--r-- | libdl/libdl.arm64.map | 1 | ||||
-rw-r--r-- | libdl/libdl.c | 7 | ||||
-rw-r--r-- | libdl/libdl.map.txt | 1 | ||||
-rw-r--r-- | libdl/libdl.mips.map | 1 | ||||
-rw-r--r-- | libdl/libdl.mips64.map | 1 | ||||
-rw-r--r-- | libdl/libdl.x86.map | 1 | ||||
-rw-r--r-- | libdl/libdl.x86_64.map | 1 |
8 files changed, 14 insertions, 0 deletions
diff --git a/libdl/libdl.arm.map b/libdl/libdl.arm.map index c0dcd5d98..668f00888 100644 --- a/libdl/libdl.arm.map +++ b/libdl/libdl.arm.map @@ -47,4 +47,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; diff --git a/libdl/libdl.arm64.map b/libdl/libdl.arm64.map index 3b797f79e..8270fe99d 100644 --- a/libdl/libdl.arm64.map +++ b/libdl/libdl.arm64.map @@ -46,4 +46,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; diff --git a/libdl/libdl.c b/libdl/libdl.c index 6a95629db..14e745b27 100644 --- a/libdl/libdl.c +++ b/libdl/libdl.c @@ -94,6 +94,9 @@ bool __loader_android_link_namespaces( __attribute__((__weak__, visibility("default"))) void __loader_android_dlwarning(void* obj, void (*f)(void*, const char*)); +__attribute__((__weak__, visibility("default"))) +struct android_namespace_t* __loader_android_get_exported_namespace(const char* name); + // Proxy calls to bionic loader void* dlopen(const char* filename, int flag) { const void* caller_addr = __builtin_return_address(0); @@ -182,3 +185,7 @@ bool android_link_namespaces(struct android_namespace_t* namespace_from, void android_dlwarning(void* obj, void (*f)(void*, const char*)) { __loader_android_dlwarning(obj, f); } + +struct android_namespace_t* android_get_exported_namespace(const char* name) { + return __loader_android_get_exported_namespace(name); +} diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt index 245e016ee..a4c6483c4 100644 --- a/libdl/libdl.map.txt +++ b/libdl/libdl.map.txt @@ -46,4 +46,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; diff --git a/libdl/libdl.mips.map b/libdl/libdl.mips.map index 3b797f79e..8270fe99d 100644 --- a/libdl/libdl.mips.map +++ b/libdl/libdl.mips.map @@ -46,4 +46,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; diff --git a/libdl/libdl.mips64.map b/libdl/libdl.mips64.map index 3b797f79e..8270fe99d 100644 --- a/libdl/libdl.mips64.map +++ b/libdl/libdl.mips64.map @@ -46,4 +46,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; diff --git a/libdl/libdl.x86.map b/libdl/libdl.x86.map index 3b797f79e..8270fe99d 100644 --- a/libdl/libdl.x86.map +++ b/libdl/libdl.x86.map @@ -46,4 +46,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; diff --git a/libdl/libdl.x86_64.map b/libdl/libdl.x86_64.map index 3b797f79e..8270fe99d 100644 --- a/libdl/libdl.x86_64.map +++ b/libdl/libdl.x86_64.map @@ -46,4 +46,5 @@ LIBC_PLATFORM { android_init_anonymous_namespace; android_create_namespace; android_link_namespaces; + android_get_exported_namespace; } LIBC_N; |