0001
0002 #ifndef __LINUX_COMPILER_TYPES_H
0003 #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
0004 #endif
0005
0006
0007
0008
0009 #define GCC_VERSION (__GNUC__ * 10000 \
0010 + __GNUC_MINOR__ * 100 \
0011 + __GNUC_PATCHLEVEL__)
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #define RELOC_HIDE(ptr, off) \
0032 ({ \
0033 unsigned long __ptr; \
0034 __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
0035 (typeof(ptr)) (__ptr + (off)); \
0036 })
0037
0038 #ifdef CONFIG_RETPOLINE
0039 #define __noretpoline __attribute__((__indirect_branch__("keep")))
0040 #endif
0041
0042 #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
0043
0044 #if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
0045 #define __latent_entropy __attribute__((latent_entropy))
0046 #endif
0047
0048
0049
0050
0051
0052
0053
0054
0055 #define barrier_before_unreachable() asm volatile("")
0056
0057
0058
0059
0060
0061
0062 #define unreachable() \
0063 do { \
0064 annotate_unreachable(); \
0065 barrier_before_unreachable(); \
0066 __builtin_unreachable(); \
0067 } while (0)
0068
0069 #if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP)
0070 #define __HAVE_BUILTIN_BSWAP32__
0071 #define __HAVE_BUILTIN_BSWAP64__
0072 #define __HAVE_BUILTIN_BSWAP16__
0073 #endif
0074
0075 #if GCC_VERSION >= 70000
0076 #define KASAN_ABI_VERSION 5
0077 #else
0078 #define KASAN_ABI_VERSION 4
0079 #endif
0080
0081 #ifdef CONFIG_SHADOW_CALL_STACK
0082 #define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
0083 #endif
0084
0085 #if __has_attribute(__no_sanitize_address__)
0086 #define __no_sanitize_address __attribute__((no_sanitize_address))
0087 #else
0088 #define __no_sanitize_address
0089 #endif
0090
0091 #if defined(__SANITIZE_THREAD__) && __has_attribute(__no_sanitize_thread__)
0092 #define __no_sanitize_thread __attribute__((no_sanitize_thread))
0093 #else
0094 #define __no_sanitize_thread
0095 #endif
0096
0097 #if __has_attribute(__no_sanitize_undefined__)
0098 #define __no_sanitize_undefined __attribute__((no_sanitize_undefined))
0099 #else
0100 #define __no_sanitize_undefined
0101 #endif
0102
0103 #if defined(CONFIG_KCOV) && __has_attribute(__no_sanitize_coverage__)
0104 #define __no_sanitize_coverage __attribute__((no_sanitize_coverage))
0105 #else
0106 #define __no_sanitize_coverage
0107 #endif
0108
0109
0110
0111
0112
0113 #ifdef __SANITIZE_HWADDRESS__
0114 #define __SANITIZE_ADDRESS__
0115 #endif
0116
0117
0118
0119
0120
0121 #define __diag_GCC(version, severity, s) \
0122 __diag_GCC_ ## version(__diag_GCC_ ## severity s)
0123
0124
0125 #define __diag_GCC_ignore ignored
0126 #define __diag_GCC_warn warning
0127 #define __diag_GCC_error error
0128
0129 #define __diag_str1(s) #s
0130 #define __diag_str(s) __diag_str1(s)
0131 #define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
0132
0133 #if GCC_VERSION >= 80000
0134 #define __diag_GCC_8(s) __diag(s)
0135 #else
0136 #define __diag_GCC_8(s)
0137 #endif
0138
0139 #define __diag_ignore_all(option, comment) \
0140 __diag_GCC(8, ignore, option)
0141
0142
0143
0144
0145
0146 #if GCC_VERSION < 90100
0147 #undef __alloc_size__
0148 #endif