diff options
author | David 'Digit' Turner <digit@google.com> | 2010-07-21 16:18:21 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2010-07-23 12:16:15 -0700 |
commit | 6774809b6249d9d4efd982b6e3ca377c84482d9a (patch) | |
tree | 2604b1ff619cc69aea02ac37c39c61d9b0c8c7c2 | |
parent | 9d1f5afc34efb8c10672f765704941036fd40da8 (diff) | |
download | bionic-6774809b6249d9d4efd982b6e3ca377c84482d9a.zip bionic-6774809b6249d9d4efd982b6e3ca377c84482d9a.tar.gz bionic-6774809b6249d9d4efd982b6e3ca377c84482d9a.tar.bz2 |
linker: Support dlopen(NULL, ...) properly.
Change-Id: Icba37823cb350c34848cc466d144c3a0af87c94c
-rw-r--r-- | libc/docs/CHANGES.TXT | 2 | ||||
-rw-r--r-- | linker/linker.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/libc/docs/CHANGES.TXT b/libc/docs/CHANGES.TXT index 96f25d3..d1d82de 100644 --- a/libc/docs/CHANGES.TXT +++ b/libc/docs/CHANGES.TXT @@ -70,6 +70,8 @@ Differences between current and Android 2.2: - <sys/vfs.h>: fixed implementation of fstatfs() (also fixes fpathconf() which uses it). +- <dlfcn.h>: fixed dlopen() implementation to support dlopen(NULL, ...). + This allows one to look at the dynamic symbols exported by an executable. ------------------------------------------------------------------------------- Differences between Android 2.2. and Android 2.1: diff --git a/linker/linker.c b/linker/linker.c index 5e04e24..89586eb 100644 --- a/linker/linker.c +++ b/linker/linker.c @@ -1200,7 +1200,17 @@ init_library(soinfo *si) soinfo *find_library(const char *name) { soinfo *si; - const char *bname = strrchr(name, '/'); + const char *bname; + +#if ALLOW_SYMBOLS_FROM_MAIN + if (name == NULL) + return somain; +#else + if (name == NULL) + return NULL; +#endif + + bname = strrchr(name, '/'); bname = bname ? bname + 1 : name; for(si = solist; si != 0; si = si->next){ @@ -2193,6 +2203,7 @@ unsigned __linker_init(unsigned **elfdata) si->dynamic = (unsigned *)-1; si->wrprotect_start = 0xffffffff; si->wrprotect_end = 0; + si->refcount = 1; /* Use LD_LIBRARY_PATH if we aren't setuid/setgid */ if (ldpath_env && getuid() == geteuid() && getgid() == getegid()) |