1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */ 1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */ 2 /* 2 /* 3 * NOLIBC compiler support header 3 * NOLIBC compiler support header 4 * Copyright (C) 2023 Thomas Weißschuh <linux 4 * Copyright (C) 2023 Thomas Weißschuh <linux@weissschuh.net> 5 */ 5 */ 6 #ifndef _NOLIBC_COMPILER_H 6 #ifndef _NOLIBC_COMPILER_H 7 #define _NOLIBC_COMPILER_H 7 #define _NOLIBC_COMPILER_H 8 8 9 #if defined(__has_attribute) << 10 # define __nolibc_has_attribute(attr) __has_a << 11 #else << 12 # define __nolibc_has_attribute(attr) 0 << 13 #endif << 14 << 15 #if __nolibc_has_attribute(naked) << 16 # define __nolibc_entrypoint __attribute__((n << 17 # define __nolibc_entrypoint_epilogue() << 18 #else << 19 # define __nolibc_entrypoint __attribute__((o << 20 # define __nolibc_entrypoint_epilogue() __bui << 21 #endif /* __nolibc_has_attribute(naked) */ << 22 << 23 #if defined(__SSP__) || defined(__SSP_STRONG__ 9 #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) || defined(__SSP_EXPLICIT__) 24 10 25 #define _NOLIBC_STACKPROTECTOR 11 #define _NOLIBC_STACKPROTECTOR 26 12 27 #endif /* defined(__SSP__) ... */ 13 #endif /* defined(__SSP__) ... */ 28 14 29 #if __nolibc_has_attribute(no_stack_protector) !! 15 #if defined(__has_attribute) 30 # define __no_stack_protector __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 31 #else 21 #else 32 # define __no_stack_protector __attribute__(( 22 # define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector"))) 33 #endif /* __nolibc_has_attribute(no_stack_prot !! 23 #endif /* defined(__has_attribute) */ 34 24 35 #endif /* _NOLIBC_COMPILER_H */ 25 #endif /* _NOLIBC_COMPILER_H */ 36 26
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.