2018-07-27 00:36:45 +02:00
|
|
|
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
2014-09-27 13:49:21 +02:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2014-06-21 14:26:21 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#if defined(HAVE_CONFIG_H)
|
2017-11-10 01:57:53 +01:00
|
|
|
#include <config/bitcoin-config.h>
|
2014-06-21 14:26:21 +02:00
|
|
|
#endif
|
|
|
|
|
2014-04-10 04:40:33 +02:00
|
|
|
#include <cstddef>
|
2018-05-05 15:18:40 +02:00
|
|
|
#include <cstdint>
|
2014-09-27 13:49:21 +02:00
|
|
|
|
2014-06-21 14:26:21 +02:00
|
|
|
#if defined(HAVE_SYS_SELECT_H)
|
2014-04-10 04:40:33 +02:00
|
|
|
#include <sys/select.h>
|
2014-06-21 14:26:21 +02:00
|
|
|
#endif
|
2014-04-10 04:40:33 +02:00
|
|
|
|
|
|
|
// Prior to GLIBC_2.14, memcpy was aliased to memmove.
|
|
|
|
extern "C" void* memmove(void* a, const void* b, size_t c);
|
|
|
|
extern "C" void* memcpy(void* a, const void* b, size_t c)
|
|
|
|
{
|
2014-06-21 14:26:21 +02:00
|
|
|
return memmove(a, b, c);
|
2014-04-10 04:40:33 +02:00
|
|
|
}
|
|
|
|
|
2014-09-25 08:23:32 +02:00
|
|
|
extern "C" void __chk_fail(void) __attribute__((__noreturn__));
|
2014-04-10 04:40:33 +02:00
|
|
|
extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a)
|
|
|
|
{
|
2014-06-21 14:26:21 +02:00
|
|
|
if (a >= FD_SETSIZE)
|
2014-09-25 08:23:32 +02:00
|
|
|
__chk_fail();
|
2014-06-21 14:26:21 +02:00
|
|
|
return a / __NFDBITS;
|
2014-04-10 04:40:33 +02:00
|
|
|
}
|
|
|
|
extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));
|
2018-05-05 15:18:40 +02:00
|
|
|
|
|
|
|
#if defined(__i386__) || defined(__arm__)
|
|
|
|
|
|
|
|
extern "C" int64_t __udivmoddi4(uint64_t u, uint64_t v, uint64_t* rp);
|
|
|
|
|
|
|
|
extern "C" int64_t __wrap___divmoddi4(int64_t u, int64_t v, int64_t* rp)
|
|
|
|
{
|
|
|
|
int32_t c1 = 0, c2 = 0;
|
|
|
|
int64_t uu = u, vv = v;
|
|
|
|
int64_t w;
|
|
|
|
int64_t r;
|
|
|
|
|
|
|
|
if (uu < 0) {
|
|
|
|
c1 = ~c1, c2 = ~c2, uu = -uu;
|
|
|
|
}
|
|
|
|
if (vv < 0) {
|
|
|
|
c1 = ~c1, vv = -vv;
|
|
|
|
}
|
|
|
|
|
|
|
|
w = __udivmoddi4(uu, vv, (uint64_t*)&r);
|
|
|
|
if (c1)
|
|
|
|
w = -w;
|
|
|
|
if (c2)
|
|
|
|
r = -r;
|
|
|
|
|
|
|
|
*rp = r;
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern "C" float log2f_old(float x);
|
|
|
|
#ifdef __i386__
|
|
|
|
__asm(".symver log2f_old,log2f@GLIBC_2.1");
|
|
|
|
#elif defined(__amd64__)
|
|
|
|
__asm(".symver log2f_old,log2f@GLIBC_2.2.5");
|
|
|
|
#elif defined(__arm__)
|
|
|
|
__asm(".symver log2f_old,log2f@GLIBC_2.4");
|
|
|
|
#elif defined(__aarch64__)
|
|
|
|
__asm(".symver log2f_old,log2f@GLIBC_2.17");
|
2018-07-14 03:39:24 +02:00
|
|
|
#elif defined(__riscv)
|
|
|
|
__asm(".symver log2f_old,log2f@GLIBC_2.27");
|
2018-05-05 15:18:40 +02:00
|
|
|
#endif
|
|
|
|
extern "C" float __wrap_log2f(float x)
|
|
|
|
{
|
|
|
|
return log2f_old(x);
|
|
|
|
}
|