Files
erofs-linux/tools/perf/util/llvm.h
T
Ian Rogers 257046a367 perf srcline: Fallback between addr2line implementations
Factor the addr2line function implementation into separate source files
(addr2line.[ch]) and rename the addr2line function cmd__addr2line. In
srcline replace the ifdef-ed addr2line implementations with one that
first tries the llvm__addr2line implementation, then the deprecated
libbfd__addr2line function and on failure uses cmd__addr2line.

If HAVE_LIBLLVM_SUPPORT is enabled the llvm__addr2line will execute
against the libLLVM.so it is linked against.

If HAVE_LIBLLVM_DYNAMIC is enabled then libperf-llvm.so (that links
against libLLVM.so) will be dlopened. If the dlopen succeeds then the
behavior should match HAVE_LIBLLVM_SUPPORT. On failure cmd__addr2line is
used. The dlopen is only tried once.

If HAVE_LIBLLVM_DYNAMIC isn't enabled then llvm__addr2line immediately
fails and cmd__addr2line is used.

Clean up the dso__free_a2l logic, which is only needed in the non-LLVM
version and moved to addr2line.c.

Signed-off-by: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Athira Rajeev <[email protected]>
Cc: Bill Wendling <[email protected]>
Cc: Charlie Jenkins <[email protected]>
Cc: Collin Funk <[email protected]>
Cc: Dmitriy Vyukov <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Eric Biggers <[email protected]>
Cc: Haibo Xu <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Justin Stitt <[email protected]>
Cc: Li Huafei <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Stephen Brennan <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2025-10-06 16:47:49 -03:00

22 lines
514 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __PERF_LLVM_H
#define __PERF_LLVM_H
#include <stdbool.h>
#include <linux/types.h>
struct annotate_args;
struct dso;
struct inline_node;
struct symbol;
int llvm__addr2line(const char *dso_name, u64 addr,
char **file, unsigned int *line, struct dso *dso,
bool unwind_inlines, struct inline_node *node,
struct symbol *sym);
int symbol__disassemble_llvm(const char *filename, struct symbol *sym,
struct annotate_args *args);
#endif /* __PERF_LLVM_H */