On Tue, Oct 24, 2023 at 12:10 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote: > > Hi Arnaldo, > > On Mon, Oct 23, 2023 at 9:38 AM Arnaldo Carvalho de Melo > <acme@xxxxxxxxxx> wrote: > > > > Em Wed, Oct 11, 2023 at 08:50:36PM -0700, Namhyung Kim escreveu: > > > The annotate_get_insn_location() is to get the detailed information of > > > instruction locations like registers and offset. It has source and > > > target operands locations in an array. Each operand can have a > > > register and an offset. The offset is meaningful when mem_ref flag is > > > set. > > > > This needs to be enclosed in HAVE_DWARF_SUPPORT, as the build is failing > > in systems where this isn't available, see patch below. > > Thanks for the test and the patch, will add it to v2. Hmm.. I think this function can work without DWARF. If the only problem is get_dwarf_regnum() probably I can add a dummy function when libdw is not found. Maybe I need to use arch reg number here and convert to DWARF later. Thanks, Namhyung > > > > CC /tmp/build/perf/arch/x86/util/pmu.o > > util/annotate.c: In function 'extract_reg_offset': > > util/annotate.c:3537:24: error: implicit declaration of function 'get_dwarf_regnum' [-Werror=implicit-function-declaration] > > 3537 | op_loc->reg1 = get_dwarf_regnum(regname, 0); > > | ^~~~~~~~~~~~~~~~ > > CC /tmp/build/perf/tests/vmlinux-kallsyms.o > > > > I tested it with 'make NO_DWARF=1' > > > > - Arnaldo > > > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > > index 9d653a1e84ce4889..b998c81c89be04fc 100644 > > --- a/tools/perf/util/annotate.c > > +++ b/tools/perf/util/annotate.c > > @@ -3486,6 +3486,7 @@ int annotate_check_args(struct annotation_options *args) > > return 0; > > } > > > > +#ifdef HAVE_DWARF_SUPPORT > > /* > > * Get register number and access offset from the given instruction. > > * It assumes AT&T x86 asm format like OFFSET(REG). Maybe it needs > > @@ -3591,3 +3592,4 @@ int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl, > > > > return 0; > > } > > +#endif // HAVE_DWARF_SUPPORT > > diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h > > index 4adda492233d2742..484be346a279c481 100644 > > --- a/tools/perf/util/annotate.h > > +++ b/tools/perf/util/annotate.h > > @@ -437,6 +437,7 @@ int annotate_parse_percent_type(const struct option *opt, const char *_str, > > > > int annotate_check_args(struct annotation_options *args); > > > > +#ifdef HAVE_DWARF_SUPPORT > > /** > > * struct annotated_op_loc - Location info of instruction operand > > * @reg: Register in the operand > > @@ -473,4 +474,5 @@ struct annotated_insn_loc { > > int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl, > > struct annotated_insn_loc *loc); > > > > +#endif /* HAVE_DWARF_SUPPORT */ > > #endif /* __PERF_ANNOTATE_H */