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