From: behanw@converseincode.com
To: mmarek@suse.cz, tglx@linutronix.de, mingo@redhat.com,
hpa@zytor.com, x86@kernel.org, sparse@chrisli.org
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sparse@vger.kernel.org, torvalds@linux-foundation.org,
dwmw2@infradead.org, pageexec@freemail.hu,
Mark Charlebois <charlebm@gmail.com>,
Behan Webster <behanw@converseincode.com>
Subject: [PATCH 4/5] LLVMLinux: Add support for clang to compiler.h and new compiler-clang.h
Date: Tue, 25 Feb 2014 17:08:42 -0800 [thread overview]
Message-ID: <1393376923-21892-5-git-send-email-behanw@converseincode.com> (raw)
In-Reply-To: <1393376923-21892-1-git-send-email-behanw@converseincode.com>
From: Mark Charlebois <charlebm@gmail.com>
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 | 12 ++++++++++++
include/linux/compiler.h | 7 +++++++
2 files changed, 19 insertions(+)
create mode 100644 include/linux/compiler-clang.h
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
new file mode 100644
index 0000000..d1e49d5
--- /dev/null
+++ b/include/linux/compiler-clang.h
@@ -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
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2472740..ee7239e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -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
--
1.8.3.2
next prev parent reply other threads:[~2014-02-26 1:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 1:08 [PATCH 0/5] kbuild: LLVMLinux: Initial updates to kbuild to enable the kernel to be compiled with clang/LLVM behanw
2014-02-26 1:08 ` [PATCH 1/5] kbuild: LLVMLinux: Add Kbuild support for building kernel with Clang behanw
2014-03-09 21:58 ` Sam Ravnborg
2014-03-11 6:58 ` Behan Webster
2014-03-11 21:26 ` [PATCH 1/5 v2] " behanw
2014-02-26 1:08 ` [PATCH 2/5] kbuild: LLVMLinux: Adapt warnings for compilation with clang behanw
2014-02-26 1:17 ` Dave Jones
2014-02-26 1:31 ` Behan Webster
2014-02-26 1:34 ` H. Peter Anvin
2014-02-26 2:38 ` Behan Webster
2014-03-06 17:59 ` [PATCH 2/5 v2] " behanw
2014-02-26 1:08 ` [PATCH 3/5] kbuild: LLVMLinux: Fix LINUX_COMPILER definition script " behanw
2014-02-26 1:08 ` behanw [this message]
2014-02-26 1:08 ` [PATCH 5/5] x86 kbuild: LLVMLinux: More cc-options added for clang behanw
2014-02-26 1:32 ` H. Peter Anvin
2014-02-26 1:44 ` Behan Webster
2014-03-06 18:03 ` [PATCH 5/5 v2] " behanw
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393376923-21892-5-git-send-email-behanw@converseincode.com \
--to=behanw@converseincode.com \
--cc=charlebm@gmail.com \
--cc=dwmw2@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mmarek@suse.cz \
--cc=pageexec@freemail.hu \
--cc=sparse@chrisli.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).