]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
LLVMLinux: Add support for clang to compiler.h and new compiler-clang.h
authorMark Charlebois <charlebm@gmail.com>
Tue, 20 Nov 2012 21:13:10 +0000 (22:13 +0100)
committerBehan Webster <behanw@converseincode.com>
Wed, 9 Apr 2014 20:44:35 +0000 (13:44 -0700)
Add a compiler-clang.h file to add specific macros needed for compiling the
kernel with clang.

Initially the only override required is the macro for silencing the
compiler for a purposefully uninintialized variable.

Author: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
include/linux/compiler-clang.h [new file with mode: 0644]
include/linux/compiler.h

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
new file mode 100644 (file)
index 0000000..d1e49d5
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
+#endif
+
+/* Some compiler specific definitions are overwritten here
+ * for Clang compiler
+ */
+
+#ifdef uninitialized_var
+#undef uninitialized_var
+#define uninitialized_var(x) x = *(&(x))
+#endif
index 2472740d7ab2201f58d68ce864448b3def30cdaf..ee7239ea1583482b16bfa0b46ebd45714c7babd6 100644 (file)
@@ -63,6 +63,13 @@ extern void __chk_io_ptr(const volatile void __iomem *);
 # include <linux/compiler-intel.h>
 #endif
 
+/* Clang compiler defines __GNUC__. So we will overwrite implementations
+ * coming from above header files here
+ */
+#ifdef __clang__
+#include <linux/compiler-clang.h>
+#endif
+
 /*
  * Generic compiler-dependent macros required for kernel
  * build go below this comment. Actual compiler/compiler version