diff options
| author | Maciej Debski <maciejd@google.com> | 2016-10-13 06:59:36 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-26 02:24:36 -0500 |
| commit | 03f5be20ec9befe477e9978bdba2b1f4f2ca9e42 (patch) | |
| tree | e27fcda4f2dcef16751171c6465ea6fd934ba84f /tools | |
| parent | 3ef6a3c0136b2005ff887e777f51200938ac3214 (diff) | |
perf jit: Enable jitdump support without dwarf
commit 621cb4e7837e39d25a5af5a785ad282cdd2b4ce8 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
| -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 c1ef805c6a8f..14a73acc549c 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" |
| @@ -157,7 +159,7 @@ gen_build_id(struct buildid_note *note, unsigned long load_addr, const void *cod | |||
| 157 | int | 159 | int |
| 158 | jit_write_elf(int fd, uint64_t load_addr, const char *sym, | 160 | jit_write_elf(int fd, uint64_t load_addr, const char *sym, |
| 159 | const void *code, int csize, | 161 | const void *code, int csize, |
| 160 | void *debug, int nr_debug_entries) | 162 | void *debug __maybe_unused, int nr_debug_entries __maybe_unused) |
| 161 | { | 163 | { |
| 162 | Elf *e; | 164 | Elf *e; |
| 163 | Elf_Data *d; | 165 | Elf_Data *d; |
| @@ -386,11 +388,14 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym, | |||
| 386 | shdr->sh_size = sizeof(bnote); | 388 | shdr->sh_size = sizeof(bnote); |
| 387 | shdr->sh_entsize = 0; | 389 | shdr->sh_entsize = 0; |
| 388 | 390 | ||
| 391 | #ifdef HAVE_DWARF_SUPPORT | ||
| 389 | if (debug && nr_debug_entries) { | 392 | if (debug && nr_debug_entries) { |
| 390 | retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries); | 393 | retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries); |
| 391 | if (retval) | 394 | if (retval) |
| 392 | goto error; | 395 | goto error; |
| 393 | } else { | 396 | } else |
| 397 | #endif | ||
| 398 | { | ||
| 394 | if (elf_update(e, ELF_C_WRITE) < 0) { | 399 | if (elf_update(e, ELF_C_WRITE) < 0) { |
| 395 | warnx("elf_update 4 failed"); | 400 | warnx("elf_update 4 failed"); |
| 396 | goto error; | 401 | 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 |
