Skip to content

Commit eae7a75

Browse files
Ingo Molnaracmel
authored andcommitted
perf tools, x86: Build perf on older user-space as well
On ancient systems I get this build failure: util/../../../arch/x86/include/asm/unistd.h:67:29: error: asm/unistd_64.h: No such file or directory In file included from util/cache.h:7, from builtin-test.c:8: util/../perf.h: In function ‘sys_perf_event_open’:In file included from util/../perf.h:16 perf.h:170: error: ‘__NR_perf_event_open’ undeclared (first use in this function) The reason is that this old system does not have the split unistd.h headers yet, from which to pick up the syscall definitions. Add the syscall numbers to the already existing i386 and x86_64 blocks in perf.h, and also provide empty include file stubs. With this patch perf builds and works fine on 5 years old user-space as well. Cc: Peter Zijlstra <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent e7f01d1 commit eae7a75

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

tools/perf/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ LIB_H += util/include/asm/uaccess.h
249249
LIB_H += util/include/dwarf-regs.h
250250
LIB_H += util/include/asm/dwarf2.h
251251
LIB_H += util/include/asm/cpufeature.h
252+
LIB_H += util/include/asm/unistd_32.h
253+
LIB_H += util/include/asm/unistd_64.h
252254
LIB_H += perf.h
253255
LIB_H += util/annotate.h
254256
LIB_H += util/cache.h

tools/perf/perf.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ void get_term_dimensions(struct winsize *ws);
1010
#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
1111
#define cpu_relax() asm volatile("rep; nop" ::: "memory");
1212
#define CPUINFO_PROC "model name"
13+
#ifndef __NR_perf_event_open
14+
# define __NR_perf_event_open 336
15+
#endif
1316
#endif
1417

1518
#if defined(__x86_64__)
1619
#include "../../arch/x86/include/asm/unistd.h"
1720
#define rmb() asm volatile("lfence" ::: "memory")
1821
#define cpu_relax() asm volatile("rep; nop" ::: "memory");
1922
#define CPUINFO_PROC "model name"
23+
#ifndef __NR_perf_event_open
24+
# define __NR_perf_event_open 298
25+
#endif
2026
#endif
2127

2228
#ifdef __powerpc__
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)