about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/i386/sysdep.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-02-08 06:48:30 +0000
committerUlrich Drepper <drepper@redhat.com>2005-02-08 06:48:30 +0000
commitdbfc1e02671b7ed137272af79751b534613a9326 (patch)
tree92e0de6a9dd622102f766a1519b84dd29ee72694 /sysdeps/unix/sysv/linux/i386/sysdep.h
parentbc82059d34cc5679b5bdaf854b864de3eb0562db (diff)
downloadglibc-dbfc1e02671b7ed137272af79751b534613a9326.tar.gz
glibc-dbfc1e02671b7ed137272af79751b534613a9326.tar.xz
glibc-dbfc1e02671b7ed137272af79751b534613a9326.zip
(check_consistency): Define.
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/sysdep.h')
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index cfa030b324..6bea9d2044 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -540,6 +540,29 @@ asm (".L__X'%ebx = 1\n\t"
 # define EXTRAVAR_5
 #endif
 
+/* Consistency check for position-independent code.  */
+#ifdef __PIC__
+# define check_consistency()						      \
+  ({ int __res;								      \
+     __asm__ __volatile__						      \
+       ("call __i686.get_pc_thunk.cx;"					      \
+	"addl $_GLOBAL_OFFSET_TABLE_, %%ecx;"				      \
+	"subl %%ebx, %%ecx;"						      \
+	"je 1f;"							      \
+	"ud2;"								      \
+	"1:\n"								      \
+	".section .gnu.linkonce.t.__i686.get_pc_thunk.cx,\"ax\",@progbits;"   \
+	".globl __i686.get_pc_thunk.cx;"				      \
+	".hidden __i686.get_pc_thunk.cx;"				      \
+	".type __i686.get_pc_thunk.cx,@function;"			      \
+	"__i686.get_pc_thunk.cx:"					      \
+	"movl (%%esp), %%ecx;"						      \
+	"ret;"								      \
+	".previous"							      \
+	: "=c" (__res));						      \
+     __res; })
+#endif
+
 #endif	/* __ASSEMBLER__ */
 
 #endif /* linux/i386/sysdep.h */