summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/__longjmp-common.S
diff options
context:
space:
mode:
authorRogerio Alves <rcardoso@linux.vnet.ibm.com>2018-07-16 15:07:10 -0300
committerTulio Magno Quites Machado Filho <tuliom@linux.ibm.com>2018-07-16 16:08:41 -0300
commit52b2a80fae89d2a99ac3d1866a73c8bbf7b608ff (patch)
treec861930d393bdd30c0cbdc7346aa388cee7eebf2 /sysdeps/powerpc/powerpc64/__longjmp-common.S
parent3ae725dfb6d7f61447d27d00ed83e573bd5454f4 (diff)
downloadglibc-52b2a80fae89d2a99ac3d1866a73c8bbf7b608ff.tar.gz
glibc-52b2a80fae89d2a99ac3d1866a73c8bbf7b608ff.tar.xz
glibc-52b2a80fae89d2a99ac3d1866a73c8bbf7b608ff.zip
powerpc64: Always restore TOC on longjmp [BZ #21895]
This patch changes longjmp to always restore the TOC pointer (r2 register)
to the caller frame on powerpc64 and powerpc64le.  This is related to bug
21895 that reports a situation where you have a static longjmp to a
shared object file.

	[BZ #21895]
	* sysdeps/powerpc/powerpc64/__longjmp-common.S: Remove condition code for
	restoring r2 in longjmp.
	* sysdeps/powerpc/powerpc64/Makefile: Added tst-setjmp-bug21895-static to
	test list.
	Added rules to build test tst-setjmp-bug21895-static.
	Added module setjmp-bug21895 and rules to build a shared object from it.
	* sysdeps/powerpc/powerpc64/setjmp-bug21895.c: New test file.
	* sysdeps/powerpc/powerpc64/tst-setjmp-bug21895-static.c: New test file.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/powerpc64/__longjmp-common.S')
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp-common.S5
1 files changed, 1 insertions, 4 deletions
diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S
index 0e10b8de19..99c17c5797 100644
--- a/sysdeps/powerpc/powerpc64/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -130,9 +130,6 @@ L(no_vmx):
 	ld r0,(JB_LR*8)(r3)
 	ld r14,((JB_GPRS+0)*8)(r3)
 	lfd fp14,((JB_FPRS+0)*8)(r3)
-#if defined SHARED && !IS_IN (rtld)
-	std r2,FRAME_TOC_SAVE(r1)	/* Restore the callers TOC save area.  */
-#endif
 	ld r15,((JB_GPRS+1)*8)(r3)
 	lfd fp15,((JB_FPRS+1)*8)(r3)
 	ld r16,((JB_GPRS+2)*8)(r3)
@@ -152,7 +149,7 @@ L(no_vmx):
 	second argument (-4@4), and target address (8@0), respectively.  */
 	LIBC_PROBE (longjmp, 3, 8@3, -4@4, 8@0)
 	mtlr r0
-/* 	std r2,FRAME_TOC_SAVE(r1)	Restore the TOC save area.  */
+	std r2,FRAME_TOC_SAVE(r1)	/* Restore the TOC save area.  */
 	ld r21,((JB_GPRS+7)*8)(r3)
 	lfd fp21,((JB_FPRS+7)*8)(r3)
 	ld r22,((JB_GPRS+8)*8)(r3)