Merge #13177: GCC-7 and glibc-2.27 back compat code
253f592909
Add stdin, stdout, stderr to ignored export list (Chun Kuan Lee)fc6a9f2ab1
Use IN6ADDR_ANY_INIT instead of in6addr_any (Cory Fields)908c1d7745
GCC-7 and glibc-2.27 compat code (Chun Kuan Lee) Pull request description: The `__divmoddi4` code was modified from https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c . I manually find the older glibc version of log2f by objdump, use `.symver` to specify the certain version. Tree-SHA512: e8d875652003618c73e019ccc420e7a25d46f4eaff1c7a1a6bfc1770b3b46f074b368b2cb14df541b5ab124cca41dede4e28fe863a670589b834ef6b8713f9c4
This commit is contained in:
commit
dcb154e5aa
5 changed files with 51 additions and 2 deletions
|
@ -651,6 +651,8 @@ if test x$use_glibc_compat != xno; then
|
||||||
[ fdelt_type="long int"])
|
[ fdelt_type="long int"])
|
||||||
AC_MSG_RESULT($fdelt_type)
|
AC_MSG_RESULT($fdelt_type)
|
||||||
AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
|
AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
|
||||||
|
AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"])
|
||||||
|
AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"])
|
||||||
else
|
else
|
||||||
AC_SEARCH_LIBS([clock_gettime],[rt])
|
AC_SEARCH_LIBS([clock_gettime],[rt])
|
||||||
fi
|
fi
|
||||||
|
@ -1351,6 +1353,7 @@ AC_SUBST(DEBUG_CPPFLAGS)
|
||||||
AC_SUBST(WARN_CXXFLAGS)
|
AC_SUBST(WARN_CXXFLAGS)
|
||||||
AC_SUBST(NOWARN_CXXFLAGS)
|
AC_SUBST(NOWARN_CXXFLAGS)
|
||||||
AC_SUBST(DEBUG_CXXFLAGS)
|
AC_SUBST(DEBUG_CXXFLAGS)
|
||||||
|
AC_SUBST(COMPAT_LDFLAGS)
|
||||||
AC_SUBST(ERROR_CXXFLAGS)
|
AC_SUBST(ERROR_CXXFLAGS)
|
||||||
AC_SUBST(GPROF_CXXFLAGS)
|
AC_SUBST(GPROF_CXXFLAGS)
|
||||||
AC_SUBST(GPROF_LDFLAGS)
|
AC_SUBST(GPROF_LDFLAGS)
|
||||||
|
|
|
@ -46,7 +46,7 @@ MAX_VERSIONS = {
|
||||||
|
|
||||||
# Ignore symbols that are exported as part of every executable
|
# Ignore symbols that are exported as part of every executable
|
||||||
IGNORE_EXPORTS = {
|
IGNORE_EXPORTS = {
|
||||||
'_edata', '_end', '_init', '__bss_start', '_fini', '_IO_stdin_used'
|
'_edata', '_end', '_init', '__bss_start', '_fini', '_IO_stdin_used', 'stdin', 'stdout', 'stderr'
|
||||||
}
|
}
|
||||||
READELF_CMD = os.getenv('READELF', '/usr/bin/readelf')
|
READELF_CMD = os.getenv('READELF', '/usr/bin/readelf')
|
||||||
CPPFILT_CMD = os.getenv('CPPFILT', '/usr/bin/c++filt')
|
CPPFILT_CMD = os.getenv('CPPFILT', '/usr/bin/c++filt')
|
||||||
|
|
|
@ -418,6 +418,7 @@ libbitcoin_util_a_SOURCES = \
|
||||||
|
|
||||||
if GLIBC_BACK_COMPAT
|
if GLIBC_BACK_COMPAT
|
||||||
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
|
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
|
||||||
|
AM_LDFLAGS += $(COMPAT_LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# cli: shared between bitcoin-cli and bitcoin-qt
|
# cli: shared between bitcoin-cli and bitcoin-qt
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#if defined(HAVE_SYS_SELECT_H)
|
#if defined(HAVE_SYS_SELECT_H)
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
@ -27,3 +28,47 @@ extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a)
|
||||||
return a / __NFDBITS;
|
return a / __NFDBITS;
|
||||||
}
|
}
|
||||||
extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));
|
extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));
|
||||||
|
|
||||||
|
#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");
|
||||||
|
#endif
|
||||||
|
extern "C" float __wrap_log2f(float x)
|
||||||
|
{
|
||||||
|
return log2f_old(x);
|
||||||
|
}
|
||||||
|
|
|
@ -2254,7 +2254,7 @@ bool CConnman::InitBinds(const std::vector<CService>& binds, const std::vector<C
|
||||||
if (binds.empty() && whiteBinds.empty()) {
|
if (binds.empty() && whiteBinds.empty()) {
|
||||||
struct in_addr inaddr_any;
|
struct in_addr inaddr_any;
|
||||||
inaddr_any.s_addr = INADDR_ANY;
|
inaddr_any.s_addr = INADDR_ANY;
|
||||||
fBound |= Bind(CService(in6addr_any, GetListenPort()), BF_NONE);
|
fBound |= Bind(CService((in6_addr)IN6ADDR_ANY_INIT, GetListenPort()), BF_NONE);
|
||||||
fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE);
|
fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE);
|
||||||
}
|
}
|
||||||
return fBound;
|
return fBound;
|
||||||
|
|
Loading…
Reference in a new issue