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: [PATCH] Re: Changed shared library loading strategy on PPC,why?



We're currently testing the patch below with l->l_type ==
lt_executable should be used IMO instead of the patch that has been
commited (with l == _dl_loaded).

Let me tell you about the problem we encountered and why I think
Jakub's original patch is ok:
Olaf and myself tested the current glibc CVS on powerpc and noticed
that the statically linked rpm binary was broken after recompilation
with the new glibc, it failed to load the libnss_* modules.  Debugging
through the routine __elf_preferred_address in powerpc/dl-machine.c I
noticed that the check for l == _dl_loaded was true and high become
the value of mapstart which was 0.  After leaving the loop high had
a value of 0xffff0000 :-(.

The check l == _dl_loaded was for the executable but for static
programs that load the shared libnss_* files it is also true.

What do you think?  

Btw. Olaf is running a complete build of glibc and will tell the
results later, but I'm convinced that this fixes the problems we
encountered.

Andreas


Jakub Jelinek <jakub@redhat.com> writes:

> On Mon, Jun 18, 2001 at 10:24:54AM +0200, Franz Sirl wrote:
>> Hi,
>> 
>> it seems someone changed the library loading strategy on PPC, which 
>> certainly has a performance impact. So I would like to know why this had 
>> been done and if it was done on purpose at all.
>> 
>> On PPC before the change the address scheme was like that:
>> 
>> executable at 0x10000000
>> shared lib first load below that, and if that space runs out, loading 
>> continues below 0x70000000.
>> 
>> Now, it seems that loading starts immediately below 0x70000000, leaving the 
>> space with optimal relocations below 0x10000000 unused.
> 
> Apparently powerpc's ELF_PREFERRED_ADDRESS relies on executable's l_map_end
> == ~0UL.
> Does following patch help?
> Perhaps the test could be l == _dl_loaded instead of
>l->l_type == lt_executable...
> 
> 2001-06-22  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* sysdeps/powerpc/dl-machine.c (__elf_preferred_address): Prefer
> 	gaps below main executable.
> 
> --- libc/sysdeps/powerpc/dl-machine.c.jj	Fri Mar  2 13:44:57 2001
>+++ libc/sysdeps/powerpc/dl-machine.c	Fri Jun 22 13:14:35 2001
> @@ -119,7 +119,8 @@ __elf_preferred_address(struct link_map 
>        mapend = l->l_map_end | (_dl_pagesize - 1);
>        assert (mapend > mapstart);
>  
> -      if (mapend >= high && high >= mapstart)
>+      if ((mapend >= high || l->l_type == lt_executable)
>+	  && high >= mapstart)
>  	high = mapstart;
>        else if (mapend >= low && low >= mapstart)
>  	low = mapend;
> 
> 	Jakub
> 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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