diff options
author | Thomas Weißschuh <linux@weissschuh.net> | 2023-04-17 18:01:35 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2023-06-09 11:46:08 -0700 |
commit | ca2d0437141681cf3d446e7002692c3617a5bd28 (patch) | |
tree | a71c3c483cf6fb26929124045b0b35717bf74230 /tools/include | |
parent | ed6c0d89bb391c736850e79dbc82aea5e078a941 (diff) |
tools/nolibc: loongarch: add stackprotector support
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/include')
-rw-r--r-- | tools/include/nolibc/arch-loongarch.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/include/nolibc/arch-loongarch.h b/tools/include/nolibc/arch-loongarch.h index ec3b46a991a9..07e3b1fd7262 100644 --- a/tools/include/nolibc/arch-loongarch.h +++ b/tools/include/nolibc/arch-loongarch.h @@ -149,6 +149,8 @@ char **environ __attribute__((weak)); const unsigned long *_auxv __attribute__((weak)); +#define __ARCH_SUPPORTS_STACK_PROTECTOR + #if __loongarch_grlen == 32 #define LONGLOG "2" #define SZREG "4" @@ -170,9 +172,12 @@ const unsigned long *_auxv __attribute__((weak)); #endif /* startup code */ -void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void) +void __attribute__((weak,noreturn,optimize("omit-frame-pointer"),no_stack_protector)) _start(void) { __asm__ volatile ( +#ifdef NOLIBC_STACKPROTECTOR + "bl __stack_chk_init\n" /* initialize stack protector */ +#endif REG_L " $a0, $sp, 0\n" /* argc (a0) was in the stack */ LONG_ADDI " $a1, $sp, "SZREG"\n" /* argv (a1) = sp + SZREG */ LONG_SLL " $a2, $a0, "LONGLOG"\n" /* envp (a2) = SZREG*argc ... */ |