From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
"Steinar H. Gunderson" <sesse@google.com>,
Charlie Jenkins <charlie@rivosinc.com>,
Changbin Du <changbin.du@huawei.com>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
James Clark <james.clark@linaro.org>,
Kajol Jain <kjain@linux.ibm.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Li Huafei <lihuafei1@huawei.com>,
Dmitry Vyukov <dvyukov@google.com>,
Andi Kleen <ak@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
llvm@lists.linux.dev
Subject: [PATCH v1 0/5] Support dynamic opening of capstone and libLLVM
Date: Mon, 20 Jan 2025 09:32:03 -0800 [thread overview]
Message-ID: <20250120173208.344231-1-irogers@google.com> (raw)
Linking against libcapstone and libLLVM can be a significant increase
in dependencies and size of memory footprint. For something like `perf
record` the disassembler and addr2line functionality won't be
used. Support dynamically loading these libraries using dlopen and
then calling the appropriate functions found using dlsym.
The patch series:
1) moves the capstone and LLVM code to their own C files,
2) simplifies a little the capstone code,
3) adds perf_ variants of the functions that will either directly call
the function or use dlsym to discover it.
The addr2line LLVM functionality is written in C++. To avoid linking
against libLLVM for this, a new LIBLLVM_DYNAMIC option is added where
the C++ code with the libLLVM dependency will be built into a
libperf-llvm.so and that dlsym-ed and called against.
Ian Rogers (5):
perf capstone: Move capstone functionality into its own file
perf llvm: Move llvm functionality into its own file
perf capstone: Remove open_capstone_handle
perf capstone: Support for dlopen-ing libcapstone.so
perf llvm: Support for dlopen-ing libLLVM.so
tools/perf/Makefile.config | 13 +
tools/perf/Makefile.perf | 23 +-
tools/perf/builtin-script.c | 2 -
tools/perf/tests/make | 2 +
tools/perf/util/Build | 4 +-
tools/perf/util/capstone.c | 723 +++++++++++++++++++++++++++++
tools/perf/util/capstone.h | 24 +
tools/perf/util/disasm.c | 612 +-----------------------
tools/perf/util/disasm.h | 2 +
tools/perf/util/llvm-c-helpers.cpp | 113 ++++-
tools/perf/util/llvm.c | 537 +++++++++++++++++++++
tools/perf/util/llvm.h | 24 +
tools/perf/util/print_insn.c | 117 +----
tools/perf/util/srcline.c | 65 +--
tools/perf/util/srcline.h | 6 +
15 files changed, 1481 insertions(+), 786 deletions(-)
create mode 100644 tools/perf/util/capstone.c
create mode 100644 tools/perf/util/capstone.h
create mode 100644 tools/perf/util/llvm.c
create mode 100644 tools/perf/util/llvm.h
--
2.48.0.rc2.279.g1de40edade-goog
next reply other threads:[~2025-01-20 17:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 17:32 Ian Rogers [this message]
2025-01-20 17:32 ` [PATCH v1 1/5] perf capstone: Move capstone functionality into its own file Ian Rogers
2025-01-20 17:32 ` [PATCH v1 2/5] perf llvm: Move llvm " Ian Rogers
2025-01-20 17:32 ` [PATCH v1 3/5] perf capstone: Remove open_capstone_handle Ian Rogers
2025-01-20 17:32 ` [PATCH v1 4/5] perf capstone: Support for dlopen-ing libcapstone.so Ian Rogers
2025-01-22 22:27 ` Namhyung Kim
2025-01-22 22:42 ` Ian Rogers
2025-01-23 16:07 ` Ian Rogers
2025-01-23 21:37 ` Ian Rogers
2025-01-24 21:31 ` Namhyung Kim
2025-01-20 17:32 ` [PATCH v1 5/5] perf llvm: Support for dlopen-ing libLLVM.so Ian Rogers
2025-01-20 18:01 ` [PATCH v1 0/5] Support dynamic opening of capstone and libLLVM Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250120173208.344231-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=changbin.du@huawei.com \
--cc=charlie@rivosinc.com \
--cc=dvyukov@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=lihuafei1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=sesse@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox