Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

LLVMLinux: Add support for clang to compiler.h and new compiler-clang.h

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>

authored by

Mark Charlebois and committed by
Behan Webster
565cbdc2 aa93685a

+19
+12
include/linux/compiler-clang.h
··· 1 + #ifndef __LINUX_COMPILER_H 2 + #error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead." 3 + #endif 4 + 5 + /* Some compiler specific definitions are overwritten here 6 + * for Clang compiler 7 + */ 8 + 9 + #ifdef uninitialized_var 10 + #undef uninitialized_var 11 + #define uninitialized_var(x) x = *(&(x)) 12 + #endif
+7
include/linux/compiler.h
··· 63 63 # include <linux/compiler-intel.h> 64 64 #endif 65 65 66 + /* Clang compiler defines __GNUC__. So we will overwrite implementations 67 + * coming from above header files here 68 + */ 69 + #ifdef __clang__ 70 + #include <linux/compiler-clang.h> 71 + #endif 72 + 66 73 /* 67 74 * Generic compiler-dependent macros required for kernel 68 75 * build go below this comment. Actual compiler/compiler version