]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
C-SKY: mark lr as undefined to stop unwinding
authorMao Han <han_mao@c-sky.com>
Mon, 11 Mar 2019 01:51:14 +0000 (09:51 +0800)
committerMao Han <han_mao@c-sky.com>
Mon, 11 Mar 2019 01:51:14 +0000 (09:51 +0800)
Mark the lr register as undefined at the start of execution, so unwind
will stop at this frame. run-backtrace-*.sh from elfutils testsuite will
fail without this patch.

* sysdeps/csky/abiv2/start.S: Mark lr as undefined.
* sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
* sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.

ChangeLog
sysdeps/csky/abiv2/start.S
sysdeps/unix/sysv/linux/csky/abiv2/clone.S
sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S

index 850e638b80a33ac669afd7e0c49e8dcca3928196..2f47cb8997cba048e2d6124692f87033eab916f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-11  Mao Han  <han_mao@c-sky.com>
+
+       * sysdeps/csky/abiv2/start.S: Mark lr as undefined.
+       * sysdeps/unix/sysv/linux/csky/abiv2/clone.S: Likewise.
+       * sysdeps/unix/sysv/linux/csky/abiv2/setcontext.S: Likewise.
+
 2019-03-11  Mao Han  <han_mao@c-sky.com>
 
        * sysdeps/unix/sysv/linux/csky/sys/procfs.h: Use linux definition
index 324ed69d322cf2fbc4a6c0b3db35bc66c425a82d..b1e61520a8f202dc01e9a13eb6cf693ab03f13f5 100644 (file)
@@ -46,6 +46,9 @@
        .type _start,@function;
        .align 4;
 _start:
+       cfi_startproc
+       .cfi_label .Ldummy
+       cfi_undefined (lr)
        subi    sp, 8
        /* Clear the link register since this is the outermost frame.  */
        movi    lr, 0
@@ -96,6 +99,7 @@ _start:
        /* Should never get here.  */
        jsri    abort
 #endif /* !SHARED */
+       cfi_endproc
        .size _start,.-_start
 
 
index 3e7328a65aa940a8aef6093c2bac65893c2d21ee..c1352ee4d7a330c9111429d9385d2c6625d980b0 100644 (file)
@@ -54,7 +54,7 @@ ENTRY (__clone)
        btsti   a0, 31          /* Check if return is less than zero.  */
        bt      __do_syscall_error
        cmpnei  a0, 0
-       bf      __child
+       bf      __thread_start
        rts
 
 __error_arg:
@@ -81,7 +81,9 @@ __do_syscall_error:
        rts
 PSEUDO_END (__clone)
 
-__child:
+ENTRY (__thread_start)
+       .cfi_label .Ldummy
+       cfi_undefined (lr)
        ldw     a0, (sp, 4)     /* Restore args from new sp.  */
        ldw     a1, (sp, 0)     /* Restore function from new sp.  */
        addi    sp, 8
@@ -90,6 +92,7 @@ __child:
        /* exit */
        lrw     r7, __NR_exit
        trap    0
+END (__thread_start)
 
 libc_hidden_def (__clone)
 weak_alias (__clone, clone)
index 6d3f04f9f09fa55709d8b655050880a97b45f73e..34de6e3ab4a19c40bacfbd8c3046cbd678cba9b3 100644 (file)
@@ -62,6 +62,8 @@ END (setcontext)
 weak_alias (__setcontext, setcontext)
 
 ENTRY (__startcontext)
+       .cfi_label .Ldummy
+       cfi_undefined (lr)
        mov     a0, r9
        cmpnei  r9, 0   /* r9 was set in makecontext.  */
        bf      1f      /* null, then exit.  */