aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-12-18 16:59:55 +0000
committerUlrich Drepper <drepper@redhat.com>2005-12-18 16:59:55 +0000
commit3467f5c369a10ef19c8df38fb282c7763f36d66f (patch)
tree7d6afe114581e5efe3ea88abc9acf07185a500ac /sysdeps
parent827b70873b41363c864fb65e99829204595d0f85 (diff)
downloadglibc-3467f5c369a10ef19c8df38fb282c7763f36d66f.zip
glibc-3467f5c369a10ef19c8df38fb282c7763f36d66f.tar.gz
glibc-3467f5c369a10ef19c8df38fb282c7763f36d66f.tar.bz2
* sysdeps/unix/sysv/linux/i386/sysdep.h: Define PTR_MANGLE and
PTR_DEMANGLE for C code in libc. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h13
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h21
2 files changed, 28 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 929c6e5..cb57679 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -565,8 +565,17 @@ asm (".L__X'%ebx = 1\n\t"
earlier than the descriptor is initialized. Using a global variable
is too complicated here since we have no PC-relative addressing mode. */
#else
-# define PTR_MANGLE(reg) xorl %gs:POINTER_GUARD, reg
-# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg) xorl %gs:POINTER_GUARD, reg
+# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# else
+# define PTR_MANGLE(var) asm ("xorl %%gs:%c2, %0" \
+ : "=r" (var) \
+ : "0" (var), \
+ "i" (offsetof (tcbhead_t, \
+ pointer_guard)))
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
#endif
#endif /* linux/i386/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 2ea69c3..bb0b604 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -316,11 +316,24 @@
#if defined NOT_IN_libc && defined IS_IN_rtld
/* We cannot use the thread descriptor because in ld.so we use setjmp
earlier than the descriptor is initialized. */
-# define PTR_MANGLE(reg) xorq __pointer_chk_guard_local(%rip), reg
-# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg) xorq __pointer_chk_guard_local(%rip), reg
+# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# else
+# error "Define these if necessary"
+# endif
#else
-# define PTR_MANGLE(reg) xorq %fs:POINTER_GUARD, reg
-# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg) xorq %fs:POINTER_GUARD, reg
+# define PTR_DEMANGLE(reg) PTR_MANGLE (reg)
+# else
+# define PTR_MANGLE(var) asm ("xorq %%fs:%c2, %0" \
+ : "=r" (var) \
+ : "0" (var), \
+ "i" (offsetof (tcbhead_t, \
+ pointer_guard)))
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
#endif
#endif /* linux/x86_64/sysdep.h */