@@ -39,6 +39,9 @@
is returned. */
# define RTLD_DEFAULT ((void *) 0)
+/* If only find sym in the global scope, but will not use it, do not
+ set sym dependency. */
+# define RTLD_PROBE ((void *) -2l)
/* Type for namespace indices. */
typedef long int Lmid_t;
@@ -92,10 +92,15 @@ do_sym (void *handle, const char *name, void *who,
/* Link map of the caller if needed. */
struct link_map *match = NULL;
- if (handle == RTLD_DEFAULT)
+ if (handle == RTLD_DEFAULT || handle == RTLD_PROBE)
{
match = _dl_sym_find_caller_link_map (caller);
+ int def_flags = flags;
+ if (handle == RTLD_DEFAULT)
+ {
+ def_flags |= DL_LOOKUP_ADD_DEPENDENCY;
+ }
/* Search the global scope. We have the simple case where
we look up in the scope of an object which was part of
the initial binary. And then the more complex part
@@ -104,7 +109,7 @@ do_sym (void *handle, const char *name, void *who,
if (RTLD_SINGLE_THREAD_P)
result = GLRO(dl_lookup_symbol_x) (name, match, &ref,
match->l_scope, vers, 0,
- flags | DL_LOOKUP_ADD_DEPENDENCY,
+ def_flags,
NULL);
else
{
@@ -113,7 +118,7 @@ do_sym (void *handle, const char *name, void *who,
args.map = match;
args.vers = vers;
args.flags
- = flags | DL_LOOKUP_ADD_DEPENDENCY | DL_LOOKUP_GSCOPE_LOCK;
+ = def_flags | DL_LOOKUP_GSCOPE_LOCK;
args.refp = &ref;
THREAD_GSCOPE_SET_FLAG ();