about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/setjmp-common.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc64/setjmp-common.S')
-rw-r--r--sysdeps/powerpc/powerpc64/setjmp-common.S41
1 files changed, 38 insertions, 3 deletions
diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S
index 606eef5935..a059a91f8b 100644
--- a/sysdeps/powerpc/powerpc64/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/setjmp-common.S
@@ -39,10 +39,33 @@
 #endif
 
 	.machine	"altivec"
+ENTRY (setjmp)
+	CALL_MCOUNT 1
+	li r4,1			/* Set second argument to 1.  */
+	b JUMPTARGET (GLUE(__sigsetjmp,_ent))
+END (setjmp)
+
+#if defined SHARED && !defined IS_IN_rtld && !defined __NO_VMX__
+/* When called from within libc we need a special version of _setjmp
+   that saves r2 since the call won't go via a plt call stub.  See
+   bugz #269.  __GI__setjmp is used in csu/libc-start.c when
+   HAVE_CLEANUP_JMP_BUF is defined.  */
+ENTRY (BP_SYM (__GI__setjmp))
+	std r2,40(r1)		/* Save the callers TOC in the save area.  */
+	cfi_endproc
+END_2 (BP_SYM (__GI__setjmp))
+/* Fall thru. */
+#endif
+
+ENTRY (BP_SYM (_setjmp))
+	CALL_MCOUNT 1
+	li r4,0			/* Set second argument to 0.  */
+	b JUMPTARGET (GLUE(__sigsetjmp,_ent))
+END (BP_SYM (_setjmp))
+libc_hidden_def (_setjmp)
+
 ENTRY (BP_SYM (__sigsetjmp))
 	CALL_MCOUNT 2
-	.globl JUMPTARGET(GLUE(__sigsetjmp,_ent))
-	.hidden JUMPTARGET(GLUE(__sigsetjmp,_ent))
 JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
 #ifdef PTR_MANGLE
@@ -190,7 +213,19 @@ L(no_vmx):
 #if defined NOT_IN_libc && defined IS_IN_rtld
 	li	r3,0
 	blr
+#elif defined SHARED
+	b	JUMPTARGET (BP_SYM (__sigjmp_save))
 #else
-	b JUMPTARGET (BP_SYM (__sigjmp_save))
+	mflr	r0
+	std	r0,16(r1)
+	stdu	r1,-112(r1)
+	cfi_adjust_cfa_offset(112)
+	cfi_offset(lr,16)
+	bl	JUMPTARGET (BP_SYM (__sigjmp_save))
+	nop
+	ld	r0,112+16(r1)
+	addi	r1,r1,112
+	mtlr	r0
+	blr
 #endif
 END (BP_SYM (__sigsetjmp))