GNU Linux-libre 6.8.7-gnu
[releases.git] / tools / include / nolibc / compiler.h
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2 /*
3  * NOLIBC compiler support header
4  * Copyright (C) 2023 Thomas Weißschuh <linux@weissschuh.net>
5  */
6 #ifndef _NOLIBC_COMPILER_H
7 #define _NOLIBC_COMPILER_H
8
9 #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) || defined(__SSP_EXPLICIT__)
10
11 #define _NOLIBC_STACKPROTECTOR
12
13 #endif /* defined(__SSP__) ... */
14
15 #if defined(__has_attribute)
16 #  if __has_attribute(no_stack_protector)
17 #    define __no_stack_protector __attribute__((no_stack_protector))
18 #  else
19 #    define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
20 #  endif
21 #else
22 #  define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
23 #endif /* defined(__has_attribute) */
24
25 #endif /* _NOLIBC_COMPILER_H */