From: Nick Desaulniers <ndesaulniers@google.com>
To: bp@alien8.de
Cc: natechancellor@gmail.com, niravd@google.com,
sfr@canb.auug.org.au, Nick Desaulniers <ndesaulniers@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Chao Fan <fanc.fnst@cn.fujitsu.com>,
Uros Bizjak <ubizjak@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v4] x86/boot: clean up headers
Date: Thu, 14 Mar 2019 15:14:57 -0700 [thread overview]
Message-ID: <20190314221458.83047-1-ndesaulniers@google.com> (raw)
In-Reply-To: <20190305085707.GA8256@zn.tnic>
The inclusion of <linux/kernel.h> was causing issue as the definition of
__arch_hweight64 from arch/x86/include/asm/arch_hweight.h eventually gets
included. The definition is problematic when compiled with -m16 (all code
in arch/x86/boot/ is) as the "D" inline assembly constraint is rejected
by both compilers when passed an argument of type long long (regardless
of signedness, anything smaller is fine).
Because GCC performs inlining before semantic analysis, and
__arch_hweight64 is dead in this translation unit, GCC does not report
any issues at compile time. Clang does the semantic analysis in the
front end, before inlining (run in the middle) can determine the code is
dead. I consider this another case of PR33587, which I think we can do
more work to solve.
It turns out that arch/x86/boot/string.c doesn't actually need
linux/kernel.h, simply linux/limits.h and linux/compiler.h.
Link: https://bugs.llvm.org/show_bug.cgi?id=33587
Link: https://github.com/ClangBuiltLinux/linux/issues/347
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes V3 -> V4:
* Drop sentence from commit message about sorting headers.
Changes V2 -> V3:
* keep linux/types.h
Changes V1 -> V2:
* Add Reviewed, Tested, Suggested tags.
* Drop linux/types.h; it's included in linux/limits.h.
arch/x86/boot/string.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 315a67b8896b..90154df8f125 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -13,8 +13,9 @@
*/
#include <linux/types.h>
-#include <linux/kernel.h>
+#include <linux/compiler.h>
#include <linux/errno.h>
+#include <linux/limits.h>
#include <asm/asm.h>
#include "ctype.h"
#include "string.h"
--
2.21.0.360.g471c308f928-goog
next prev parent reply other threads:[~2019-03-14 22:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-02 0:07 [PATCH] " Nick Desaulniers
2019-03-02 0:13 ` Nathan Chancellor
2019-03-02 2:27 ` Stephen Rothwell
2019-03-02 2:30 ` Stephen Rothwell
2019-03-04 17:50 ` [PATCH v2] " Nick Desaulniers
2019-03-04 22:51 ` Stephen Rothwell
2019-03-05 0:12 ` [PATCH v3] " Nick Desaulniers
2019-03-05 0:15 ` Nick Desaulniers
2019-03-05 8:57 ` Borislav Petkov
2019-03-14 22:14 ` Nick Desaulniers [this message]
2019-03-21 11:28 ` [tip:x86/urgent] x86/boot: Restrict header scope to make Clang happy tip-bot for Nick Desaulniers
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=20190314221458.83047-1-ndesaulniers@google.com \
--to=ndesaulniers@google.com \
--cc=bp@alien8.de \
--cc=fanc.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=natechancellor@gmail.com \
--cc=niravd@google.com \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=ubizjak@gmail.com \
--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
all inboxes | Powered by JetHome®