Bitcoin Core  0.20.99
P2P Digital Currency
glibc_compat.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2018 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #if defined(HAVE_CONFIG_H)
7 #endif
8 
9 #include <cstddef>
10 #include <cstdint>
11 
12 // Prior to GLIBC_2.14, memcpy was aliased to memmove.
13 extern "C" void* memmove(void* a, const void* b, size_t c);
14 extern "C" void* memcpy(void* a, const void* b, size_t c)
15 {
16  return memmove(a, b, c);
17 }
18 
19 #if defined(__i386__) || defined(__arm__)
20 
21 extern "C" int64_t __udivmoddi4(uint64_t u, uint64_t v, uint64_t* rp);
22 
23 extern "C" int64_t __wrap___divmoddi4(int64_t u, int64_t v, int64_t* rp)
24 {
25  int32_t c1 = 0, c2 = 0;
26  int64_t uu = u, vv = v;
27  int64_t w;
28  int64_t r;
29 
30  if (uu < 0) {
31  c1 = ~c1, c2 = ~c2, uu = -uu;
32  }
33  if (vv < 0) {
34  c1 = ~c1, vv = -vv;
35  }
36 
37  w = __udivmoddi4(uu, vv, (uint64_t*)&r);
38  if (c1)
39  w = -w;
40  if (c2)
41  r = -r;
42 
43  *rp = r;
44  return w;
45 }
46 #endif
47 
48 extern "C" float log2f_old(float x);
49 #ifdef __i386__
50 __asm(".symver log2f_old,log2f@GLIBC_2.1");
51 #elif defined(__amd64__)
52 __asm(".symver log2f_old,log2f@GLIBC_2.2.5");
53 #elif defined(__arm__)
54 __asm(".symver log2f_old,log2f@GLIBC_2.4");
55 #elif defined(__aarch64__)
56 __asm(".symver log2f_old,log2f@GLIBC_2.17");
57 #elif defined(__riscv)
58 __asm(".symver log2f_old,log2f@GLIBC_2.27");
59 #endif
60 extern "C" float __wrap_log2f(float x)
61 {
62  return log2f_old(x);
63 }
float __wrap_log2f(float x)
float log2f_old(float x)
void * memcpy(void *a, const void *b, size_t c)
void * memmove(void *a, const void *b, size_t c)