Skip to contentSkip to conversation

x86, asm-offsets: Guard against building the 32/64-bit versions directly

PATCH New Borislav Petkov 2 participants 2 messages Dec 9, 2014 – Dec 11, 2014 x86

lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86, asm-offsets: Guard against building the 32/64-bit versions directly

From: Borislav Petkov <[email protected]>

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.

---
 arch/x86/kernel/asm-offsets_32.c | 4 ++++
 arch/x86/kernel/asm-offsets_64.c | 4 ++++
 2 files changed, 8 insertions(+)
arch/x86/kernel/asm-offsets_32.c +4 -0
index d67c4be3e8b1..207c48278dff 100644
@@ -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>
arch/x86/kernel/asm-offsets_64.c +4 -0
index 4f9359f36bb7..7fcb2312b532 100644
@@ -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,
Signature · 1 line
2.0.0
#1 lore raw

[tip:x86/urgent] x86/asm: Guard against building the 32/ 64-bit versions of the asm-offsets*.c file directly

x86/asm: Guard against building the 32/64-bit versions of the asm-offsets*.c file directly
Commit-ID:  5de2b61a63f0982641eb00b9a6a9650f23487eaa
Gitweb:     http://git.kernel.org/tip/5de2b61a63f0982641eb00b9a6a9650f23487eaa
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 9 Dec 2014 16:45:17 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 11 Dec 2014 11:43:56 +0100

x86/asm: Guard against building the 32/64-bit versions of the asm-offsets*.c file directly

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.

---
 arch/x86/kernel/asm-offsets_32.c | 4 ++++
 arch/x86/kernel/asm-offsets_64.c | 4 ++++
 2 files changed, 8 insertions(+)
arch/x86/kernel/asm-offsets_32.c +4 -0
index d67c4be..3b3b9d3 100644
@@ -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>
arch/x86/kernel/asm-offsets_64.c +4 -0
index e7c798b..4c0c596 100644
@@ -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,