在装有debianMIPS处理器中,安装perf工具时遇到的error描述如下:
下载相应内核版本,进入tools/perf目录,首先大致看下Makefile的内容,是否支持MIPS平台,然后安装perf
#make
Makefile:553: DWARF register mappings have not been defined for architecture mips, DWARF support disabled
Makefile:565: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
make: Warning: File `PERF-VERSION-FILE' has modification time 2.1e+08 s in the future
CC builtin-record.o
cc1: warnings being treated as errors
builtin-record.c: In function 'mmap_read_head':
builtin-record.c:93: error: implicit declaration of function 'rmb'
builtin-record.c:93: error: nested extern declaration of 'rmb'
make: *** [builtin-record.o] Error 1
这个错误告诉我们rmb未定义,然后进入perf.h中仔细看,确实无MIPS这一项,需自己手动添加。参考代码支持多种MIPS型号,如下:
#ifdef __mips__
#include "../../arch/mips/include/asm/unistd.h"
#define rmb() asm volatile( \
".set mips2\n\t" \
"sync\n\t" \
".set mips0" \
: /* no output */ \
: /* no input */ \
: "memory")
#define cpu_relax() asm volatile("" ::: "memory")
#endif
或者尝试
#ifdef __mips__
+#include "../../arch/mips/include/asm/unistd.h"
+#define rmb() asm volatile( \
+ ".set noreorder\n\t" \
+ "nop;nop;nop;nop;nop;nop;nop\n\t" \
+ ".set reorder" \
+ : /* no output */ \
+ : /* no input */ \
+ : "memory")
+#define cpu_relax() asm volatile("" ::: "memory")
+#endif参考资料:
http://hackage.haskell.org/trac/ghc/wiki/Debugging/LowLevelProfiling/Perf
2217

被折叠的 条评论
为什么被折叠?



