aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler-gcc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r--include/linux/compiler-gcc.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 0444b1336268..76e28c229805 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -116,11 +116,13 @@
116 */ 116 */
117#define __pure __attribute__((pure)) 117#define __pure __attribute__((pure))
118#define __aligned(x) __attribute__((aligned(x))) 118#define __aligned(x) __attribute__((aligned(x)))
119#define __aligned_largest __attribute__((aligned))
119#define __printf(a, b) __attribute__((format(printf, a, b))) 120#define __printf(a, b) __attribute__((format(printf, a, b)))
120#define __scanf(a, b) __attribute__((format(scanf, a, b))) 121#define __scanf(a, b) __attribute__((format(scanf, a, b)))
121#define __attribute_const__ __attribute__((__const__)) 122#define __attribute_const__ __attribute__((__const__))
122#define __maybe_unused __attribute__((unused)) 123#define __maybe_unused __attribute__((unused))
123#define __always_unused __attribute__((unused)) 124#define __always_unused __attribute__((unused))
125#define __mode(x) __attribute__((mode(x)))
124 126
125/* gcc version specific checks */ 127/* gcc version specific checks */
126 128
@@ -195,6 +197,17 @@
195#endif 197#endif
196#endif 198#endif
197 199
200#ifdef CONFIG_STACK_VALIDATION
201#define annotate_unreachable() ({ \
202 asm("%c0:\t\n" \
203 ".pushsection __unreachable, \"a\"\t\n" \
204 ".long %c0b\t\n" \
205 ".popsection\t\n" : : "i" (__LINE__)); \
206})
207#else
208#define annotate_unreachable()
209#endif
210
198/* 211/*
199 * Mark a position in code as unreachable. This can be used to 212 * Mark a position in code as unreachable. This can be used to
200 * suppress control flow warnings after asm blocks that transfer 213 * suppress control flow warnings after asm blocks that transfer
@@ -204,7 +217,8 @@
204 * this in the preprocessor, but we can live with this because they're 217 * this in the preprocessor, but we can live with this because they're
205 * unreleased. Really, we need to have autoconf for the kernel. 218 * unreleased. Really, we need to have autoconf for the kernel.
206 */ 219 */
207#define unreachable() __builtin_unreachable() 220#define unreachable() \
221 do { annotate_unreachable(); __builtin_unreachable(); } while (0)
208 222
209/* Mark a function definition as prohibited from being cloned. */ 223/* Mark a function definition as prohibited from being cloned. */
210#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) 224#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))