Re: [PATCH] perf report: Support LLVM for addr2line()

From: Steinar H. Gunderson
Date: Sat May 18 2024 - 12:52:22 EST


On Fri, May 17, 2024 at 02:27:43PM -0700, Ian Rogers wrote:
> This is great! There has been talk about the code being slow and I
> think libelf may have been another alternative for this (maybe also
> capstone). We should probably build a `perf bench` for this given the
> variety of choice.

I'm not sure if capstone can do this, but I don't know it very well.
libelf probably can, but LLVM has a nice advantage in that it also
supports, well, non-ELF.

I took the time to write an LLVM-based disassembler, too; it took some
coaxing (there's basically a C and a C++ API that are very different,
where the C API is much easier to set up but has some limitations),
but I think it ended up not too bad at all. I'm tacking it on to the
next patch series. I think after this, the only things really requiring
BUILD_NONDISTRO=1 would be non-ELF debuglink support, slightly different
demangling, and loading of PE symbols?

> nit: kernel style is no curly braces for a single line. If there are
> curlies for the if or the else then curlies should be on both sides.
> ./scripts/checkpatch.pl should be able to catch things like this, but
> it may ignore C++ files.

Ack. (I did run checkpatch, but as you guessed, it didn't complain.)

/* Steinar */