aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/sparc
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/sparc
parent87d583c6e8cd0e49f64da76636ebeec033298b4d (diff)
downloadglibc-maskray/stack_chk_guard.zip
glibc-maskray/stack_chk_guard.tar.gz
glibc-maskray/stack_chk_guard.tar.bz2
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/sparc')
-rw-r--r--sysdeps/sparc/nptl/tls.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/sysdeps/sparc/nptl/tls.h b/sysdeps/sparc/nptl/tls.h
index dd1eb82..764fae5 100644
--- a/sysdeps/sparc/nptl/tls.h
+++ b/sysdeps/sparc/nptl/tls.h
@@ -51,6 +51,12 @@ typedef struct
# include <tcb-offsets.h>
#endif /* __ASSEMBLER__ */
+/* Set the stack guard field in TCB head. Referenced by elf/Versions. */
+#define THREAD_SET_STACK_GUARD(value) \
+ THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)
+# define THREAD_COPY_STACK_GUARD(descr) \
+ ((descr)->header.stack_guard \
+ = THREAD_GETMEM (THREAD_SELF, header.stack_guard))
#ifndef __ASSEMBLER__
/* Get system call information. */
@@ -122,13 +128,6 @@ register struct pthread *__thread_self __asm__("%g7");
#define THREAD_SETMEM_NC(descr, member, idx, value) \
descr->member[idx] = (value)
-/* Set the stack guard field in TCB head. */
-#define THREAD_SET_STACK_GUARD(value) \
- THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)
-# define THREAD_COPY_STACK_GUARD(descr) \
- ((descr)->header.stack_guard \
- = THREAD_GETMEM (THREAD_SELF, header.stack_guard))
-
/* Get/set the stack guard field in TCB head. */
#define THREAD_GET_POINTER_GUARD() \
THREAD_GETMEM (THREAD_SELF, header.pointer_guard)