qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] RE: Powerpc crt1.S change faulty


From: Joakim Tjernlund
Subject: [Qemu-devel] RE: Powerpc crt1.S change faulty
Date: Thu, 29 Mar 2007 19:14:26 +0200

 

> -----Original Message-----
> From: Rob Landley [mailto:address@hidden 
> Sent: den 29 mars 2007 18:53
> To: address@hidden
> Cc: address@hidden; address@hidden
> Subject: Re: Powerpc crt1.S change faulty
> 
> On Thursday 29 March 2007 4:05 am, Joakim Tjernlund wrote:
> > Hi Rob
> > 
> > I saw your change to powerpc crt1.S and I don't agree with it.
> > mr r8,r3 copies r3 to r8
> > r8 needs to maps to rtld_fini in __uClibc_main and that maps to
> > _dl_fini. Basically you have broken dynamic apps.
> 
> Sigh.  Ok.
> 
> What does the comment mean, then?

Well, the comment made somewhat sense when committing it :)
http://uclibc.org/cgi-bin/viewcvs.cgi/trunk/uClibc/libc/sysdeps/linux/powerpc/crt1.S?rev=12893&r1=10629&r2=12893

Basically linux on PPC does not clear registers before handing over
to userspace, 2.4 linux did but that was just an accident.
After a long chat with Paulus on IRC, we found that there
was an exception: r3 is the return value from the exec call
and that is zero from an successful exec so uClibc could
use that.

So the problem is that QEMU don't clear r3 before handing over
to the app.

I guess you could add in uClibc_main something like
#ifndef SHARED
  rtld_fini = NULL;
#endif
To workaround this problem until QEMU has a fix.

 Jocke
> 
> > For static apps NULL must be passed in r8 and currenly
> > crt1.S relies on the kernel to zero r3(since r3 holds
> > the return value of exec) before handing over user space.
> > If this no longer is true we are in deep sh***
> > 
> > Can you check if r3 is zero in your kernel? what kernel version
> > are you using? Are you using QEMU?
> 
> Yup.  I'm using qemu-ppc, and without this change a 
> statically linked "hello 
> world" segfaults on exit (but not on _exit()).  Lemme forward 
> this message to 
> the qemu list.

The only explanation is that r8 is already zero but r3 isn't.

> 
> For reference, the change is:
> http://uclibc.org/cgi-bin/viewcvs.cgi?rev=18270&view=rev
> 
> >    Jocke
> 
> Rob
> -- 
> Vista: Windows Millenium Second Edition
> 
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]