aboutsummaryrefslogtreecommitdiff
path: root/src/compat/glibc_compat.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2014-04-09 22:40:33 -0400
committerCory Fields <cory-nospam-@coryfields.com>2014-04-10 22:27:09 -0400
commitffc6b678b9d12a8f963ab362b952fd6b7e6c4ec7 (patch)
tree91324e07fe007216b2d30272114778a59739134d /src/compat/glibc_compat.cpp
parent4c6cab2c5dbc6ce00970a3e579f7dd5dbcfcf03a (diff)
downloadbitcoin-ffc6b678b9d12a8f963ab362b952fd6b7e6c4ec7.tar.xz
build: add glibc/libstdc++ back-compat stubs
glibc/libstdc++ have added new symbols in later releases. When running a new binary against an older glibc, the run-time linker is unable to resolve the new symbols and the binary refuses to run. This can be fixed by adding our own versions of those functions, so that the build-time linker does not emit undefined symbols for them. This enables our binary releases to work on older Linux distros, while not incurring the downsides of a fully static binary.
Diffstat (limited to 'src/compat/glibc_compat.cpp')
-rw-r--r--src/compat/glibc_compat.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compat/glibc_compat.cpp b/src/compat/glibc_compat.cpp
new file mode 100644
index 0000000000..5b73e6051a
--- /dev/null
+++ b/src/compat/glibc_compat.cpp
@@ -0,0 +1,19 @@
+#include "bitcoin-config.h"
+#include <cstddef>
+#include <sys/select.h>
+
+// 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)
+{
+ return memmove(a, b, c);
+}
+
+extern "C" void __chk_fail (void) __attribute__((__noreturn__));
+extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a)
+{
+ if (a >= FD_SETSIZE)
+ __chk_fail ();
+ return a / __NFDBITS;
+}
+extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));