about summary refs log tree commit diff
path: root/sysdeps/powerpc/nptl/tls.h
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2021-01-11 23:56:32 -0800
committerFangrui Song <maskray@google.com>2021-01-11 23:56:32 -0800
commit0b11ca56fe0473a41a6e9cdc5d228c7d1e0d6d72 (patch)
tree6d9013a7b236e33deee47f247f71aa60eec06477 /sysdeps/powerpc/nptl/tls.h
parent87d583c6e8cd0e49f64da76636ebeec033298b4d (diff)
downloadglibc-maskray/stack_chk_guard.tar.gz
glibc-maskray/stack_chk_guard.tar.xz
glibc-maskray/stack_chk_guard.zip
Unconditionally define __stack_chk_guard [BZ #26817] maskray/stack_chk_guard
__stack_chk_guard is currently unavailable on architectures which define
THREAD_SET_STACK_GUARD, so {gcc,clang} -fstack-protector
-mstack-protector-guard=global will fail to link due to the undefined
symbol.

Define __stack_chk_guard to make -mstack-protector-guard=global compiled
user programs work. `#define THREAD_SET_STACK_GUARD` code is moved
outside of `#ifndef __ASSEMBLER__` so that cpp can preprocess
elf/Versions.
Diffstat (limited to 'sysdeps/powerpc/nptl/tls.h')
-rw-r--r--sysdeps/powerpc/nptl/tls.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h
index 6c779b6609..db56e04f81 100644
--- a/sysdeps/powerpc/nptl/tls.h
+++ b/sysdeps/powerpc/nptl/tls.h
@@ -33,6 +33,16 @@
 # include <asm/ptrace.h>
 #endif /* __ASSEMBLER__ */
 
+/* Set the stack guard field in TCB head. Used by elf/Versions.  */
+# define THREAD_SET_STACK_GUARD(value) \
+    (((tcbhead_t *) ((char *) __thread_register				      \
+		     - TLS_TCB_OFFSET))[-1].stack_guard = (value))
+# define THREAD_COPY_STACK_GUARD(descr) \
+    (((tcbhead_t *) ((char *) (descr)					      \
+		     + TLS_PRE_TCB_SIZE))[-1].stack_guard		      \
+     = ((tcbhead_t *) ((char *) __thread_register			      \
+		       - TLS_TCB_OFFSET))[-1].stack_guard)
+
 #ifndef __powerpc64__
 /* Register r2 (tp) is reserved by the ABI as "thread pointer". */
 # define PT_THREAD_POINTER PT_R2
@@ -192,16 +202,6 @@ typedef struct
     ((void)(descr), (THREAD_SELF)->member[idx] = (value))
 
 /* Set the stack guard field in TCB head.  */
-# define THREAD_SET_STACK_GUARD(value) \
-    (((tcbhead_t *) ((char *) __thread_register				      \
-		     - TLS_TCB_OFFSET))[-1].stack_guard = (value))
-# define THREAD_COPY_STACK_GUARD(descr) \
-    (((tcbhead_t *) ((char *) (descr)					      \
-		     + TLS_PRE_TCB_SIZE))[-1].stack_guard		      \
-     = ((tcbhead_t *) ((char *) __thread_register			      \
-		       - TLS_TCB_OFFSET))[-1].stack_guard)
-
-/* Set the stack guard field in TCB head.  */
 # define THREAD_GET_POINTER_GUARD() \
     (((tcbhead_t *) ((char *) __thread_register				      \
 		     - TLS_TCB_OFFSET))[-1].pointer_guard)