Re: [PATCH] perf capstone: Fix build with Capstone versions before 6

From: Leo Yan

Date: Tue Jul 14 2026 - 04:43:04 EST


On Mon, Jul 13, 2026 at 01:53:55PM -0700, Namhyung Kim wrote:

[...]

> > Perhaps checking the Capstone version would be a safer approach?
>
> I'm not sure. IIUC RISC-V support was added to v5.0 and CS_MODE_RISCV_C
> was changed before v6.0 is out. Do you build capstone from source or
> use a packaged version?

I checked Capstone source for two RISCV commits:

ec6428f9 Refactoring the RISCV architecture to Auto-Sync on LLVM (#2756)
b8fcf27b RISCV support ISRV32/ISRV64 (#1401)

$ git describe --contains ec6428f92
6.0.0-Alpha7~10
$ git describe --contains b8fcf27b2
6.0.0-Alpha1~513

This is why I concluded that v6.0 is the version start to support. I did
not build capstone from scratch but just use a packaged version.

Just remind, CS_MODE_RISCVC might break build when you work with the
latest Capstone, as it has been renamed to CS_MODE_RISCV_C.

Thanks,
Leo