guix: Apply SSA generation patch to maintain determinism
What changed, and why it matters
This commit applies a patch to the GCC compiler used by Bitcoin Core's Guix build system. The patch fixes a compiler bug where the order of internal numbering could differ depending on the build machine's processor architecture (x86_64 vs aarch64). This caused the same source code to produce slightly different binary outputs when cross-compiled on different host machines. The fix ensures the numbering happens in a fixed, predictable order, restoring 'deterministic builds'—the property that the same source always produces the exact same binary. This is not a vulnerability in Bitcoin Core itself and does not create a way to attack users directly.
No immediate user action required. For maintainers, ensure the patched GCC is used for all release builds and verify build hashes match across x86_64 and aarch64 build hosts. Consider monitoring upstream GCC for inclusion of PR123351 so the local patch can eventually be removed.
Security signals we found
Build reproducibility/determinism regression in release toolchain
Cross-architecture host-dependent compiler output
Upstream GCC bug fix backported into project build environment
No runtime code change to Bitcoin Core
Evidence from the diff
The commit adds contrib/guix/patches/gcc-ssa-generation.patch and registers it in contrib/guix/manifest.scm. The patch, authored by Jakub Jelinek and Marco Falke, addresses GCC PR123351. In gcc/tree-object-size.cc, object_sizes_set_temp previously passed two make_ssa_name(sizetype) calls as arguments to object_sizes_set. Because C++ argument evaluation order is unspecified, the two make_ssa_name calls—which mutate the global SSA version counter—could execute in opposite orders on different host architectures. This produced divergent SSA version numbering and object files when cross-compiling on x86_64 versus aarch64. The patch sequences the calls into separate statements before invoking object_sizes_set, eliminating the architecture-dependent nondeterminism.
Changed components
Bitcoin Core Guix release build toolchainGCC compiler patch set in contrib/guix/patches/contrib/guix/manifest.scmInspect captured patch +50 / −1
diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
index 0ad6bdb7..bd4996e5 100644
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -123,7 +123,7 @@ desirable for building Bitcoin Core release binaries."
(define (gcc-libgcc-patches gcc)
(package-with-extra-patches gcc
- (search-our-patches "gcc-remap-guix-store.patch")))
+ (search-our-patches "gcc-remap-guix-store.patch" "gcc-ssa-generation.patch")))
(define (binutils-mingw-patches binutils)
(package-with-extra-patches binutils
diff --git a/contrib/guix/patches/gcc-ssa-generation.patch b/contrib/guix/patches/gcc-ssa-generation.patch
new file mode 100644
index 00000000..2e5a6002
--- /dev/null
+++ b/contrib/guix/patches/gcc-ssa-generation.patch
@@ -0,0 +1,49 @@
+commit b46614ebfc57ccca8a050668ad0e8ba5968c5943
+Author: Jakub Jelinek <jakub@redhat.com>
+Date: Tue Jan 6 08:36:20 2026 +0100
+
+ tree-object-size: Deterministic SSA generation [PR123351]
+
+ The order of evaluation of function arguments is unspecified in C++.
+ The function object_sizes_set_temp called object_sizes_set with two
+ calls to make_ssa_name() as arguments. Since make_ssa_name() has the
+ side effect of incrementing the global SSA version counter, different
+ architectures of the same compiler evaluated these calls in different
+ orders.
+
+ This resulted in non-deterministic SSA version numbering between
+ x86_64 and aarch64 hosts during cross-compilation, leading to
+ divergent object files.
+
+ Sequencing the calls into separate statements ensures deterministic
+ evaluation order.
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123351
+ https://gcc.gnu.org/pipermail/gcc-patches/2026-January/704817.html
+
+ 2026-01-06 Jakub Jelinek <jakub@redhat.com>
+ Marco Falke <falke.marco@gmail.com>
+
+ PR tree-optimization/123351
+ * tree-object-size.cc (object_sizes_set_temp): Separate calls to
+ make_ssa_name to ensure deterministic execution order.
+
+diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc
+index 018fbc30cbb..24e7d710371 100644
+--- a/gcc/tree-object-size.cc
++++ b/gcc/tree-object-size.cc
+@@ -319,9 +319,11 @@ object_sizes_set_temp (struct object_size_info *osi, unsigned varno)
+ tree val = object_sizes_get (osi, varno);
+
+ if (size_initval_p (val, osi->object_size_type))
+- object_sizes_set (osi, varno,
+- make_ssa_name (sizetype),
+- make_ssa_name (sizetype));
++ {
++ val = make_ssa_name (sizetype);
++ tree wholeval = make_ssa_name (sizetype);
++ object_sizes_set (osi, varno, val, wholeval);
++ }
+ }
+
+ /* Initialize OFFSET_LIMIT variable. */
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.