about summary refs log tree commit diff
path: root/sysdeps/unix/sparc/sysdep.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-08-31 17:30:41 -0700
committerDavid S. Miller <davem@davemloft.net>2011-08-31 17:30:41 -0700
commit3ba575169aabc83993759305c0394f58ad1ce3e0 (patch)
tree2bf92385cc95e68e1e2d8b2ba79451fb6abbaf05 /sysdeps/unix/sparc/sysdep.h
parent523df511514331a7fa0668b37a917b52f71684af (diff)
downloadglibc-3ba575169aabc83993759305c0394f58ad1ce3e0.tar.gz
glibc-3ba575169aabc83993759305c0394f58ad1ce3e0.tar.xz
glibc-3ba575169aabc83993759305c0394f58ad1ce3e0.zip
Fix sparc localplt testcase failures. carlos/master
Diffstat (limited to 'sysdeps/unix/sparc/sysdep.h')
-rw-r--r--sysdeps/unix/sparc/sysdep.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sysdeps/unix/sparc/sysdep.h b/sysdeps/unix/sparc/sysdep.h
index 24225d9622..c8f4ccafa6 100644
--- a/sysdeps/unix/sparc/sysdep.h
+++ b/sysdeps/unix/sparc/sysdep.h
@@ -27,6 +27,26 @@
 #define	syscall_error	C_SYMBOL_NAME(__syscall_error)
 #endif
 
+#ifdef PIC
+#define SETUP_PIC_REG(reg, tmp)						\
+	.ifndef __sparc_get_pc_thunk.reg;				\
+	.section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
+	.align	 32;							\
+	.weak	 __sparc_get_pc_thunk.reg;				\
+	.hidden	 __sparc_get_pc_thunk.reg;				\
+	.type	 __sparc_get_pc_thunk.reg, #function;			\
+__sparc_get_pc_thunk.reg:		   				\
+	jmp	%o7 + 8;						\
+	 add	%o7, %reg, %##reg;					\
+	.previous;							\
+	.endif;								\
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %##reg;			\
+	mov	%o7, %##tmp;		      				\
+	call	__sparc_get_pc_thunk.reg;				\
+	 or	%##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg;		\
+	mov	%##tmp, %o7;
+#endif
+
 #ifdef HAVE_ELF
 #define	ENTRY(name)		\
   .global C_SYMBOL_NAME(name);	\