1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00
This commit is contained in:
Jakub Jelinek
2007-07-31 13:33:18 +00:00
parent d6220e9ee3
commit 32c075e1f0
448 changed files with 13841 additions and 10982 deletions

View File

@@ -1,5 +1,5 @@
/* Look up a symbol in a shared object loaded by `dlopen'.
Copyright (C) 1999,2000,2001,2002,2004,2006 Free Software Foundation, Inc.
Copyright (C) 1999-2002,2004,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,10 +26,12 @@
#include <ldsodefs.h>
#include <dl-hash.h>
#include <sysdep-cancel.h>
#include <dl-tls.h>
#ifdef USE_TLS
# include <dl-tls.h>
#endif
#ifdef SHARED
#if defined USE_TLS && defined SHARED
/* Systems which do not have tls_index also probably have to define
DONT_USE_TLS_INDEX. */
@@ -98,10 +100,9 @@ do_sym (void *handle, const char *name, void *who,
for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL;
l = l->l_next)
if (caller >= l->l_map_start && caller < l->l_map_end)
if (caller >= l->l_map_start && caller < l->l_map_end
&& (l->l_contiguous || _dl_addr_inside_object (l, caller)))
{
/* There must be exactly one DSO for the range of the virtual
memory. Otherwise something is really broken. */
match = l;
break;
}
@@ -113,15 +114,13 @@ do_sym (void *handle, const char *name, void *who,
the initial binary. And then the more complex part
where the object is dynamically loaded and the scope
array can change. */
if (match->l_type != lt_loaded || RTLD_SINGLE_THREAD_P)
if (RTLD_SINGLE_THREAD_P)
result = GLRO(dl_lookup_symbol_x) (name, match, &ref,
match->l_scope, vers, 0,
flags | DL_LOOKUP_ADD_DEPENDENCY,
NULL);
else
{
__rtld_mrlock_lock (match->l_scope_lock);
struct call_dl_lookup_args args;
args.name = name;
args.map = match;
@@ -129,13 +128,15 @@ do_sym (void *handle, const char *name, void *who,
args.flags = flags | DL_LOOKUP_ADD_DEPENDENCY;
args.refp = &ref;
THREAD_GSCOPE_SET_FLAG ();
const char *objname;
const char *errstring = NULL;
bool malloced;
int err = GLRO(dl_catch_error) (&objname, &errstring, &malloced,
call_dl_lookup, &args);
__rtld_mrlock_unlock (match->l_scope_lock);
THREAD_GSCOPE_RESET_FLAG ();
if (__builtin_expect (errstring != NULL, 0))
{
@@ -182,7 +183,7 @@ RTLD_NEXT used in code not dynamically loaded"));
{
void *value;
#ifdef SHARED
#if defined USE_TLS && defined SHARED
if (ELFW(ST_TYPE) (ref->st_info) == STT_TLS)
/* The found symbol is a thread-local storage variable.
Return the address for to the current thread. */