xref: /openbmc/linux/tools/include/nolibc/compiler.h (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1818924d1SThomas Weißschuh /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2818924d1SThomas Weißschuh /*
3818924d1SThomas Weißschuh  * NOLIBC compiler support header
4818924d1SThomas Weißschuh  * Copyright (C) 2023 Thomas Weißschuh <linux@weissschuh.net>
5818924d1SThomas Weißschuh  */
6818924d1SThomas Weißschuh #ifndef _NOLIBC_COMPILER_H
7818924d1SThomas Weißschuh #define _NOLIBC_COMPILER_H
8818924d1SThomas Weißschuh 
9818924d1SThomas Weißschuh #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) || defined(__SSP_EXPLICIT__)
10818924d1SThomas Weißschuh 
11818924d1SThomas Weißschuh #define _NOLIBC_STACKPROTECTOR
12818924d1SThomas Weißschuh 
13818924d1SThomas Weißschuh #endif /* defined(__SSP__) ... */
14818924d1SThomas Weißschuh 
15*e76b70deSThomas Weißschuh #if defined(__has_attribute)
16*e76b70deSThomas Weißschuh #  if __has_attribute(no_stack_protector)
17*e76b70deSThomas Weißschuh #    define __no_stack_protector __attribute__((no_stack_protector))
18*e76b70deSThomas Weißschuh #  else
19*e76b70deSThomas Weißschuh #    define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
20*e76b70deSThomas Weißschuh #  endif
21*e76b70deSThomas Weißschuh #else
22*e76b70deSThomas Weißschuh #  define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
23*e76b70deSThomas Weißschuh #endif /* defined(__has_attribute) */
24*e76b70deSThomas Weißschuh 
25818924d1SThomas Weißschuh #endif /* _NOLIBC_COMPILER_H */
26