aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/compiler-gcc.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2018-03-20 10:56:18 +0100
committerThomas Gleixner <tglx@linutronix.de>2018-03-20 10:56:18 +0100
commitedc39c9b4589a4ce9a69273b5a27a1459c3423d4 (patch)
treee5850fe4a533579b0de12c02e48f7dcdd60e8e38 /include/linux/compiler-gcc.h
parentx86/build: Drop superfluous ALIGN from the linker script (diff)
parentMerge branch 'for-4.16-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup (diff)
downloadwireguard-linux-edc39c9b4589a4ce9a69273b5a27a1459c3423d4.tar.xz
wireguard-linux-edc39c9b4589a4ce9a69273b5a27a1459c3423d4.zip
Merge branch 'linus' into x86/build to pick up dependencies
Diffstat (limited to '')
-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 @@
#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")))