Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf jit: Enable jitdump support without dwarf

This patch modifies the build dependencies on the jitdump support in
perf. As it stands jitdump was wrongfully made dependent 100% on using
DWARF. However, the dwarf dependency, only exist if generating the
source line table in genelf_debug.c. The rest of the support does not
need DWARF.

This patch removes the dependency on DWARF for the entire jitdump
support. It keeps it only for the genelf_debug.c support.

Signed-off-by: Maciej Debski <maciejd@google.com>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1476356383-30100-3-git-send-email-eranian@google.com
Fixes: e12b202f8fb9 ("perf jitdump: Build only on supported archs")
[ Make it build only if NO_LIBELF isn't defined, as jitdump.o will only be built in that case ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Maciej Debski and committed by
Arnaldo Carvalho de Melo
621cb4e7 cdd75e3b

+11 -4
+1 -1
tools/perf/Makefile.config
··· 366 366 endif 367 367 368 368 ifdef PERF_HAVE_JITDUMP 369 - ifndef NO_DWARF 369 + ifndef NO_LIBELF 370 370 $(call detected,CONFIG_JITDUMP) 371 371 CFLAGS += -DHAVE_JITDUMP 372 372 endif
+1 -1
tools/perf/util/Build
··· 120 120 ifdef CONFIG_JITDUMP 121 121 libperf-$(CONFIG_LIBELF) += jitdump.o 122 122 libperf-$(CONFIG_LIBELF) += genelf.o 123 - libperf-$(CONFIG_LIBELF) += genelf_debug.o 123 + libperf-$(CONFIG_DWARF) += genelf_debug.o 124 124 endif 125 125 126 126 CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
+7 -2
tools/perf/util/genelf.c
··· 19 19 #include <limits.h> 20 20 #include <fcntl.h> 21 21 #include <err.h> 22 + #ifdef HAVE_DWARF_SUPPORT 22 23 #include <dwarf.h> 24 + #endif 23 25 24 26 #include "perf.h" 25 27 #include "genelf.h" ··· 163 161 int 164 162 jit_write_elf(int fd, uint64_t load_addr, const char *sym, 165 163 const void *code, int csize, 166 - void *debug, int nr_debug_entries) 164 + void *debug __maybe_unused, int nr_debug_entries __maybe_unused) 167 165 { 168 166 Elf *e; 169 167 Elf_Data *d; ··· 392 390 shdr->sh_size = sizeof(bnote); 393 391 shdr->sh_entsize = 0; 394 392 393 + #ifdef HAVE_DWARF_SUPPORT 395 394 if (debug && nr_debug_entries) { 396 395 retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries); 397 396 if (retval) 398 397 goto error; 399 - } else { 398 + } else 399 + #endif 400 + { 400 401 if (elf_update(e, ELF_C_WRITE) < 0) { 401 402 warnx("elf_update 4 failed"); 402 403 goto error;
+2
tools/perf/util/genelf.h
··· 4 4 /* genelf.c */ 5 5 int jit_write_elf(int fd, uint64_t code_addr, const char *sym, 6 6 const void *code, int csize, void *debug, int nr_debug_entries); 7 + #ifdef HAVE_DWARF_SUPPORT 7 8 /* genelf_debug.c */ 8 9 int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries); 10 + #endif 9 11 10 12 #if defined(__arm__) 11 13 #define GEN_ELF_ARCH EM_ARM