File: kbuild-bpf-fix-btf-reproducibility.patch

package info (click to toggle)
linux 6.16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,724,576 kB
  • sloc: ansic: 26,558,545; asm: 271,315; sh: 143,998; python: 72,469; makefile: 57,126; perl: 36,821; xml: 19,553; cpp: 5,820; yacc: 4,915; lex: 2,955; awk: 1,667; sed: 28; ruby: 25
file content (45 lines) | stat: -rw-r--r-- 1,605 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From: Ben Hutchings <benh@debian.org>
Date: Mon, 16 Sep 2024 01:54:24 +0200
Subject: kbuild, bpf: Fix BTF reproducibility

pahole 1.22 introduced the -j option for parallel processing, and
kbuild uses it, but this makes its output unreproducible.

pahole 1.27 introduced --btf_features=+reproducible_build which makes
the output reproducible even when -j is used.

Assume that if KBUILD_BUILD_TIMESTAMP is set then a reproducible build
is required, and use both options if available or neither if not.

Signed-off-by: Ben Hutchings <benh@debian.org>
---
--- a/scripts/Makefile.btf
+++ b/scripts/Makefile.btf
@@ -14,8 +14,6 @@ endif
 
 pahole-flags-$(call test-ge, $(pahole-ver), 121)	+= --btf_gen_floats
 
-pahole-flags-$(call test-ge, $(pahole-ver), 122)	+= -j$(JOBS)
-
 pahole-flags-$(call test-ge, $(pahole-ver), 125)	+= --skip_encoding_btf_inconsistent_proto --btf_gen_optimized
 
 else
@@ -29,6 +27,18 @@ endif
 
 endif
 
+# pahole 1.22 introduced the -j option for parallel processing, but
+# this makes its output unreproducible.
+# pahole 1.27 introduced --btf_features=+reproducible_build which
+# makes the output reproducible even when -j is used.
+# Assume that if KBUILD_BUILD_TIMESTAMP is set then a reproducible
+# build is required and we must not use -j alone.
+ifeq ($(KBUILD_BUILD_TIMESTAMP),)
+pahole-flags-$(call test-ge, $(pahole-ver), 122)	+= -j$(JOBS)
+else
+pahole-flags-$(call test-ge, $(pahole-ver), 127)	+= -j$(JOBS) --btf_features=+reproducible_build
+endif
+
 pahole-flags-$(CONFIG_PAHOLE_HAS_LANG_EXCLUDE)		+= --lang_exclude=rust
 
 export PAHOLE_FLAGS := $(pahole-flags-y)