diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
| -rw-r--r-- | include/linux/compiler-gcc.h | 19 | 
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 @@  #define __weak		__attribute__((weak))  #define __alias(symbol)	__attribute__((alias(#symbol))) +#ifdef RETPOLINE +#define __noretpoline __attribute__((indirect_branch("keep"))) +#endif +  /*   * it doesn't make sense on ARM (currently the only user of __naked)   * to trace naked functions because then mcount is called without @@ -208,6 +212,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 +230,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"))) |