The ARM signal frame layout changed in kernel version 2.6.18, and for EABI 
unwinding from signal handlers depends on unwind information in libc 
matching the kernel's signal frame layout.

This patch makes uClibc use appropriate unwind information depending on 
the kernel headers used (as opposed to the runtime selection in my 
corresponding glibc patch 
<http://sourceware.org/ml/libc-ports/2007-05/msg00002.html>).  EABI 
support was introduced in 2.6.16; if you use 2.6.16 or 2.6.17 headers 
you'll get correct unwind information for those kernels, if you use later 
headers you'll get correct unwind information for later kernels.

The testcases this fixes are GCC's gcc.dg/cleanup-{8,9,10,11}.c.

Index: libc/sysdeps/linux/arm/sigrestorer.S
===================================================================
--- libc/sysdeps/linux/arm/sigrestorer.S        (revision 18675)
+++ libc/sysdeps/linux/arm/sigrestorer.S        (working copy)
@@ -17,7 +17,8 @@
    02111-1307 USA.  */
 
 #include <sys/syscall.h>
-
+#include <linux/version.h>
+       
 /* If no SA_RESTORER function was specified by the application we use
    one of these.  This avoids the need for the kernel to synthesise a return
    instruction on the stack, which would involve expensive cache flushes.
@@ -29,15 +30,21 @@
 
    Start the unwind tables at least one instruction before the signal
    trampoline, because the unwinder will assume we are returning after
-   a call site.  */
+   a call site.
 
+   The signal frame layout changed in 2.6.18.  */
+
 .global __default_sa_restorer
 .type __default_sa_restorer,%function
 .align 2
 #ifdef __ARM_EABI__
        .fnstart
        .save {r0-r15}
+#if LINUX_VERSION_CODE >= 0x020612
+       .pad #32
+#else
        .pad #12
+#endif
        nop
 __default_sa_restorer:
        mov     r7, $SYS_ify(sigreturn)
@@ -57,7 +64,11 @@
 #ifdef __ARM_EABI__
        .fnstart
        .save {r0-r15}
+#if LINUX_VERSION_CODE >= 0x020612
+       .pad #160
+#else
        .pad #168
+#endif
        nop
 __default_rt_sa_restorer:
        mov     r7, $SYS_ify(rt_sigreturn)

-- 
Joseph S. Myers
[EMAIL PROTECTED]
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to