mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
e76b70dec9
Not all compilers, notably GCC < 10, have support for __attribute__((no_stack_protector)). Fall back to a mechanism that also works there. Tested with GCC 9.5.0 from kernel.org crosstools. 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>
26 lines
781 B
C
26 lines
781 B
C
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
|
/*
|
|
* NOLIBC compiler support header
|
|
* Copyright (C) 2023 Thomas Weißschuh <linux@weissschuh.net>
|
|
*/
|
|
#ifndef _NOLIBC_COMPILER_H
|
|
#define _NOLIBC_COMPILER_H
|
|
|
|
#if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) || defined(__SSP_EXPLICIT__)
|
|
|
|
#define _NOLIBC_STACKPROTECTOR
|
|
|
|
#endif /* defined(__SSP__) ... */
|
|
|
|
#if defined(__has_attribute)
|
|
# if __has_attribute(no_stack_protector)
|
|
# define __no_stack_protector __attribute__((no_stack_protector))
|
|
# else
|
|
# define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
|
|
# endif
|
|
#else
|
|
# define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
|
|
#endif /* defined(__has_attribute) */
|
|
|
|
#endif /* _NOLIBC_COMPILER_H */
|