mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
perf build: Fix compiler errors with old capstone
It seems RISCV was added in capstone version 5 (released Jul 2023).
Unfortunately they are enum constants so cannot check with #ifdef but
anyway we can define the symbols. Let's do it using the version
number to avoid build errors. It'll fail at runtime though.
util/capstone.c: In function 'e_machine_to_capstone':
util/capstone.c:186:25: error: 'CS_ARCH_RISCV' undeclared (first use in this function);
did you mean 'CS_ARCH_SYSZ'?
186 | *arch = CS_ARCH_RISCV;
| ^~~~~~~~~~~~~
| CS_ARCH_SYSZ
util/capstone.c:186:25: note: each undeclared identifier is reported only once for each function it appears in
util/capstone.c:187:34: error: 'CS_MODE_RISCV64' undeclared (first use in this function);
did you mean 'CS_MODE_MIPS64'?
187 | *mode |= (is64 ? CS_MODE_RISCV64 : CS_MODE_RISCV32) | CS_MODE_RISCVC;
| ^~~~~~~~~~~~~~~
| CS_MODE_MIPS64
Also note that capstone renamed CS_MODE_RISCVC to CS_MODE_RISCV_C which
would cause a different build failure on latest versions. It's reported
in https://github.com/capstone-engine/capstone/issues/2977 so I think
they will add compatibility layer to prevent the error.
Fixes: 12c4737f55 ("perf capstone: Determine architecture from e_machine")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
5bc1647216
commit
e01c7bd5b1
|
|
@ -24,6 +24,13 @@
|
|||
#include "symbol.h"
|
||||
#include "thread.h"
|
||||
|
||||
#if CS_VERSION_MAJOR < 5
|
||||
#define CS_ARCH_RISCV 15
|
||||
#define CS_MODE_RISCV32 1
|
||||
#define CS_MODE_RISCV64 2
|
||||
#define CS_MODE_RISCVC 4
|
||||
#endif
|
||||
|
||||
#ifdef LIBCAPSTONE_DLOPEN
|
||||
static void *perf_cs_dll_handle(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user