-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pahole: patch to force single-threaded mode if reproducibility is des…
…ired pahole's processes DWARF -> BTF in a pseudo-random order if multi threading is enabled (default in the Linux kernel). This can be fixed in dependent derivation by making sure users don't ever pass "-j" or "-j N", but it seems easier and safer to just detect whether reprodubility is desired (by proxy: if SOURCE_DATE_EPOCH is set) and ignore the multi-threading flag.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
pkgs/development/tools/misc/pahole/threading-reproducibility.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/pahole.c b/pahole.c | ||
index 6fc4ed6..a4e306f 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 |