perf capstone: Support for dlopen-ing libcapstone.so
authorIan Rogers <irogers@google.com>
Fri, 30 Jan 2026 23:34:37 +0000 (15:34 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 3 Feb 2026 14:34:02 +0000 (11:34 -0300)
commitb5c9bcde61b8cabf3b4194902374e62b8c8a4d41
treef6a6aeab93ac35650d16aa8256b5b6a045333ae5
parent169343cc8ff2bd59758760d867bd26adae866a2b
perf capstone: Support for dlopen-ing libcapstone.so

If perf is built with LIBCAPSTONE_DLOPEN=1, support dlopen-ing
libcapstone.so and then calling the necessary functions by looking them
up using dlsym.

The types come from capstone.h which means the libcapstone feature check
needs to pass, and NO_CAPSTONE=1 hasn't been defined. This will cause
the definition of HAVE_LIBCAPSTONE_SUPPORT.

Earlier versions of this code tried to declare the necessary
capstone.h constants and structs, but they weren't stable and caused
breakages across libcapstone releases.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Charlie Jenkins <charlie@rivosinc.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.config
tools/perf/tests/make
tools/perf/util/Build
tools/perf/util/capstone.c
tools/perf/util/capstone.h