linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] include/linux/compiler-clang.h: define __naked
@ 2018-09-10  6:04 Stefan Agner
  2018-09-10 12:14 ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Agner @ 2018-09-10  6:04 UTC (permalink / raw)
  To: torvalds, ndesaulniers
  Cc: akpm, keescook, tglx, mingo, aryabinin, will.deacon, linux, dwmw,
	paullawrence, arnd, linux-arm-kernel, linux-kernel, Stefan Agner

ARM32 arch code uses the __naked attribute. This has previously been
defined in include/linux/compiler-gcc.h, which is no longer included
for Clang. Define __naked for Clang. Conservatively add all attributes
previously used (and supported by Clang).

This fixes compile errors when building ARM32 using Clang:
  arch/arm/mach-exynos/mcpm-exynos.c:193:13: error: variable has incomplete type 'void'
  static void __naked exynos_pm_power_up_setup(unsigned int affinity_level)
              ^

Fixes: 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive")
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 include/linux/compiler-clang.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index b1ce500fe8b3..a593e3ac0720 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -23,6 +23,12 @@
 
 #define __no_sanitize_address __attribute__((no_sanitize("address")))
 
+/*
+ * ARM32 is currently the only user of __naked supported by Clang. Follow
+ * gcc: Do not trace naked functions and make sure they don't get inlined.
+ */
+#define __naked __attribute__((naked)) noinline notrace
+
 /*
  * Not all versions of clang implement the the type-generic versions
  * of the builtin overflow checkers. Fortunately, clang implements
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-13 22:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10  6:04 [PATCH] include/linux/compiler-clang.h: define __naked Stefan Agner
2018-09-10 12:14 ` Arnd Bergmann
2018-09-10 16:51   ` Nick Desaulniers
2018-09-12  4:19   ` Miguel Ojeda
2018-09-13  4:02     ` Miguel Ojeda
2018-09-13 22:20       ` Nick Desaulniers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).