This is the mail archive of the libc-alpha@sourceware.cygnus.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: [Various] libc/1609: Error in 'make check' origtest with testobj1.so


> 
> When debugging the problem, I noticed that the following piece of code
> from dl-open seemed to assign the wrong address:
> 
>       /* We have to find out from which object the caller is calling.
> 	 Find the highest-addressed object that ADDRESS is not below.  */
>       call_map = NULL;
>       for (l = _dl_loaded; l; l = l->l_next)
> 	if (l->l_addr != 0 /* Make sure we do not currently set this map up
> 			      in this moment.  */
> 	    && caller >= (const void *) l->l_addr
> 	    && (call_map == NULL || call_map->l_addr < l->l_addr))
> 	  call_map = l;

I must have been too tired when I first replied to this, and forgot
what I was checking for while logging in to a Linux/sparc box.  It
does indeed match the same rule, which confirms my original guess.

      /* Create a link_map for the executable itself.
         This will be what dlopen on "" returns.  */
      _dl_new_object ((char *) "", "", lt_executable, NULL);
      if (_dl_loaded == NULL)
        _dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
      _dl_loaded->l_phdr = phdr;
      _dl_loaded->l_phnum = phent;
      _dl_loaded->l_entry = *user_entry;
      _dl_loaded->l_opencount = 1;
[...]
  /* Scan the program header table for the dynamic section.  */
  for (ph = phdr; ph < &phdr[phent]; ++ph)
    switch (ph->p_type)
      {
      case PT_PHDR:
        /* Find out the load address.  */
        _dl_loaded->l_addr = (ElfW(Addr)) phdr - ph->p_vaddr;

Signed,
Solar Designer

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