Re: [PATCH v2] perf tools: avoid sample_reg_masks being const + weak

From: Ian Rogers
Date: Mon Sep 30 2019 - 20:36:48 EST


Apologies for that. I've addressed in v3 but only tested for riscv.
There is potential for additional tidy up related to this change, let
me know what would be appropriate.

Thanks,
Ian

On Mon, Sep 30, 2019 at 5:42 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> On Mon, Sep 30, 2019 at 09:23:35AM -0300, Arnaldo Carvalho de Melo wrote:
>
> SNIP
>
> > CC /tmp/build/perf/util/lzma.o
> > CC /tmp/build/perf/util/demangle-java.o
> > CC /tmp/build/perf/util/demangle-rust.o
> > CC /tmp/build/perf/util/jitdump.o
> > CC /tmp/build/perf/util/genelf.o
> > CC /tmp/build/perf/util/genelf_debug.o
> > CC /tmp/build/perf/util/perf-hooks.o
> > CC /tmp/build/perf/util/bpf-event.o
> > FLEX /tmp/build/perf/util/parse-events-flex.c
> > LD /tmp/build/perf/util/intel-pt-decoder/perf-in.o
> > FLEX /tmp/build/perf/util/pmu-flex.c
> > CC /tmp/build/perf/util/pmu-bison.o
> > CC /tmp/build/perf/util/expr-bison.o
> > CC /tmp/build/perf/util/parse-events.o
> > CC /tmp/build/perf/util/parse-events-flex.o
> > CC /tmp/build/perf/util/pmu.o
> > CC /tmp/build/perf/util/pmu-flex.o
> > LD /tmp/build/perf/util/perf-in.o
> > LD /tmp/build/perf/perf-in.o
> > LINK /tmp/build/perf/perf
> > /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /tmp/build/perf/perf-in.o: in function `__parse_regs':
> > /git/linux/tools/perf/util/parse-regs-options.c:39: undefined reference to `sample_reg_masks'
> > /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /git/linux/tools/perf/util/parse-regs-options.c:47: undefined reference to `sample_reg_masks'
> > /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /git/linux/tools/perf/util/parse-regs-options.c:60: undefined reference to `sample_reg_masks'
> > /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /git/linux/tools/perf/util/parse-regs-options.c:50: undefined reference to `sample_reg_masks'
>
> argh.. I tried on power.. should have tried on arm ;-)
>
> I expected that all the archs that set NO_PERF_REGS := 0 would have
> sample_reg_masks defined.. all those archs did fallback to the:
>
> const struct sample_reg __weak sample_reg_masks[] = {
> SMPL_REG_END
> };
>
> those archs are not able to use --user-regs/--intr-regs options,
> but for dwarf unwind we set those registers manualy, so that works
>
> so I guess we need to define empty sample_reg_masks for those archs
>
> jirka