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.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 73bc63e0a1c4..e2c7f4369eff 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -93,6 +93,10 @@
93#define __weak __attribute__((weak)) 93#define __weak __attribute__((weak))
94#define __alias(symbol) __attribute__((alias(#symbol))) 94#define __alias(symbol) __attribute__((alias(#symbol)))
95 95
96#ifdef RETPOLINE
97#define __noretpoline __attribute__((indirect_branch("keep")))
98#endif
99
96/* 100/*
97 * it doesn't make sense on ARM (currently the only user of __naked) 101 * it doesn't make sense on ARM (currently the only user of __naked)
98 * to trace naked functions because then mcount is called without 102 * to trace naked functions because then mcount is called without
@@ -208,6 +212,15 @@
208#endif 212#endif
209 213
210/* 214/*
215 * calling noreturn functions, __builtin_unreachable() and __builtin_trap()
216 * confuse the stack allocation in gcc, leading to overly large stack
217 * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
218 *
219 * Adding an empty inline assembly before it works around the problem
220 */
221#define barrier_before_unreachable() asm volatile("")
222
223/*
211 * Mark a position in code as unreachable. This can be used to 224 * Mark a position in code as unreachable. This can be used to
212 * suppress control flow warnings after asm blocks that transfer 225 * suppress control flow warnings after asm blocks that transfer
213 * control elsewhere. 226 * control elsewhere.
@@ -217,7 +230,11 @@
217 * unreleased. Really, we need to have autoconf for the kernel. 230 * unreleased. Really, we need to have autoconf for the kernel.
218 */ 231 */
219#define unreachable() \ 232#define unreachable() \
220 do { annotate_unreachable(); __builtin_unreachable(); } while (0) 233 do { \
234 annotate_unreachable(); \
235 barrier_before_unreachable(); \
236 __builtin_unreachable(); \
237 } while (0)
221 238
222/* Mark a function definition as prohibited from being cloned. */ 239/* Mark a function definition as prohibited from being cloned. */
223#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) 240#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))