5de29b
commit e39adf43c7d1979884dd304ed1250baf1f78fadc
5de29b
Author: Andreas Schwab <schwab@suse.de>
5de29b
Date:   Mon May 20 10:19:31 2013 +0200
5de29b
5de29b
    AArch64: Don't clobber argument for tail call to __sigjmp_save in sigsetjmp
5de29b
12745e
diff --git glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S
5de29b
index cff81c7..10e0709 100644
12745e
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S
12745e
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S
5de29b
@@ -44,8 +44,14 @@ ENTRY (__sigsetjmp)
5de29b
 	stp	d10, d11, [x0, #JB_D10<<3]
5de29b
 	stp	d12, d13, [x0, #JB_D12<<3]
5de29b
 	stp	d14, d15, [x0, #JB_D14<<3]
5de29b
-	mov	x1,  sp
5de29b
-	str	x1,  [x0, #JB_SP<<3]
5de29b
+	mov	x2,  sp
5de29b
+	str	x2,  [x0, #JB_SP<<3]
5de29b
+#if defined NOT_IN_libc && defined IS_IN_rtld
5de29b
+	/* In ld.so we never save the signal mask */
5de29b
+	mov	w0, #0
5de29b
+	RET
5de29b
+#else
5de29b
 	b	C_SYMBOL_NAME(__sigjmp_save)
5de29b
+#endif
5de29b
 END (__sigsetjmp)
5de29b
 hidden_def (__sigsetjmp)
12745e
diff --git glibc-2.17-c758a686/setjmp/Makefile glibc-2.17-c758a686/setjmp/Makefile
5de29b
index 6124333..913359c 100644
12745e
--- glibc-2.17-c758a686/setjmp/Makefile
12745e
+++ glibc-2.17-c758a686/setjmp/Makefile
5de29b
@@ -25,7 +25,8 @@ headers	:= setjmp.h bits/setjmp.h bits/setjmp2.h
5de29b
 routines	:= setjmp sigjmp bsd-setjmp bsd-_setjmp \
5de29b
 		   longjmp __longjmp jmp-unwind
5de29b
 
5de29b
-tests		:= tst-setjmp jmpbug bug269-setjmp
5de29b
+tests		:= tst-setjmp jmpbug bug269-setjmp \
5de29b
+		   tst-sigsetjmp
5de29b
 
5de29b
 
5de29b
 include ../Rules
12745e
diff --git glibc-2.17-c758a686/setjmp/tst-sigsetjmp.c glibc-2.17-c758a686/setjmp/tst-sigsetjmp.c
5de29b
new file mode 100644
5de29b
index 0000000..467c26a
5de29b
--- /dev/null
12745e
+++ glibc-2.17-c758a686/setjmp/tst-sigsetjmp.c
5de29b
@@ -0,0 +1,44 @@
5de29b
+/* Copyright (C) 2013 Free Software Foundation, Inc.
5de29b
+   This file is part of the GNU C Library.
5de29b
+
5de29b
+   The GNU C Library is free software; you can redistribute it and/or
5de29b
+   modify it under the terms of the GNU Lesser General Public
5de29b
+   License as published by the Free Software Foundation; either
5de29b
+   version 2.1 of the License, or (at your option) any later version.
5de29b
+
5de29b
+   The GNU C Library is distributed in the hope that it will be useful,
5de29b
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
5de29b
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5de29b
+   Lesser General Public License for more details.
5de29b
+
5de29b
+   You should have received a copy of the GNU Lesser General Public
5de29b
+   License along with the GNU C Library; if not, see
5de29b
+   <http://www.gnu.org/licenses/>.  */
5de29b
+
5de29b
+/* Test case for BZ #15493 */
5de29b
+
5de29b
+#include <stdlib.h>
5de29b
+#include <signal.h>
5de29b
+#include <setjmp.h>
5de29b
+
5de29b
+static int
5de29b
+do_test (void)
5de29b
+{
5de29b
+  sigjmp_buf sj;
5de29b
+  sigset_t m;
5de29b
+
5de29b
+  sigemptyset (&m);
5de29b
+  sigprocmask (SIG_SETMASK, &m, NULL);
5de29b
+  if (sigsetjmp (sj, 0) == 0)
5de29b
+    {
5de29b
+      sigaddset (&m, SIGUSR1);
5de29b
+      sigprocmask (SIG_SETMASK, &m, NULL);
5de29b
+      siglongjmp (sj, 1);
5de29b
+      return EXIT_FAILURE;
5de29b
+    }
5de29b
+  sigprocmask (SIG_SETMASK, NULL, &m);
5de29b
+  return sigismember (&m, SIGUSR1) ? EXIT_SUCCESS : EXIT_FAILURE;
5de29b
+}
5de29b
+
5de29b
+#define TEST_FUNCTION do_test ()
5de29b
+#include "../test-skeleton.c"