diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
| -rw-r--r-- | include/linux/compiler-gcc.h | 15 | 
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 @@  #endif  /* + * calling noreturn functions, __builtin_unreachable() and __builtin_trap() + * confuse the stack allocation in gcc, leading to overly large stack + * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365 + * + * Adding an empty inline assembly before it works around the problem + */ +#define barrier_before_unreachable() asm volatile("") + +/*   * Mark a position in code as unreachable.  This can be used to   * suppress control flow warnings after asm blocks that transfer   * control elsewhere. @@ -217,7 +226,11 @@   * unreleased.  Really, we need to have autoconf for the kernel.   */  #define unreachable() \ -	do { annotate_unreachable(); __builtin_unreachable(); } while (0) +	do {					\ +		annotate_unreachable();		\ +		barrier_before_unreachable();	\ +		__builtin_unreachable();	\ +	} while (0)  /* Mark a function definition as prohibited from being cloned. */  #define __noclone	__attribute__((__noclone__, __optimize__("no-tracer")))  |