This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Remove the getpagesize system call from ia64


"H . J . Lu" <hjl@valinux.com> writes:

> 2001-01-10  H.J. Lu  <hjl@gnu.org>
> 
> 	* elf/dl-libc.c (do_dlopen): Call DL_STATIC_INIT for static
> 	binaries.

I've applied the patch now (after moving the files around).  But there
are some more problems which I'll not address myself:

> +  __libc_lock_lock (_dl_static_lock);
> +
> +  if (done)
> +    {
> +      __libc_lock_unlock (_dl_static_lock);
> +      return;
> +    }
> +
> +  done = 1;
> +
> +  loadbase = _dl_lookup_symbol ("_dl_var_init", map, &ref,
> +				map->l_local_scope, 0, 1);
> +  f = (void (*) (void *[])) DL_SYMBOL_ADDRESS (loadbase, ref);
> +  f (variables);
> +
> +  __libc_lock_unlock (_dl_static_lock);

This code makes the assumption that the first loaded object (or at
least the first for which the function is called) is ld.so.  There is
no such guarantee.

Therefore setting of done should be postponed until it is clear the
object is ld.so and the result of _dl_lookup_symbol should be checked
for an error.  If the function returns with an error the object is not
ld.so and no function call must be made and done must not be set.

Another possible problem is that ld.so can be unloaded.  The variable
would have to be reset.  I don't think done is necessary at all.

Well, somebody has to come up with some test cases and fix the
implementation.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]