aarch64: fix setjmp return value
authorSzabolcs Nagy <nsz@port70.net>
Wed, 12 Aug 2020 21:00:26 +0000 (21:00 +0000)
committerRich Felker <dalias@aerifal.cx>
Thu, 13 Aug 2020 01:53:25 +0000 (21:53 -0400)
longjmp should set the return value of setjmp, but 64bit
registers were used for the 0 check while the type is int.

use the code that gcc generates for return val ? val : 1;

src/setjmp/aarch64/longjmp.s

index 7c4655f..0af9c50 100644 (file)
@@ -18,7 +18,6 @@ longjmp:
        ldp d12, d13, [x0,#144]
        ldp d14, d15, [x0,#160]
 
-       mov x0, x1
-       cbnz x1, 1f
-       mov x0, #1
-1:     br x30
+       cmp w1, 0
+       csinc w0, w1, wzr, ne
+       br x30