Skip to content

Commit

Permalink
guix: replace GCC unaligned VMOV patch with binutils patch
Browse files Browse the repository at this point in the history
Rather than invasively patching GCC. Given we have binutils 2.38
available, we can patch it to flip the default for
`-muse-unaligned-vector-move`.
  • Loading branch information
fanquake committed Apr 10, 2024
1 parent 3f6a6da commit a0dc2eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 291 deletions.
9 changes: 6 additions & 3 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,15 @@ desirable for building Bitcoin Core release binaries."

(define (gcc-mingw-patches gcc)
(package-with-extra-patches gcc
(search-our-patches "gcc-remap-guix-store.patch"
"vmov-alignment.patch")))
(search-our-patches "gcc-remap-guix-store.patch")))

(define (binutils-mingw-patches binutils)
(package-with-extra-patches binutils
(search-our-patches "binutils-unaligned-default.patch")))

(define (make-mingw-pthreads-cross-toolchain target)
"Create a cross-compilation toolchain package for TARGET"
(let* ((xbinutils (cross-binutils target))
(let* ((xbinutils (binutils-mingw-patches (cross-binutils target)))
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
(pthreads-xgcc (cross-gcc target
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
Expand Down
22 changes: 22 additions & 0 deletions contrib/guix/patches/binutils-unaligned-default.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
commit 6537181f59ed186a341db621812a6bc35e22eaf6
Author: fanquake <[email protected]>
Date: Wed Apr 10 12:15:52 2024 +0200

build: turn on -muse-unaligned-vector-move by default

This allows us to avoid (more invasively) patching GCC, to avoid
unaligned instruction use.

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index e0632681477..14a9653abdf 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -801,7 +801,7 @@ static unsigned int no_cond_jump_promotion = 0;
static unsigned int sse2avx;

/* Encode aligned vector move as unaligned vector move. */
-static unsigned int use_unaligned_vector_move;
+static unsigned int use_unaligned_vector_move = 1;

/* Encode scalar AVX instructions with specific vector length. */
static enum
288 changes: 0 additions & 288 deletions contrib/guix/patches/vmov-alignment.patch

This file was deleted.

0 comments on commit a0dc2eb

Please sign in to comment.