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