xref: /OK3568_Linux_fs/buildroot/package/bitcoin/0001-src-randomenv.cpp-fix-build-on-uclibc.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom 330cb33985d0ce97c20f4a0f0bbda0fbffe098d4 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3*4882a593SmuzhiyunDate: Mon, 9 Nov 2020 21:18:40 +0100
4*4882a593SmuzhiyunSubject: [PATCH] src/randomenv.cpp: fix build on uclibc
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunCheck for HAVE_STRONG_GETAUXVAL or HAVE_WEAK_GETAUXVAL before using
7*4882a593Smuzhiyungetauxval to avoid a build failure on uclibc
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
10*4882a593Smuzhiyun[Upstream status: https://github.com/bitcoin/bitcoin/pull/20358]
11*4882a593Smuzhiyun---
12*4882a593Smuzhiyun src/randomenv.cpp | 6 +++---
13*4882a593Smuzhiyun 1 file changed, 3 insertions(+), 3 deletions(-)
14*4882a593Smuzhiyun
15*4882a593Smuzhiyundiff --git a/src/randomenv.cpp b/src/randomenv.cpp
16*4882a593Smuzhiyunindex 07122b7f6..5e07c3db4 100644
17*4882a593Smuzhiyun--- a/src/randomenv.cpp
18*4882a593Smuzhiyun+++ b/src/randomenv.cpp
19*4882a593Smuzhiyun@@ -53,7 +53,7 @@
20*4882a593Smuzhiyun #include <sys/vmmeter.h>
21*4882a593Smuzhiyun #endif
22*4882a593Smuzhiyun #endif
23*4882a593Smuzhiyun-#ifdef __linux__
24*4882a593Smuzhiyun+#if defined(HAVE_STRONG_GETAUXVAL) || defined(HAVE_WEAK_GETAUXVAL)
25*4882a593Smuzhiyun #include <sys/auxv.h>
26*4882a593Smuzhiyun #endif
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun@@ -326,7 +326,7 @@ void RandAddStaticEnv(CSHA512& hasher)
29*4882a593Smuzhiyun     // Bitcoin client version
30*4882a593Smuzhiyun     hasher << CLIENT_VERSION;
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun-#ifdef __linux__
33*4882a593Smuzhiyun+#if defined(HAVE_STRONG_GETAUXVAL) || defined(HAVE_WEAK_GETAUXVAL)
34*4882a593Smuzhiyun     // Information available through getauxval()
35*4882a593Smuzhiyun #  ifdef AT_HWCAP
36*4882a593Smuzhiyun     hasher << getauxval(AT_HWCAP);
37*4882a593Smuzhiyun@@ -346,7 +346,7 @@ void RandAddStaticEnv(CSHA512& hasher)
38*4882a593Smuzhiyun     const char* exec_str = (const char*)getauxval(AT_EXECFN);
39*4882a593Smuzhiyun     if (exec_str) hasher.Write((const unsigned char*)exec_str, strlen(exec_str) + 1);
40*4882a593Smuzhiyun #  endif
41*4882a593Smuzhiyun-#endif // __linux__
42*4882a593Smuzhiyun+#endif // HAVE_STRONG_GETAUXVAL || HAVE_WEAK_GETAUXVAL
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun #ifdef HAVE_GETCPUID
45*4882a593Smuzhiyun     AddAllCPUID(hasher);
46*4882a593Smuzhiyun--
47*4882a593Smuzhiyun2.28.0
48*4882a593Smuzhiyun
49