* elf/dl-deps.c (struct openaux_args): Add open_mode element.
(openaux): Pass open_mode as new last argument to _dl_map_object.
(_dl_map_object_deps): Add new argument open_mode. Initialize
open_mode element of args variable with it.
* elf/dl-open.c (dl_open_worker): Pass __RTLD_DLOPEN flag is set to
_dl_map_object_deps.
* elf/rtld.c (dl_main): Add zero as last parameter to
_dl_map_object_deps call.
* sysdeps/generic/ldsodefs.h: Adjust prototype of _dl_map_object_deps.
* elf/nodlopen2.c: New file.
* elf/nodlopenmod2.c: New file.
* elf/Makefile: Add rules to build and run nodlopen2.
* elf/tls-macros.hgg: ...here. New file.
2002-02-08 Richard Henderson <rth@redhat.com>
2002-02-10 Ulrich Drepper <drepper@redhat.com>
+ * elf/dl-deps.c (struct openaux_args): Add open_mode element.
+ (openaux): Pass open_mode as new last argument to _dl_map_object.
+ (_dl_map_object_deps): Add new argument open_mode. Initialize
+ open_mode element of args variable with it.
+ * elf/dl-open.c (dl_open_worker): Pass __RTLD_DLOPEN flag is set to
+ _dl_map_object_deps.
+ * elf/rtld.c (dl_main): Add zero as last parameter to
+ _dl_map_object_deps call.
+ * sysdeps/generic/ldsodefs.h: Adjust prototype of _dl_map_object_deps.
+ * elf/nodlopen2.c: New file.
+ * elf/nodlopenmod2.c: New file.
+ * elf/Makefile: Add rules to build and run nodlopen2.
+
* elf/tst-tls1.c: Move TLS helper macros to...
- * elf/tls-macros.h: ...here. New file.
+ * elf/tls-macros.hgg: ...here. New file.
* elf/tst-tls2.c: New file.
* elf/Makefile (tests): Add tst-tls2.
(distribute): Add tls-macros.h.
* sysdeps/generic/dl-tls.c (_dl_allocate_tls): Correctly terminate
loop to initialize TLS block.
-2002-02-08 Richard Henderson <rth@twiddle.net>
+2002-02-08 Richard Henderson <rth@redhat.com>
* sysdeps/generic/ldsodefs.h (struct rtld_global): Also include
_dl_cpuclock_offset if HP_SMALL_TIMING_AVAIL.
test-srcs = tst-pathopt
tests-vis-yes = vismain
tests-nodelete-yes = nodelete
-tests-nodlopen-yes = nodlopen
+tests-nodlopen-yes = nodlopen nodlopen2
endif
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
testobj1_1 failobj constload2 constload3 unloadmod \
reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4
modules-vis-yes = vismod1 vismod2 vismod3
modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4
-modules-nodlopen-yes = nodlopenmod
+modules-nodlopen-yes = nodlopenmod nodlopenmod2
extra-objs += $(addsuffix .os,$(strip $(modules-names)))
include ../Rules
$(objpfx)nodlopen: $(libdl)
$(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
+$(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
+$(objpfx)nodlopen2: $(libdl)
+$(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
+
$(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
$(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
-L$(subst :, -L,$(rpath-link)) \
/* The arguments to openaux. */
struct link_map *map;
int trace_mode;
+ int open_mode;
const char *strtab;
const char *name;
args->aux = INTUSE(_dl_map_object) (args->map, args->name, 0,
(args->map->l_type == lt_executable
? lt_library : args->map->l_type),
- args->trace_mode, 0);
+ args->trace_mode, args->open_mode);
}
static ptrdiff_t
\
/* DST must not appear in SUID/SGID programs. */ \
if (__libc_enable_secure) \
- INTUSE(_dl_signal_error) (0, __str, NULL, \
- N_("DST not allowed in SUID/SGID programs"));\
+ INTUSE(_dl_signal_error) (0, __str, NULL, N_("\
+DST not allowed in SUID/SGID programs")); \
\
__newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str), \
__cnt)); \
internal_function
_dl_map_object_deps (struct link_map *map,
struct link_map **preloads, unsigned int npreloads,
- int trace_mode)
+ int trace_mode, int open_mode)
{
struct list known[1 + npreloads + 1];
struct list *runp, *tail;
args.strtab = strtab;
args.map = l;
args.trace_mode = trace_mode;
+ args.open_mode = open_mode;
orig = runp;
for (d = l->l_ld; d->d_tag != DT_NULL; ++d)
if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS,
0))
INTUSE(_dl_debug_printf) ("load auxiliary object=%s"
- " requested by file=%s\n", name,
+ " requested by file=%s\n",
+ name,
l->l_name[0]
? l->l_name : _dl_argv[0]);
/* We must be prepared that the addressed shared
object is not available. */
- err = INTUSE(_dl_catch_error) (&objname, &errstring, openaux,
- &args);
+ err = INTUSE(_dl_catch_error) (&objname, &errstring,
+ openaux, &args);
if (__builtin_expect (errstring != NULL, 0))
{
/* We are not interested in the error message. */
if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS,
0))
INTUSE(_dl_debug_printf) ("load filtered object=%s"
- " requested by file=%s\n", name,
+ " requested by file=%s\n",
+ name,
l->l_name[0]
? l->l_name : _dl_argv[0]);
/* For filter objects the dependency must be available. */
- err = INTUSE(_dl_catch_error) (&objname, &errstring, openaux,
- &args);
+ err = INTUSE(_dl_catch_error) (&objname, &errstring,
+ openaux, &args);
if (__builtin_expect (errstring != NULL, 0))
{
if (err)
/* Maybe we have to expand a DST. */
dst = strchr (file, '$');
- if (dst != NULL)
+ if (__builtin_expect (dst != NULL, 0))
{
const void *caller = args->caller;
size_t len = strlen (file);
}
/* Load the named object. */
- args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0,
- mode);
+ args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0, mode);
/* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
set and the object is not already loaded. */
}
/* Load that object's dependencies. */
- _dl_map_object_deps (new, NULL, 0, 0);
+ _dl_map_object_deps (new, NULL, 0, 0, mode & __RTLD_DLOPEN);
/* So far, so good. Now check the versions. */
for (i = 0; i < new->l_searchlist.r_nlist; ++i)
/* Release the lock. */
__libc_lock_unlock_recursive (GL(dl_load_lock));
- if (errstring)
+ if (__builtin_expect (errstring != NULL, 0))
{
/* Some error occurred during loading. */
char *local_errstring;
--- /dev/null
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+ if (dlopen ("nodlopenmod2.so", RTLD_LAZY) != NULL)
+ {
+ puts ("opening \"nodlopenmod2.so\" succeeded, FAIL");
+ return 1;
+ }
+
+ puts ("opening \"nodlopenmod2.so\" failed, OK");
+ return 0;
+}
--- /dev/null
+extern int a;
+
+int
+foo (void)
+{
+ return a;
+}
&& (__builtin_expect (! __libc_enable_secure, 1)
|| strchr (p, '/') == NULL))
{
- struct link_map *new_map = INTUSE(_dl_map_object) (GL(dl_loaded), p,
- 1, lt_library,
+ struct link_map *new_map = INTUSE(_dl_map_object) (GL(dl_loaded),
+ p, 1,
+ lt_library,
0, 0);
if (++new_map->l_opencount == 1)
/* It is no duplicate. */
if (problem != NULL)
{
char *p = strndupa (problem, file_size - (problem - file));
- struct link_map *new_map = INTUSE(_dl_map_object) (GL(dl_loaded), p, 1,
- lt_library, 0, 0);
+ struct link_map *new_map = INTUSE(_dl_map_object) (GL(dl_loaded), p,
+ 1, lt_library,
+ 0, 0);
if (++new_map->l_opencount == 1)
/* It is no duplicate. */
++npreloads;
specified some libraries to load, these are inserted before the actual
dependencies in the executable's searchlist for symbol resolution. */
HP_TIMING_NOW (start);
- INTUSE(_dl_map_object_deps) (GL(dl_loaded), preloads, npreloads, mode == trace);
+ INTUSE(_dl_map_object_deps) (GL(dl_loaded), preloads, npreloads,
+ mode == trace, 0);
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
but before its dependencies. */
extern void _dl_map_object_deps (struct link_map *map,
struct link_map **preloads,
- unsigned int npreloads, int trace_mode)
+ unsigned int npreloads, int trace_mode,
+ int open_mode)
internal_function;
extern void _dl_map_object_deps_internal (struct link_map *map,
struct link_map **preloads,
unsigned int npreloads,
- int trace_mode)
+ int trace_mode, int open_mode)
internal_function;
/* Cache the locations of MAP's hash table. */