summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/sh
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2010-02-17 23:42:28 -0800
committerKhem Raj <raj.khem@gmail.com>2010-02-17 23:42:28 -0800
commited0915ba70d0ff6ed0a78f45d46822763a580737 (patch)
treec0495c812a983ac354a3c304335d89a4c653b1bc /libc/sysdeps/linux/sh
parentf14c584876271f474025fc06b3dc66ce798bcacb (diff)
Get new nptl building on SH4
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/sh')
-rw-r--r--libc/sysdeps/linux/sh/sysdep.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/sh/sysdep.h b/libc/sysdeps/linux/sh/sysdep.h
index 1d490553d..bd6234292 100644
--- a/libc/sysdeps/linux/sh/sysdep.h
+++ b/libc/sysdeps/linux/sh/sysdep.h
@@ -273,5 +273,24 @@
.align 2; \
1: .long SYS_ify (syscall_name); \
2:
-
#endif /* __ASSEMBLER__ */
+
+/* Pointer mangling support. */
+#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. Using a global variable
+ is too complicated here since we have no PC-relative addressing mode. */
+#else
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg, tmp) \
+ stc gbr,tmp; mov.l @(POINTER_GUARD,tmp),tmp; xor tmp,reg
+# define PTR_MANGLE2(reg, tmp) xor tmp,reg
+# define PTR_DEMANGLE(reg, tmp) PTR_MANGLE (reg, tmp)
+# define PTR_DEMANGLE2(reg, tmp) PTR_MANGLE2 (reg, tmp)
+# else
+# define PTR_MANGLE(var) \
+ (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#endif
+