Skip to content

Commit 3f8fdfb

Browse files
committed
build: fix x86_64 asm detection for some compilers
I Noticed this on OSX with clang, though it likely happens elsewhere as well. The result is disabled x86_64 asm. Due to missing escaping, this $0 was interpreted as the function name SECP_64BIT_ASM_CHECK, causing the compile-check to be broken on some compilers. The actual check looked like this: int main() { uint64_t a = 11, tmp; __asm__ __volatile__("movq SECP_64BIT_ASM_CHECKx100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx"); return 0; } It seems even more odd that it compiled anywhere.
1 parent c18b869 commit 3f8fdfb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build-aux/m4/bitcoin_secp.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ AC_DEFUN([SECP_INT128_CHECK],[
33
has_int128=$ac_cv_type___int128
44
])
55

6-
dnl
6+
dnl escape "$0x" below using the m4 quadrigaph @S|@, and escape it again with a \ for the shell.
77
AC_DEFUN([SECP_64BIT_ASM_CHECK],[
88
AC_MSG_CHECKING(for x86_64 assembly availability)
99
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1010
#include <stdint.h>]],[[
1111
uint64_t a = 11, tmp;
12-
__asm__ __volatile__("movq $0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx");
12+
__asm__ __volatile__("movq \@S|@0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx");
1313
]])],[has_64bit_asm=yes],[has_64bit_asm=no])
1414
AC_MSG_RESULT([$has_64bit_asm])
1515
])

0 commit comments

Comments
 (0)