diff options
| author | Maciej Debski <maciejd@google.com> | 2016-10-13 06:59:36 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-10-24 10:07:37 -0400 |
| commit | 621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 (patch) | |
| tree | c98e452cb4aa99d4debe6a25ea135ecec406d9bc | |
| parent | cdd75e3b0d1e668bc498f18f0ea8353f9f955114 (diff) | |
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>
| -rw-r--r-- | tools/perf/Makefile.config | 2 | ||||
| -rw-r--r-- | tools/perf/util/Build | 2 | ||||
| -rw-r--r-- | tools/perf/util/genelf.c | 9 | ||||
| -rw-r--r-- | tools/perf/util/genelf.h | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 72edf83d76b7..cffdd9cf3ebf 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
| @@ -366,7 +366,7 @@ ifndef NO_SDT | |||
| 366 | endif | 366 | endif |
| 367 | 367 | ||
| 368 | ifdef PERF_HAVE_JITDUMP | 368 | ifdef PERF_HAVE_JITDUMP |
| 369 | ifndef NO_DWARF | 369 | ifndef NO_LIBELF |
| 370 | $(call detected,CONFIG_JITDUMP) | 370 | $(call detected,CONFIG_JITDUMP) |
| 371 | CFLAGS += -DHAVE_JITDUMP | 371 | CFLAGS += -DHAVE_JITDUMP |
| 372 | endif | 372 | endif |
diff --git a/tools/perf/util/Build b/tools/perf/util/Build index eb60e613d795..1dc67efad634 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build | |||
| @@ -120,7 +120,7 @@ libperf-y += demangle-rust.o | |||
| 120 | ifdef CONFIG_JITDUMP | 120 | ifdef CONFIG_JITDUMP |
| 121 | libperf-$(CONFIG_LIBELF) += jitdump.o | 121 | libperf-$(CONFIG_LIBELF) += jitdump.o |
| 122 | libperf-$(CONFIG_LIBELF) += genelf.o | 122 | libperf-$(CONFIG_LIBELF) += genelf.o |
| 123 | libperf-$(CONFIG_LIBELF) += genelf_debug.o | 123 | libperf-$(CONFIG_DWARF) += genelf_debug.o |
| 124 | endif | 124 | endif |
| 125 | 125 | ||
| 126 | CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))" | 126 | CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))" |
diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index 8a2995ea426f..30dece345b9f 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c | |||
| @@ -19,7 +19,9 @@ | |||
| 19 | #include <limits.h> | 19 | #include <limits.h> |
| 20 | #include <fcntl.h> | 20 | #include <fcntl.h> |
| 21 | #include <err.h> | 21 | #include <err.h> |
| 22 | #ifdef HAVE_DWARF_SUPPORT | ||
| 22 | #include <dwarf.h> | 23 | #include <dwarf.h> |
| 24 | #endif | ||
| 23 | 25 | ||
| 24 | #include "perf.h" | 26 | #include "perf.h" |
| 25 | #include "genelf.h" | 27 | #include "genelf.h" |
| @@ -161,7 +163,7 @@ gen_build_id(struct buildid_note *note, unsigned long load_addr, const void *cod | |||
| 161 | int | 163 | int |
| 162 | jit_write_elf(int fd, uint64_t load_addr, const char *sym, | 164 | jit_write_elf(int fd, uint64_t load_addr, const char *sym, |
| 163 | const void *code, int csize, | 165 | const void *code, int csize, |
| 164 | void *debug, int nr_debug_entries) | 166 | void *debug __maybe_unused, int nr_debug_entries __maybe_unused) |
| 165 | { | 167 | { |
| 166 | Elf *e; | 168 | Elf *e; |
| 167 | Elf_Data *d; | 169 | Elf_Data *d; |
| @@ -390,11 +392,14 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym, | |||
| 390 | shdr->sh_size = sizeof(bnote); | 392 | shdr->sh_size = sizeof(bnote); |
| 391 | shdr->sh_entsize = 0; | 393 | shdr->sh_entsize = 0; |
| 392 | 394 | ||
| 395 | #ifdef HAVE_DWARF_SUPPORT | ||
| 393 | if (debug && nr_debug_entries) { | 396 | if (debug && nr_debug_entries) { |
| 394 | retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries); | 397 | retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries); |
| 395 | if (retval) | 398 | if (retval) |
| 396 | goto error; | 399 | goto error; |
| 397 | } else { | 400 | } else |
| 401 | #endif | ||
| 402 | { | ||
| 398 | if (elf_update(e, ELF_C_WRITE) < 0) { | 403 | if (elf_update(e, ELF_C_WRITE) < 0) { |
| 399 | warnx("elf_update 4 failed"); | 404 | warnx("elf_update 4 failed"); |
| 400 | goto error; | 405 | goto error; |
diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index 2fbeb59c4bdd..5c933ac71451 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h | |||
| @@ -4,8 +4,10 @@ | |||
| 4 | /* genelf.c */ | 4 | /* genelf.c */ |
| 5 | int jit_write_elf(int fd, uint64_t code_addr, const char *sym, | 5 | int jit_write_elf(int fd, uint64_t code_addr, const char *sym, |
| 6 | const void *code, int csize, void *debug, int nr_debug_entries); | 6 | const void *code, int csize, void *debug, int nr_debug_entries); |
| 7 | #ifdef HAVE_DWARF_SUPPORT | ||
| 7 | /* genelf_debug.c */ | 8 | /* genelf_debug.c */ |
| 8 | int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries); | 9 | int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries); |
| 10 | #endif | ||
| 9 | 11 | ||
| 10 | #if defined(__arm__) | 12 | #if defined(__arm__) |
| 11 | #define GEN_ELF_ARCH EM_ARM | 13 | #define GEN_ELF_ARCH EM_ARM |
