Add android_dlopen_ext() interface to linker.

Add a function "android_dlopen_ext()", defined in <android/dlext.h>.
This is an extended version of dlopen() which takes a struct for passing
additional parameters for Android-specific functionality. This will be
used to support RELRO section sharing between separate processes.

Bug: 13005501
Change-Id: I9c99b2f2a02ee329dedaeba09ef3a1113b17b2d6
This commit is contained in:
Torne (Richard Coles)
2014-02-06 14:34:21 +00:00
parent 26c2bb84dd
commit 012cb4583a
5 changed files with 70 additions and 16 deletions

View File

@@ -811,11 +811,15 @@ void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
}
}
soinfo* do_dlopen(const char* name, int flags) {
soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo) {
if ((flags & ~(RTLD_NOW|RTLD_LAZY|RTLD_LOCAL|RTLD_GLOBAL)) != 0) {
DL_ERR("invalid flags to dlopen: %x", flags);
return NULL;
}
if (extinfo != NULL && ((extinfo->flags & ~(ANDROID_DLEXT_VALID_FLAG_BITS)) != 0)) {
DL_ERR("invalid extended flags to android_dlopen_ext: %x", extinfo->flags);
return NULL;
}
set_soinfo_pool_protection(PROT_READ | PROT_WRITE);
soinfo* si = find_library(name);
if (si != NULL) {