From bf8b3e74bfdc50935445c324f8dc03025a6f2419 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 20 Jul 2000 22:53:54 +0000 Subject: Update. * elf/elf.h: Add various DF_1_*, DTF_1_*, and DF_P1_* entries. * elf/dl-close.c (_dl_close): Don't close an object if it is marked with nodelete. * elf/dl-open.c (dl_open_worker): Pass RTLD_NOLOAD as new parameter to _dl_map_object. Return immediately if no object loaded. Set DF_1_NODELETE bit in l_flags_1 if RTLD_NODELETE was passed. * elf/dynamic-link.h (elf_get_dynamic_info): Copy DT_FLAGS_1 entry if it exists into l_flags_1 word. * elf/dl-load.c (_dl_map_object_from_fd): Take no parameter and use it to determine whether loading is wanted or not. (_dl_map_object): Likewise. Call _dl_map_object_from_fd with new parameter. * sysdeps/generic/ldsodefs.h: Update prototype. * elf/dl-deps.c: Add new parameter to _dl_map_object calls. * elf/rtld.c: Likewise. * elf/Makefile (tests): Add noload. Add rules to generate noload. * elf/noload.c: New file. * include/link.h (struct link_map): Add l_feature_1 and l_flags_1. * sysdeps/generic/bits/dlfcn.h: Define RTLD_NOLOAD and RTLD_NODELETE. * sysdeps/mips/bits/dlfcn.h: Likewise. --- elf/dl-load.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'elf/dl-load.c') diff --git a/elf/dl-load.c b/elf/dl-load.c index 2c506b55c1..fbf82e2068 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -688,7 +688,7 @@ static #endif struct link_map * _dl_map_object_from_fd (const char *name, int fd, char *realname, - struct link_map *loader, int l_type) + struct link_map *loader, int l_type, int noload) { /* This is the expected ELF header. */ #define ELF32_CLASS ELFCLASS32 @@ -752,6 +752,11 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname, return l; } + if (noload) + /* We are not supposed to load the object unless it is already + loaded. So return now. */ + return NULL; + /* Print debugging message. */ if (__builtin_expect (_dl_debug_files, 0)) _dl_debug_message (1, "file=", name, "; generating link map\n", NULL); @@ -1301,7 +1306,7 @@ open_path (const char *name, size_t namelen, int preloaded, struct link_map * internal_function _dl_map_object (struct link_map *loader, const char *name, int preloaded, - int type, int trace_mode) + int type, int trace_mode, int noload) { int fd; char *realname; @@ -1501,5 +1506,5 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, _dl_signal_error (errno, name, N_("cannot open shared object file")); } - return _dl_map_object_from_fd (name, fd, realname, loader, type); + return _dl_map_object_from_fd (name, fd, realname, loader, type, noload); } -- cgit 1.4.1