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

From: Namhyung Kim

Date: Tue Jul 14 2026 - 13:03:36 EST


On Tue, Jul 14, 2026 at 09:36:52AM +0100, Leo Yan wrote:
> 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

I'm curious what `git tag --contains` would say. I can see RISCV in the
5.0 source code.

https://github.com/capstone-engine/capstone/blob/5.0/include/capstone/capstone.h#L90

>
> 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.

What's your 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.

Yep. https://github.com/capstone-engine/capstone/issues/2977

Thanks,
Namhyung