summaryrefslogtreecommitdiff
path: root/tools/include
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2023-04-17 18:01:36 +0200
committerPaul E. McKenney <paulmck@kernel.org>2023-06-09 11:46:08 -0700
commit3da0de377b5c93518e894f63766d3555ed883f93 (patch)
tree89ca9650933dd7c465fe8a1e8bcfe7612546a814 /tools/include
parentca2d0437141681cf3d446e7002692c3617a5bd28 (diff)
tools/nolibc: mips: 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-mips.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h
index 8822f150e72f..65c19ccc7f9d 100644
--- a/tools/include/nolibc/arch-mips.h
+++ b/tools/include/nolibc/arch-mips.h
@@ -179,14 +179,20 @@ struct sys_stat_struct {
char **environ __attribute__((weak));
const unsigned long *_auxv __attribute__((weak));
+#define __ARCH_SUPPORTS_STACK_PROTECTOR
+
/* startup code, note that it's called __start on MIPS */
-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 (
/*".set nomips16\n"*/
".set push\n"
".set noreorder\n"
".option pic0\n"
+#ifdef NOLIBC_STACKPROTECTOR
+ "jal __stack_chk_init\n" /* initialize stack protector */
+ "nop\n" /* delayed slot */
+#endif
/*".ent __start\n"*/
/*"__start:\n"*/
"lw $a0,($sp)\n" /* argc was in the stack */