[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fX8aoEKaFKzdJowq6q470GfpzX-vWTASJEDx3=LHumChA@mail.gmail.com>
Date: Mon, 20 Jan 2025 10:01:55 -0800
From: Ian Rogers <irogers@...gle.com>
To: Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>,
linux-perf-users <linux-perf-users@...r.kernel.org>, llvm@...ts.linux.dev
Cc: Peter Zijlstra <peterz@...radead.org>, Dmitry Vyukov <dvyukov@...gle.com>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, Kajol Jain <kjain@...ux.ibm.com>,
Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
Nathan Chancellor <nathan@...nel.org>, Justin Stitt <justinstitt@...gle.com>,
"Steinar H. Gunderson" <sesse@...gle.com>, Charlie Jenkins <charlie@...osinc.com>,
Changbin Du <changbin.du@...wei.com>, James Clark <james.clark@...aro.org>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>, Li Huafei <lihuafei1@...wei.com>,
Andi Kleen <ak@...ux.intel.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 0/5] Support dynamic opening of capstone and libLLVM
On Mon, Jan 20, 2025 at 9:32 AM Ian Rogers <irogers@...gle.com> wrote:
>
> 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.
A question for the LLVM folks longer term, could the
llvm/DebugInfo/Symbolize/Symbolize.h functionality be added to the
llvm-c API (ie the not C++ one) for the sake of perf's use using dlsym
for its addr2line implementation? This would enable the
libperf-llvm.so library added in these patches to be removed and
libLLVM.so used in its place.
Thanks,
Ian
> 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
>
Powered by blists - more mailing lists