From 51e333fd0b9973b6ae1c9be6df8592e1a436da56 Mon Sep 17 00:00:00 2001 From: ericscalibur Date: Thu, 30 Jul 2026 00:57:19 +0000 Subject: [PATCH] sha: restrict the x86 bswap asm to x86 ByteReverse(word32) in src/sha.h uses the x86 `bswap` instruction via inline asm, guarded only by `#if defined(__GNUC__)`. GCC and Clang define __GNUC__ on every architecture they target, so on aarch64 the guard passes and the assembler then rejects the instruction: Error: unknown mnemonic `bswap' -- `bswap %eax' This makes the tree fail to build on any ARM64 host -- Apple Silicon, ARM servers, a Raspberry Pi -- at a point far from anything the user did. Narrow the guard to the architectures where the instruction exists. The portable C fallback directly below is then used everywhere else; it was already there and already correct. Co-Authored-By: Claude Opus 5 --- src/sha.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sha.h b/src/sha.h index e3af7b4..ddf5cf1 100644 --- a/src/sha.h +++ b/src/sha.h @@ -72,7 +72,7 @@ inline word16 ByteReverse(word16 value) inline word32 ByteReverse(word32 value) { -#if defined(__GNUC__) +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) __asm__ ("bswap %0" : "=r" (value) : "0" (value)); return value; #elif defined(CRYPTOPP_BYTESWAP_AVAILABLE)