x86/asm: Guard against building the 32/64-bit versions of the asm-offsets*.c file...
authorBorislav Petkov <bp@suse.de>
Tue, 9 Dec 2014 15:45:17 +0000 (16:45 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 11 Dec 2014 10:43:56 +0000 (11:43 +0100)
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>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1418139917-12722-1-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/asm-offsets_32.c
arch/x86/kernel/asm-offsets_64.c

index d67c4be3e8b1e24ec845ecdb4c5de615523cf066..3b3b9d33ac1d2f0809db3b16230c840e98774b70 100644 (file)
@@ -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>
index e7c798b354fa566e72b951aee69c3db495b8862e..4c0c596dfb95692561afb20b4d566e031144deb8 100644 (file)
@@ -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,