From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Michael Matz <matz@suse.de>,
Michal Marek <mmarek@suse.cz>
Subject: [PATCH] x86, asm-offsets: Guard against building the 32/64-bit versions directly
Date: Tue, 9 Dec 2014 16:45:17 +0100 [thread overview]
Message-ID: <1418139917-12722-1-git-send-email-bp@alien8.de> (raw)
From: Borislav Petkov <bp@suse.de>
Sometimes it is helpful to build a kernel compilation unit directly, i.e.
make .../<filename>.i
in order to look at compiler output.
Since asm-offsets_{32,64}.c are included by asm-offsets.c and building
them directly doesn't evaluate the macros used (thus making the
preprocessor output not very useful), error out when an attempt is made
to build them. Issue a hint for the user to build asm-offsets.c instead.
Suggested-by: Michael Matz <matz@suse.de>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/asm-offsets_32.c | 4 ++++
arch/x86/kernel/asm-offsets_64.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index d67c4be3e8b1..207c48278dff 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -1,3 +1,7 @@
+#ifndef __LINUX_KBUILD_H
+#error "Please do not build this file directly, build asm-offsets.c instead"
+#endif
+
#include <asm/ucontext.h>
#include <linux/lguest.h>
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 4f9359f36bb7..7fcb2312b532 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -1,3 +1,7 @@
+#ifndef __LINUX_KBUILD_H
+#error "Please do not build this file directly, build asm-offsets.c instead"
+#endif
+
#include <asm/ia32.h>
#define __SYSCALL_64(nr, sym, compat) [nr] = 1,
--
2.0.0
next reply other threads:[~2014-12-09 15:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 15:45 Borislav Petkov [this message]
2014-12-11 12:27 ` [tip:x86/urgent] x86/asm: Guard against building the 32/ 64-bit versions of the asm-offsets*.c file directly tip-bot for Borislav Petkov
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=1418139917-12722-1-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=matz@suse.de \
--cc=mmarek@suse.cz \
--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®