SH: makecontext/.Lexitcode: Always initialize the GOT register before use.
authorThomas Schwinge <thomas@codesourcery.com>
Sat, 23 Jun 2012 09:42:29 +0000 (11:42 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Sat, 23 Jun 2012 09:42:29 +0000 (11:42 +0200)
This is only relevant when returning from a context with »uc_link == NULL«,
which is not exercised in the testsuite.

ChangeLog
sysdeps/unix/sysv/linux/sh/makecontext.S

index 49c98fb10b731808692c8c7698b5480a4004c617..751797d4f4ca1dcbaba098eaada31fe03fac9735 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-06-23  Thomas Schwinge  <thomas@codesourcery.com>
 
+       * sysdeps/unix/sysv/linux/sh/makecontext.S (.Lexitcode): Always
+       initialize the GOT register before use.
+
        * sysdeps/unix/sysv/linux/sh/makecontext.S (__makecontext): Fix
        calculation of ARGC > 4.
 
index 4a0207a223b581b1b0e8e2cf5a1c4fd5f6b2c74c..a847bb60b69d0833e76fa15c4332d1ab39c5eacb 100644 (file)
@@ -97,22 +97,26 @@ ENTRY(__makecontext)
 
        .align  5
 .Lexitcode:
-       tst     r8, r8          /* ucb->uc_link == NULL? */
-       bt/s    2f
-        mov    r8, r4          /* r4 <- ucb->uc_link */
 #ifdef PIC
        mova    .Lgot, r0
        mov.l   .Lgot, r12
        add     r0, r12
+#endif
+       tst     r8, r8          /* ucb->uc_link == NULL? */
+       bt/s    2f
+        mov    r8, r4          /* r4 <- ucb->uc_link */
        mov.l   .Lsetcontext, r1
+#ifdef PIC
        bsrf    r1
 .LPCS0:
         nop
 #else
-       mov.l   .Lsetcontext, r1
        jsr     @r1
         nop
 #endif
+       /* If this returns (which can happen if the syscall fails) we'll exit
+          the program with the return error value (-1).  */
+
 2:
        mov.l   .Lexit, r1
 #ifdef PIC