diff options
author | Fangrui Song <maskray@google.com> | 2021-01-11 23:56:32 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2021-01-11 23:56:32 -0800 |
commit | 0b11ca56fe0473a41a6e9cdc5d228c7d1e0d6d72 (patch) | |
tree | 6d9013a7b236e33deee47f247f71aa60eec06477 /csu | |
parent | 87d583c6e8cd0e49f64da76636ebeec033298b4d (diff) | |
download | glibc-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 'csu')
-rw-r--r-- | csu/libc-start.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/csu/libc-start.c b/csu/libc-start.c index db859c3..e46d402 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -33,11 +33,8 @@ extern void __libc_init_first (int argc, char **argv, char **envp); #include <tls.h> #ifndef SHARED # include <dl-osinfo.h> -# ifndef THREAD_SET_STACK_GUARD -/* Only exported for architectures that don't store the stack guard canary - in thread local area. */ +/* Also export to architectures which prefer -mstack-protector-guard=tls. */ uintptr_t __stack_chk_guard attribute_relro; -# endif # ifndef THREAD_SET_POINTER_GUARD /* Only exported for architectures that don't store the pointer guard value in thread local area. */ @@ -206,9 +203,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); # ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD (stack_chk_guard); -# else - __stack_chk_guard = stack_chk_guard; # endif + __stack_chk_guard = stack_chk_guard; # ifdef DL_SYSDEP_OSCHECK { |