Skip to content

Commit

Permalink
perf: Fix perf annotate
Browse files Browse the repository at this point in the history
This command requires objdump, so make sure it can find it.

(cherry picked from commit 63e9d1c)
  • Loading branch information
edolstra committed Jun 12, 2017
1 parent 7a76e25 commit 74a1ea1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions pkgs/os-specific/linux/kernel/perf-binutils-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -ru -x '*~' linux-4.9.31-orig/tools/perf/util/annotate.c linux-4.9.31/tools/perf/util/annotate.c
--- linux-4.9.31-orig/tools/perf/util/annotate.c 2017-06-07 12:08:04.000000000 +0200
+++ linux-4.9.31/tools/perf/util/annotate.c 2017-06-12 13:10:08.811079574 +0200
@@ -1350,7 +1350,7 @@
"%s %s%s --start-address=0x%016" PRIx64
" --stop-address=0x%016" PRIx64
" -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
- objdump_path ? objdump_path : "objdump",
+ objdump_path ? objdump_path : OBJDUMP_PATH,
disassembler_style ? "-M " : "",
disassembler_style ? disassembler_style : "",
map__rip_2objdump(map, sym->start),
13 changes: 9 additions & 4 deletions pkgs/os-specific/linux/kernel/perf.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ assert versionAtLeast kernel.version "3.12";
stdenv.mkDerivation {
name = "perf-linux-${kernel.version}";

inherit (kernel) src patches;
inherit (kernel) src;

patches = kernel.patches ++ [ ./perf-binutils-path.patch ];

preConfigure = ''
cd tools/perf
Expand All @@ -30,9 +32,12 @@ stdenv.mkDerivation {

# Note: we don't add elfutils to buildInputs, since it provides a
# bad `ld' and other stuff.
NIX_CFLAGS_COMPILE = [
"-Wno-error=cpp" "-Wno-error=bool-compare" "-Wno-error=deprecated-declarations"
]
NIX_CFLAGS_COMPILE =
[ "-Wno-error=cpp"
"-Wno-error=bool-compare"
"-Wno-error=deprecated-declarations"
"-DOBJDUMP_PATH=\"${binutils}/bin/objdump\""
]
# gcc before 6 doesn't know these options
++ stdenv.lib.optionals (hasPrefix "gcc-6" stdenv.cc.cc.name) [
"-Wno-error=unused-const-variable" "-Wno-error=misleading-indentation"
Expand Down

0 comments on commit 74a1ea1

Please sign in to comment.