From 8a826cb8f8de93b4b494e12808e2b87fcc7fe611 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 12 Jun 2024 08:29:46 +0900 Subject: [PATCH 1/3] pahole: 1.26 -> 1.27 --- pkgs/by-name/pa/pahole/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/pa/pahole/package.nix b/pkgs/by-name/pa/pahole/package.nix index 275044ee40c0..bc4647eb833d 100644 --- a/pkgs/by-name/pa/pahole/package.nix +++ b/pkgs/by-name/pa/pahole/package.nix @@ -13,10 +13,10 @@ stdenv.mkDerivation rec { pname = "pahole"; - version = "1.26"; + version = "1.27"; src = fetchzip { url = "https://git.kernel.org/pub/scm/devel/pahole/pahole.git/snapshot/pahole-${version}.tar.gz"; - hash = "sha256-Lf9Z4vHRFplMrUf4VhJ7EDPn+S4RaS1Emm0wyEcG2HU="; + hash = "sha256-BwA17lc2yegmOzLfoIu8OmG/PVdc+4sOGzB8Jc4ZjGM="; }; nativeBuildInputs = [ cmake pkg-config ]; From d354c891fbb0587a6a05fe3b67a902cfb3d8543c Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 12 Jun 2024 21:52:15 +0900 Subject: [PATCH 2/3] pahole: reproducibility: use --reproducible_build instead of -j1 New version brought in the --reproducible_build option, which is more efficient than forcing a single thread, and produces the same output (tested on linux kernel's vmlinux BTF extraction) --- pkgs/by-name/pa/pahole/package.nix | 1 + .../pa/pahole/threading-reproducibility.patch | 27 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/pa/pahole/package.nix b/pkgs/by-name/pa/pahole/package.nix index bc4647eb833d..0f7422587d43 100644 --- a/pkgs/by-name/pa/pahole/package.nix +++ b/pkgs/by-name/pa/pahole/package.nix @@ -26,6 +26,7 @@ stdenv.mkDerivation rec { musl-obstack ]; + # https://github.com/acmel/dwarves/pull/51 patches = [ ./threading-reproducibility.patch ]; # Put libraries in "lib" subdirectory, not top level of $out diff --git a/pkgs/by-name/pa/pahole/threading-reproducibility.patch b/pkgs/by-name/pa/pahole/threading-reproducibility.patch index 15893ce2d035..3c76d9c8521e 100644 --- a/pkgs/by-name/pa/pahole/threading-reproducibility.patch +++ b/pkgs/by-name/pa/pahole/threading-reproducibility.patch @@ -1,18 +1,15 @@ diff --git a/pahole.c b/pahole.c -index 6fc4ed6..a4e306f 100644 +index 954498d2ad4f..2b010658330c 100644 --- a/pahole.c +++ b/pahole.c -@@ -1687,8 +1687,11 @@ static error_t pahole__options_parser(int key, char *arg, - class_name = arg; break; - case 'j': - #if _ELFUTILS_PREREQ(0, 178) -- conf_load.nr_jobs = arg ? atoi(arg) : -- sysconf(_SC_NPROCESSORS_ONLN) * 1.1; -+ // Force single thread if reproducibility is desirable. -+ if (!getenv("SOURCE_DATE_EPOCH")) { -+ conf_load.nr_jobs = arg ? atoi(arg) : -+ sysconf(_SC_NPROCESSORS_ONLN) * 1.1; -+ } - #else - fputs("pahole: Multithreading requires elfutils >= 0.178. Continuing with a single thread...\n", stderr); - #endif +@@ -3705,6 +3705,10 @@ int main(int argc, char *argv[]) + goto out; + } + ++ /* This being set means whoever called us tries to do a reproducible build */ ++ if (getenv("SOURCE_DATE_EPOCH")) ++ conf_load.reproducible_build = true; ++ + if (languages.str && parse_languages()) + return rc; + From df03fbf358920369685d8b88d68da366af78cb03 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 26 Jun 2024 12:38:38 +0900 Subject: [PATCH 3/3] pahole: fix issue with LLVM compiled kernels --- pkgs/by-name/pa/pahole/package.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/pa/pahole/package.nix b/pkgs/by-name/pa/pahole/package.nix index 0f7422587d43..14a31958c0e2 100644 --- a/pkgs/by-name/pa/pahole/package.nix +++ b/pkgs/by-name/pa/pahole/package.nix @@ -9,6 +9,7 @@ , argp-standalone , musl-obstack , nixosTests +, fetchpatch }: stdenv.mkDerivation rec { @@ -26,8 +27,16 @@ stdenv.mkDerivation rec { musl-obstack ]; - # https://github.com/acmel/dwarves/pull/51 - patches = [ ./threading-reproducibility.patch ]; + patches = [ + # https://github.com/acmel/dwarves/pull/51 / https://lkml.kernel.org/r/20240626032253.3406460-1-asmadeus@codewreck.org + ./threading-reproducibility.patch + # https://github.com/acmel/dwarves/issues/53 + (fetchpatch { + name = "fix-clang-btf-generation-bug.patch"; + url = "https://github.com/acmel/dwarves/commit/6a2b27c0f512619b0e7a769a18a0fb05bb3789a5.patch"; + hash = "sha256-Le1BAew/a/QKkYNLgSQxEvZ9mEEglUw8URwz1kiheeE="; + }) + ]; # Put libraries in "lib" subdirectory, not top level of $out cmakeFlags = [ "-D__LIB=lib" "-DLIBBPF_EMBEDDED=OFF" ];