Powerpc crt1.S change faulty
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Joakim Tjernlund
Hi Rob
I saw your change to powerpc
crt1.Sand I don't agree with it. mr r8,r3 copies r3 to r8
r8 needs to maps tortld_finiin__uClibc_mainand that maps to_dl_fini. Basically you have broken dynamic apps.
Sigh. Ok.
What does the comment mean, then?
Quoted 7 lines
For static apps NULL must be passed in r8 and currenly
crt1.Srelies 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.
For reference, the change is:
http://uclibc.org/cgi-bin/viewcvs.cgi?rev=18270&view=rev
Quoted 1 line
Jocke
Rob
Signature · 1 line
Vista: Windows Millenium Second Edition
Quoted 12 lines
-----Original Message-----
From: Rob Landley [mailto:[email protected]]
Sent: den 29 mars 2007 18:53
To: [email protected]
Cc: [email protected]; [email protected]
Subject: Re: Powerpccrt1.Schange faultyQuoted 2 lines · Joakim Tjernlund
Hi Rob
Quoted 8 lines
Quoted 4 lines
I saw your change to powerpc
crt1.Sand I don't agree with it. mr r8,r3 copies r3 to r8
r8 needs to maps tortld_finiin__uClibc_mainand 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
Quoted 6 lines
Quoted 6 lines
For static apps NULL must be passed in r8 and currenly
crt1.Srelies 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***
Quoted 8 lines
Quoted 2 lines
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.
Quoted 12 lines
For reference, the change is:
http://uclibc.org/cgi-bin/viewcvs.cgi?rev=18270&view=revQuoted 1 line
Jocke
Rob
Signature · 1 line
Vista: Windows Millenium Second Edition