perf jit: Enable jitdump support without dwarf
authorMaciej Debski <maciejd@google.com>
Thu, 13 Oct 2016 10:59:36 +0000 (03:59 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 24 Oct 2016 14:07:37 +0000 (11:07 -0300)
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>
tools/perf/Makefile.config
tools/perf/util/Build
tools/perf/util/genelf.c
tools/perf/util/genelf.h

index 72edf83d76b72188b193fc5f28934fa26dab2b1d..cffdd9cf3ebf764a1d4fbed2421045e4ee148c7b 100644 (file)
@@ -366,7 +366,7 @@ ifndef NO_SDT
 endif
 
 ifdef PERF_HAVE_JITDUMP
-  ifndef NO_DWARF
+  ifndef NO_LIBELF
     $(call detected,CONFIG_JITDUMP)
     CFLAGS += -DHAVE_JITDUMP
   endif
index eb60e613d7954319e8d2ee16f9a94eb1481160e1..1dc67efad6340f7aef55f1727f00f7f20d8baa2c 100644 (file)
@@ -120,7 +120,7 @@ libperf-y += demangle-rust.o
 ifdef CONFIG_JITDUMP
 libperf-$(CONFIG_LIBELF) += jitdump.o
 libperf-$(CONFIG_LIBELF) += genelf.o
-libperf-$(CONFIG_LIBELF) += genelf_debug.o
+libperf-$(CONFIG_DWARF) += genelf_debug.o
 endif
 
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
index 8a2995ea426f12f2173a294d218e67321b8e30c7..30dece345b9f4d9d41aa1b2a34033f5a7745cf77 100644 (file)
@@ -19,7 +19,9 @@
 #include <limits.h>
 #include <fcntl.h>
 #include <err.h>
+#ifdef HAVE_DWARF_SUPPORT
 #include <dwarf.h>
+#endif
 
 #include "perf.h"
 #include "genelf.h"
@@ -161,7 +163,7 @@ gen_build_id(struct buildid_note *note, unsigned long load_addr, const void *cod
 int
 jit_write_elf(int fd, uint64_t load_addr, const char *sym,
              const void *code, int csize,
-             void *debug, int nr_debug_entries)
+             void *debug __maybe_unused, int nr_debug_entries __maybe_unused)
 {
        Elf *e;
        Elf_Data *d;
@@ -390,11 +392,14 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym,
        shdr->sh_size = sizeof(bnote);
        shdr->sh_entsize = 0;
 
+#ifdef HAVE_DWARF_SUPPORT
        if (debug && nr_debug_entries) {
                retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries);
                if (retval)
                        goto error;
-       } else {
+       } else
+#endif
+       {
                if (elf_update(e, ELF_C_WRITE) < 0) {
                        warnx("elf_update 4 failed");
                        goto error;
index 2fbeb59c4bdd91b2b9de943d153c3674c46ca125..5c933ac71451f778d4e9b6f9fef10b5c1d095f5b 100644 (file)
@@ -4,8 +4,10 @@
 /* genelf.c */
 int jit_write_elf(int fd, uint64_t code_addr, const char *sym,
                  const void *code, int csize, void *debug, int nr_debug_entries);
+#ifdef HAVE_DWARF_SUPPORT
 /* genelf_debug.c */
 int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries);
+#endif
 
 #if   defined(__arm__)
 #define GEN_ELF_ARCH   EM_ARM