Fix a compile error: ... CC util/libunwind/x86_32.o In file included from util/libunwind/x86_32.c:33:0: util/libunwind/../../arch/x86/util/unwind-libunwind.c: In function 'libunwind__x86_reg_id': util/libunwind/../../arch/x86/util/unwind-libunwind.c:110:11: error: 'EINVAL' undeclared (first use in this function) return -EINVAL; ^ util/libunwind/../../arch/x86/util/unwind-libunwind.c:110:11: note: each undeclared identifier is reported only once for each function it appears in mv: cannot stat 'util/libunwind/.x86_32.o.tmp': No such file or directory make[4]: *** [util/libunwind/x86_32.o] Error 1 make[3]: *** [util] Error 2 make[2]: *** [libperf-in.o] Error 2 make[1]: *** [sub-make] Error 2 make: *** [all] Error 2 It happens when libunwind-x86 feature is detected. Signed-off-by: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20171206015040.114574-1-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
116 lines
2.0 KiB
C
116 lines
2.0 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <errno.h>
|
|
#ifndef REMOTE_UNWIND_LIBUNWIND
|
|
#include <libunwind.h>
|
|
#include "perf_regs.h"
|
|
#include "../../util/unwind.h"
|
|
#include "../../util/debug.h"
|
|
#endif
|
|
|
|
#ifdef HAVE_ARCH_X86_64_SUPPORT
|
|
int LIBUNWIND__ARCH_REG_ID(int regnum)
|
|
{
|
|
int id;
|
|
|
|
switch (regnum) {
|
|
case UNW_X86_64_RAX:
|
|
id = PERF_REG_X86_AX;
|
|
break;
|
|
case UNW_X86_64_RDX:
|
|
id = PERF_REG_X86_DX;
|
|
break;
|
|
case UNW_X86_64_RCX:
|
|
id = PERF_REG_X86_CX;
|
|
break;
|
|
case UNW_X86_64_RBX:
|
|
id = PERF_REG_X86_BX;
|
|
break;
|
|
case UNW_X86_64_RSI:
|
|
id = PERF_REG_X86_SI;
|
|
break;
|
|
case UNW_X86_64_RDI:
|
|
id = PERF_REG_X86_DI;
|
|
break;
|
|
case UNW_X86_64_RBP:
|
|
id = PERF_REG_X86_BP;
|
|
break;
|
|
case UNW_X86_64_RSP:
|
|
id = PERF_REG_X86_SP;
|
|
break;
|
|
case UNW_X86_64_R8:
|
|
id = PERF_REG_X86_R8;
|
|
break;
|
|
case UNW_X86_64_R9:
|
|
id = PERF_REG_X86_R9;
|
|
break;
|
|
case UNW_X86_64_R10:
|
|
id = PERF_REG_X86_R10;
|
|
break;
|
|
case UNW_X86_64_R11:
|
|
id = PERF_REG_X86_R11;
|
|
break;
|
|
case UNW_X86_64_R12:
|
|
id = PERF_REG_X86_R12;
|
|
break;
|
|
case UNW_X86_64_R13:
|
|
id = PERF_REG_X86_R13;
|
|
break;
|
|
case UNW_X86_64_R14:
|
|
id = PERF_REG_X86_R14;
|
|
break;
|
|
case UNW_X86_64_R15:
|
|
id = PERF_REG_X86_R15;
|
|
break;
|
|
case UNW_X86_64_RIP:
|
|
id = PERF_REG_X86_IP;
|
|
break;
|
|
default:
|
|
pr_err("unwind: invalid reg id %d\n", regnum);
|
|
return -EINVAL;
|
|
}
|
|
|
|
return id;
|
|
}
|
|
#else
|
|
int LIBUNWIND__ARCH_REG_ID(int regnum)
|
|
{
|
|
int id;
|
|
|
|
switch (regnum) {
|
|
case UNW_X86_EAX:
|
|
id = PERF_REG_X86_AX;
|
|
break;
|
|
case UNW_X86_EDX:
|
|
id = PERF_REG_X86_DX;
|
|
break;
|
|
case UNW_X86_ECX:
|
|
id = PERF_REG_X86_CX;
|
|
break;
|
|
case UNW_X86_EBX:
|
|
id = PERF_REG_X86_BX;
|
|
break;
|
|
case UNW_X86_ESI:
|
|
id = PERF_REG_X86_SI;
|
|
break;
|
|
case UNW_X86_EDI:
|
|
id = PERF_REG_X86_DI;
|
|
break;
|
|
case UNW_X86_EBP:
|
|
id = PERF_REG_X86_BP;
|
|
break;
|
|
case UNW_X86_ESP:
|
|
id = PERF_REG_X86_SP;
|
|
break;
|
|
case UNW_X86_EIP:
|
|
id = PERF_REG_X86_IP;
|
|
break;
|
|
default:
|
|
pr_err("unwind: invalid reg id %d\n", regnum);
|
|
return -EINVAL;
|
|
}
|
|
|
|
return id;
|
|
}
|
|
#endif /* HAVE_ARCH_X86_64_SUPPORT */
|