Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
51 lines
1.6 KiB
C
51 lines
1.6 KiB
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(__has_attribute)
|
|
# define __nolibc_has_attribute(attr) __has_attribute(attr)
|
|
#else
|
|
# define __nolibc_has_attribute(attr) 0
|
|
#endif
|
|
|
|
#if defined(__has_feature)
|
|
# define __nolibc_has_feature(feature) __has_feature(feature)
|
|
#else
|
|
# define __nolibc_has_feature(feature) 0
|
|
#endif
|
|
|
|
#define __nolibc_aligned(alignment) __attribute__((aligned(alignment)))
|
|
#define __nolibc_aligned_as(type) __nolibc_aligned(__alignof__(type))
|
|
|
|
#if __nolibc_has_attribute(naked)
|
|
# define __nolibc_entrypoint __attribute__((naked))
|
|
# define __nolibc_entrypoint_epilogue()
|
|
#else
|
|
# define __nolibc_entrypoint __attribute__((optimize("Os", "omit-frame-pointer")))
|
|
# define __nolibc_entrypoint_epilogue() __builtin_unreachable()
|
|
#endif /* __nolibc_has_attribute(naked) */
|
|
|
|
#if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) || defined(__SSP_EXPLICIT__)
|
|
|
|
#define _NOLIBC_STACKPROTECTOR
|
|
|
|
#endif /* defined(__SSP__) ... */
|
|
|
|
#if __nolibc_has_attribute(no_stack_protector)
|
|
# define __no_stack_protector __attribute__((no_stack_protector))
|
|
#else
|
|
# define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector")))
|
|
#endif /* __nolibc_has_attribute(no_stack_protector) */
|
|
|
|
#if __nolibc_has_attribute(__fallthrough__)
|
|
# define __nolibc_fallthrough do { } while (0); __attribute__((__fallthrough__))
|
|
#else
|
|
# define __nolibc_fallthrough do { } while (0)
|
|
#endif /* __nolibc_has_attribute(fallthrough) */
|
|
|
|
#endif /* _NOLIBC_COMPILER_H */
|