Skip to content

Commit b55f0c3

Browse files
committed
Merge #13611: [bugfix] Use __cpuid_count for gnu C to avoid gitian build fail.
63c16ed Use __cpuid_count for gnu C to avoid gitian build fail. (Chun Kuan Lee) Pull request description: Fixes #13538 Tree-SHA512: 161ae4db022288ae8631a166eaea2d08cf2c90bcd27218a094a754276de30b92ca9cfb5a79aa899c5a9d0534c5d7261037e7e915e1b92bc7067ab1539dc2b51e
2 parents 88a15eb + 63c16ed commit b55f0c3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/crypto/sha256.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <string.h>
1010
#include <atomic>
1111

12-
#if defined(__x86_64__) || defined(__amd64__)
12+
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
1313
#if defined(USE_ASM)
1414
#include <cpuid.h>
1515
namespace sha256_sse4
@@ -534,7 +534,11 @@ bool SelfTest() {
534534
// We can't use cpuid.h's __get_cpuid as it does not support subleafs.
535535
void inline cpuid(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uint32_t& c, uint32_t& d)
536536
{
537+
#ifdef __GNUC__
538+
__cpuid_count(leaf, subleaf, a, b, c, d);
539+
#else
537540
__asm__ ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(leaf), "2"(subleaf));
541+
#endif
538542
}
539543

540544
/** Check whether the OS has enabled AVX registers. */

0 commit comments

Comments
 (0)