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.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 73bc63e0a1c4..901c1ccb3374 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -208,6 +208,15 @@
208#endif 208#endif
209 209
210/* 210/*
211 * calling noreturn functions, __builtin_unreachable() and __builtin_trap()
212 * confuse the stack allocation in gcc, leading to overly large stack
213 * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
214 *
215 * Adding an empty inline assembly before it works around the problem
216 */
217#define barrier_before_unreachable() asm volatile("")
218
219/*
211 * Mark a position in code as unreachable. This can be used to 220 * Mark a position in code as unreachable. This can be used to
212 * suppress control flow warnings after asm blocks that transfer 221 * suppress control flow warnings after asm blocks that transfer
213 * control elsewhere. 222 * control elsewhere.
@@ -217,7 +226,11 @@
217 * unreleased. Really, we need to have autoconf for the kernel. 226 * unreleased. Really, we need to have autoconf for the kernel.
218 */ 227 */
219#define unreachable() \ 228#define unreachable() \
220 do { annotate_unreachable(); __builtin_unreachable(); } while (0) 229 do { \
230 annotate_unreachable(); \
231 barrier_before_unreachable(); \
232 __builtin_unreachable(); \
233 } while (0)
221 234
222/* Mark a function definition as prohibited from being cloned. */ 235/* Mark a function definition as prohibited from being cloned. */
223#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) 236#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))