[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1418139917-12722-1-git-send-email-bp@alien8.de>
Date: Tue, 9 Dec 2014 16:45:17 +0100
From: Borislav Petkov <bp@...en8.de>
To: X86 ML <x86@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Michael Matz <matz@...e.de>,
Michal Marek <mmarek@...e.cz>
Subject: [PATCH] x86, asm-offsets: Guard against building the 32/64-bit versions directly
From: Borislav Petkov <bp@...e.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@...e.de>
Cc: Michal Marek <mmarek@...e.cz>
Signed-off-by: Borislav Petkov <bp@...e.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists