tools/nolibc: stackprotector.h: add empty __stack_chk_init for !_NOLIBC_STACKPROTECTOR
authorZhangjin Wu <falcon@tinylab.org>
Sat, 15 Jul 2023 18:22:15 +0000 (02:22 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Aug 2023 02:40:22 +0000 (04:40 +0200)
Let's define an empty __stack_chk_init for the !_NOLIBC_STACKPROTECTOR
branch.

This allows to remove #ifdef around every call of __stack_chk_init().

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
tools/include/nolibc/stackprotector.h

index 88f7b2d..b620f2b 100644 (file)
@@ -45,6 +45,8 @@ void __stack_chk_init(void)
        if (__stack_chk_guard != (uintptr_t) &__stack_chk_guard)
                __stack_chk_guard ^= (uintptr_t) &__stack_chk_guard;
 }
+#else /* !defined(_NOLIBC_STACKPROTECTOR) */
+__inline__ void __stack_chk_init(void) {}
 #endif /* defined(_NOLIBC_STACKPROTECTOR) */
 
 #endif /* _NOLIBC_STACKPROTECTOR_H */