summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32
diff options
context:
space:
mode:
authorAndreas Schwab <aschwab@redhat.com>2009-06-25 08:56:20 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-25 08:56:20 -0700
commit80a98966c802b76bb5afd7d59025c9db4b1bc9d8 (patch)
tree4d7da75d77fdce6c05af7ba2a5851098b7afcd69 /sysdeps/powerpc/powerpc32
parent3f241d758415e050269ebd9b3b909f3d007f89e5 (diff)
downloadglibc-80a98966c802b76bb5afd7d59025c9db4b1bc9d8.tar.gz
glibc-80a98966c802b76bb5afd7d59025c9db4b1bc9d8.tar.xz
glibc-80a98966c802b76bb5afd7d59025c9db4b1bc9d8.zip
Fix text relocation on ppc32.
The ____longjmp_chk implementation didn't load from memory the
right way.
Diffstat (limited to 'sysdeps/powerpc/powerpc32')
-rw-r--r--sysdeps/powerpc/powerpc32/____longjmp_chk.S23
1 files changed, 21 insertions, 2 deletions
diff --git a/sysdeps/powerpc/powerpc32/____longjmp_chk.S b/sysdeps/powerpc/powerpc32/____longjmp_chk.S
index 5c1f648661..510ce5250d 100644
--- a/sysdeps/powerpc/powerpc32/____longjmp_chk.S
+++ b/sysdeps/powerpc/powerpc32/____longjmp_chk.S
@@ -26,11 +26,30 @@
 
 #define __longjmp ____longjmp_chk
 
+#ifdef PIC
+# ifdef HAVE_ASM_PPC_REL16
+#  define LOAD_ARG \
+	bcl	20,31,1f;				\
+1:	mflr	r3;					\
+	addis	r3,r3,_GLOBAL_OFFSET_TABLE_-1b@ha;	\
+	addi	r3,r3,_GLOBAL_OFFSET_TABLE_-1b@l;	\
+	lwz	r3,.LC0@got(r3)
+# else
+#  define LOAD_ARG \
+	bl	_GLOBAL_OFFSET_TABLE_-4@local;		\
+	mflr	r3;					\
+	lwz	r3,.LC0@got(r3)
+# endif
+#else
+# define LOAD_ARG \
+	lis	r3,.LC0@ha;				\
+	la	r3,.LC0@l(r3)
+#endif
+
 #define CHECK_SP(reg) \
 	cmplw	reg, r1;				\
 	bge+	.Lok;					\
-	lis	r3,.LC0@ha;				\
-	la	r3,.LC0@l(r3);				\
+	LOAD_ARG;					\
 	bl	HIDDEN_JUMPTARGET (__fortify_fail);	\
 .Lok: