summaryrefslogtreecommitdiff
path: root/ldso/libdl
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras at iki.fi>2011-11-07 18:08:33 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-11-07 18:10:32 +0100
commit0c7690f6a5d6e073052ee6487f768289db3a58f7 (patch)
tree1028f6a895d2a3babe934d92585e43a99c009fde /ldso/libdl
parent515d54433138596e81267237542bd9168b8cc787 (diff)
ldso: support RTLD_NOLOAD
So application query if specified module is loaded or not with dlopen. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'ldso/libdl')
-rw-r--r--ldso/libdl/libdl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index c164ffbee..cbbbcd49e 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -52,11 +52,13 @@ extern struct link_map *_dl_update_slotinfo(unsigned long int req_modid);
/* When libdl is loaded as a shared library, we need to load in
* and use a pile of symbols from ldso... */
-
-extern struct elf_resolve * _dl_load_shared_library(int, struct dyn_elf **,
+#include <dl-elf.h>
+#if 0
+extern struct elf_resolve * _dl_load_shared_library(unsigned, struct dyn_elf **,
struct elf_resolve *, char *, int);
extern int _dl_fixup(struct dyn_elf *rpnt, struct r_scope_elem *scope, int lazy);
extern void _dl_protect_relro(struct elf_resolve * tpnt);
+#endif
extern int _dl_errno;
extern struct dyn_elf *_dl_symbol_tables;
extern struct dyn_elf *_dl_handles;
@@ -308,7 +310,7 @@ void *dlopen(const char *libname, int flag)
#endif
/* A bit of sanity checking... */
- if (!(flag & (RTLD_LAZY|RTLD_NOW))) {
+ if (!(flag & (RTLD_LAZY|RTLD_NOW|RTLD_NOLOAD))) {
_dl_error_number = LD_BAD_HANDLE;
return NULL;
}
@@ -378,8 +380,9 @@ void *dlopen(const char *libname, int flag)
/* Try to load the specified library */
_dl_if_debug_print("Trying to dlopen '%s', RTLD_GLOBAL:%d RTLD_NOW:%d\n",
(char*)libname, (flag & RTLD_GLOBAL ? 1:0), (now_flag & RTLD_NOW ? 1:0));
- tpnt = _dl_load_shared_library(0, &rpnt, tfrom, (char*)libname, 0);
+ tpnt = _dl_load_shared_library((flag & RTLD_NOLOAD) ? DL_RESOLVE_NOLOAD : 0,
+ &rpnt, tfrom, (char*)libname, 0);
if (tpnt == NULL) {
_dl_unmap_cache();
return NULL;