Skip to content

Commit 5817885

Browse files
Merge #1749: build: Fix warnings in x86_64 assembly check
ab56007 build: Fix warnings in x86_64 assembly check (Hennadii Stepanov) Pull request description: On the master branch @ 10dab90, the x86_64 assembly check in both the Autotools and CMake build systems can fail depending on externally provided flags. For example: ``` $ env CFLAGS="-Wall -Werror" ./configure --with-asm=x86_64 <snip> checking for x86_64 assembly availability... no configure: error: x86_64 assembly requested but not available ``` or ``` $ env CFLAGS="-Wall -Werror" cmake -B build -DSECP256K1_ASM=x86_64 <snip> -- Performing Test HAVE_X86_64_ASM -- Performing Test HAVE_X86_64_ASM - Failed CMake Error at CMakeLists.txt:111 (message): x86_64 assembly requested but not available. -- Configuring incomplete, errors occurred! ``` The same issue occurs in CI jobs that build on Windows using clang-cl. This PR fixes both build systems. ACKs for top commit: real-or-random: utACK ab56007 furszy: ACK ab56007 Tree-SHA512: d556b642d58c601e7f027ac54975249e05a8b3927c5efd229be43d264b024d00eab9973193adb52f2f60075fca0571644662d61150a19098820091ced2d56fa0
2 parents 10dab90 + ab56007 commit 5817885

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build-aux/m4/bitcoin_secp.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ AC_DEFUN([SECP_X86_64_ASM_CHECK],[
33
AC_MSG_CHECKING(for x86_64 assembly availability)
44
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
55
#include <stdint.h>]],[[
6-
uint64_t a = 11, tmp;
6+
uint64_t a = 11, tmp = 0;
77
__asm__ __volatile__("movq \@S|@0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx");
88
]])], [has_x86_64_asm=yes], [has_x86_64_asm=no])
99
AC_MSG_RESULT([$has_x86_64_asm])

cmake/CheckX86_64Assembly.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ function(check_x86_64_assembly)
44
check_c_source_compiles("
55
#include <stdint.h>
66
7-
int main()
7+
int main(void)
88
{
9-
uint64_t a = 11, tmp;
9+
uint64_t a = 11, tmp = 0;
1010
__asm__ __volatile__(\"movq $0x100000000,%1; mulq %%rsi\" : \"+a\"(a) : \"S\"(tmp) : \"cc\", \"%rdx\");
11+
return 0;
1112
}
1213
" HAVE_X86_64_ASM)
1314
set(HAVE_X86_64_ASM ${HAVE_X86_64_ASM} PARENT_SCOPE)

0 commit comments

Comments
 (0)