From 0c7690f6a5d6e073052ee6487f768289db3a58f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 7 Nov 2011 18:08:33 +0100 Subject: ldso: support RTLD_NOLOAD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So application query if specified module is loaded or not with dlopen. Signed-off-by: Timo Teräs Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ldso/libdl') 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 +#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; -- cgit v1.2.3