Commit f47b58b7 authored by David Ahern's avatar David Ahern Committed by Arnaldo Carvalho de Melo

perf symbols: Fix builds with NO_LIBELF set

Build currently fails:
  $ make -C tools/perf O=/tmp/pbuild NO_LIBELF=1

  util/symbol.c: In function ‘dso__load’:
  util/symbol.c:1128:27: error: ‘struct symsrc’ has no member named ‘dynsym’
      CC /tmp/pbuild/util/pager.o
  make: *** [/tmp/pbuild/util/symbol.o] Error 1
  make: *** Waiting for unfinished jobs....

Moving the dynsym reference to symbol-elf.c reveals that NO_LIBELF requires
NO_LIBUNWIND:

  $ make -C tools/perf O=/tmp/pbuild NO_LIBELF=1

      LINK /tmp/pbuild/perf
  /tmp/pbuild/libperf.a(unwind.o): In function `elf_section_offset':
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:176: undefined reference to `elf_begin'
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:181: undefined reference to `gelf_getehdr'
  /tmp/pbuild/libperf.a(unwind.o): In function `elf_section_by_name':
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:157: undefined reference to `elf_nextscn'
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:160: undefined reference to `gelf_getshdr'
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:161: undefined reference to `elf_strptr'
  /tmp/pbuild/libperf.a(unwind.o): In function `elf_section_offset':
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:190: undefined reference to `elf_end'
  /tmp/pbuild/libperf.a(unwind.o): In function `read_unwind_spec':
  /opt/sw/ahern/perf.git/tools/perf/util/unwind.c:190: undefined reference to `elf_end'
  collect2: ld returned 1 exit status
  make: *** [/tmp/pbuild/perf] Error 1
  make: Leaving directory `/opt/sw/ahern/perf.git/tools/perf'

This patch fixes both.
Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1345391234-71906-1-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1c09bf4a
...@@ -469,6 +469,7 @@ PYRF_OBJS += $(OUTPUT)util/xyarray.o ...@@ -469,6 +469,7 @@ PYRF_OBJS += $(OUTPUT)util/xyarray.o
ifdef NO_LIBELF ifdef NO_LIBELF
NO_DWARF := 1 NO_DWARF := 1
NO_DEMANGLE := 1 NO_DEMANGLE := 1
NO_LIBUNWIND := 1
else else
FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y) ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
......
...@@ -183,6 +183,9 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -183,6 +183,9 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
Elf *elf; Elf *elf;
int nr = 0, symidx, err = 0; int nr = 0, symidx, err = 0;
if (!ss->dynsym)
return 0;
elf = ss->elf; elf = ss->elf;
ehdr = ss->ehdr; ehdr = ss->ehdr;
......
...@@ -1125,7 +1125,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) ...@@ -1125,7 +1125,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
else else
ret = -1; ret = -1;
if (ret > 0 && runtime_ss->dynsym) { if (ret > 0) {
int nr_plt; int nr_plt;
nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map, filter); nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map, filter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment