about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-06-12 13:19:42 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-06-12 13:23:18 +0200
commit63e9d1c51ec0ad41c3ef729851442f199ce06a25 (patch)
tree3046cc434ea091e473edd6d28fda8f7c3c844aa6
parentd8f2284808e20e307ac40d71e21ab4ca8850c220 (diff)
downloadnixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.tar
nixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.tar.gz
nixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.tar.bz2
nixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.tar.lz
nixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.tar.xz
nixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.tar.zst
nixlib-63e9d1c51ec0ad41c3ef729851442f199ce06a25.zip
perf: Fix perf annotate
This command requires objdump, so make sure it can find it.
-rw-r--r--pkgs/os-specific/linux/kernel/perf-binutils-path.patch12
-rw-r--r--pkgs/os-specific/linux/kernel/perf.nix13
2 files changed, 21 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/kernel/perf-binutils-path.patch b/pkgs/os-specific/linux/kernel/perf-binutils-path.patch
new file mode 100644
index 000000000000..d20f2296ea30
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/perf-binutils-path.patch
@@ -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),
diff --git a/pkgs/os-specific/linux/kernel/perf.nix b/pkgs/os-specific/linux/kernel/perf.nix
index fa4ac3b513d8..0a3b4070be17 100644
--- a/pkgs/os-specific/linux/kernel/perf.nix
+++ b/pkgs/os-specific/linux/kernel/perf.nix
@@ -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
@@ -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"