Skip to contentSkip to conversation

perf tools: Fix compilation on powerpc

PATCH In review Paul Mackerras 1 participant 2 messages Nov 24, 2009 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Fix compilation on powerpc

Currently, perf fails to compile on powerpc with this error:

CC util/header.o
In file included from util/../perf.h:17,
from util/header.c:9:
util/../../../arch/powerpc/include/asm/unistd.h:360:27: error: linux/linkage.h: No such file or directory
make: *** [util/header.o] Error 1

The reason is that we still have a #define __KERNEL__ in effect at the point where <asm/unistd.h> gets included, which means we get extra stuff that we don't need or want.

This fixes the problem by undefining __KERNEL__ once we have included the file for which we need __KERNEL__ defined.

---
 tools/perf/util/include/linux/bitops.h |    2 ++
 1 file changed, 2 insertions(+)
tools/perf/util/include/linux/bitops.h +2 -0
index ace57c3..8d63116 100644
@@ -7,6 +7,8 @@
 #define CONFIG_GENERIC_FIND_FIRST_BIT
 #include "../../../../include/linux/bitops.h"
 
+#undef __KERNEL__
+
 static inline void set_bit(int nr, unsigned long *addr)
 {
 	addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
#1 lore raw
Commit-ID:  ee3d250446f1c1be4eceab48f3a23794d9a6564c
Gitweb:     http://git.kernel.org/tip/ee3d250446f1c1be4eceab48f3a23794d9a6564c
Author:     Paul Mackerras <[email protected]>
AuthorDate: Tue, 24 Nov 2009 15:19:43 +1100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 24 Nov 2009 08:35:10 +0100

perf tools: Fix compilation on powerpc

Currently, perf fails to compile on powerpc with this error:

CC util/header.o
In file included from util/../perf.h:17,
from util/header.c:9:
util/../../../arch/powerpc/include/asm/unistd.h:360:27: error:
linux/linkage.h: No such file or directory make: *** [util/header.o] Error 1

The reason is that we still have a #define __KERNEL__ in effect at the point where <asm/unistd.h> gets included, which means we get extra stuff that we don't need or want.

This fixes the problem by undefining __KERNEL__ once we have included the file for which we need __KERNEL__ defined.

Cc Frederic Weisbecker <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Peter Zijlstra <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/util/include/linux/bitops.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/include/linux/bitops.h +2 -0
index ace57c3..8d63116 100644
@@ -7,6 +7,8 @@
 #define CONFIG_GENERIC_FIND_FIRST_BIT
 #include "../../../../include/linux/bitops.h"
 
+#undef __KERNEL__
+
 static inline void set_bit(int nr, unsigned long *addr)
 {
 	addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);