diff --git a/CMakeLists.txt b/CMakeLists.txt index 83d760c6619..b622d56beed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -876,12 +876,6 @@ else() set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap") endif() - if(BACKCOMPAT) - add_linker_flag_if_supported(-Wl,--wrap=__divmoddi4 LD_BACKCOMPAT_FLAGS) - add_linker_flag_if_supported(-Wl,--wrap=glob LD_BACKCOMPAT_FLAGS) - message(STATUS "Using Lib C back compat flags: ${LD_BACKCOMPAT_FLAGS}") - endif() - # some windows linker bits if (WIN32) add_linker_flag_if_supported(-Wl,--dynamicbase LD_SECURITY_FLAGS) @@ -902,7 +896,7 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${PIC_FLAG} ${C_SECURITY_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${PIC_FLAG} ${CXX_SECURITY_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${LD_BACKCOMPAT_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}") # With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that # is fixed in the code (Issue #847), force compiler to be conservative. diff --git a/README.md b/README.md index f0c0fe7fdef..8bb41d33d75 100644 --- a/README.md +++ b/README.md @@ -587,7 +587,7 @@ The required packages are the names for each toolchain on apt. Depending on your Using `depends` might also be easier to compile Monero on Windows than using MSYS. Activate Windows Subsystem for Linux (WSL) with a distro (for example Ubuntu), install the apt build-essentials and follow the `depends` steps as depicted above. -The produced binaries still link libc dynamically. If the binary is compiled on a current distribution, it might not run on an older distribution with an older installation of libc. Passing `-DBACKCOMPAT=ON` to cmake will make sure that the binary will run on systems having at least libc version 2.17. +The produced binaries still link libc dynamically. If the binary is compiled on a current distribution, it might not run on an older distribution with an older installation of libc. ### Trezor hardware wallet support diff --git a/contrib/depends/packages/sodium.mk b/contrib/depends/packages/sodium.mk index 87b34599eea..4be87e29f59 100644 --- a/contrib/depends/packages/sodium.mk +++ b/contrib/depends/packages/sodium.mk @@ -3,7 +3,7 @@ $(package)_version=1.0.18 $(package)_download_path=https://download.libsodium.org/libsodium/releases/ $(package)_file_name=libsodium-$($(package)_version).tar.gz $(package)_sha256_hash=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1 -$(package)_patches=disable-glibc-getrandom-getentropy.patch fix-whitespace.patch +$(package)_patches=fix-whitespace.patch define $(package)_set_vars $(package)_config_opts=--enable-static --disable-shared @@ -11,7 +11,6 @@ $(package)_config_opts+=--prefix=$(host_prefix) endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/disable-glibc-getrandom-getentropy.patch &&\ autoconf &&\ patch -p1 < $($(package)_patch_dir)/fix-whitespace.patch endef diff --git a/contrib/depends/packages/unbound.mk b/contrib/depends/packages/unbound.mk index 166cc3f79fc..e714cb8797b 100644 --- a/contrib/depends/packages/unbound.mk +++ b/contrib/depends/packages/unbound.mk @@ -4,7 +4,6 @@ $(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=a480dc6c8937447b98d161fe911ffc76cfaffa2da18788781314e81339f1126f $(package)_dependencies=openssl expat -$(package)_patches=disable-glibc-reallocarray.patch define $(package)_set_vars @@ -16,7 +15,6 @@ define $(package)_set_vars endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/disable-glibc-reallocarray.patch &&\ autoconf endef diff --git a/contrib/depends/patches/sodium/disable-glibc-getrandom-getentropy.patch b/contrib/depends/patches/sodium/disable-glibc-getrandom-getentropy.patch deleted file mode 100644 index 2f07c10573c..00000000000 --- a/contrib/depends/patches/sodium/disable-glibc-getrandom-getentropy.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 9e2de27c..0fa85c2d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -807,6 +807,10 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[ - # include - #endif - ]], [[ -+#ifdef __linux__ -+# error getrandom() is currently disabled on Linux to support glibc < 2.25 -+#endif -+ - unsigned char buf; - (void) getrandom((void *) &buf, 1U, 0U); - ]])], -@@ -825,6 +829,9 @@ unsigned char buf; - # include - #endif - ]], [[ -+#ifdef __linux__ -+# error getentropy() is currently disabled on Linux to support glibc < 2.25 -+#endif - #ifdef __APPLE__ - # error getentropy() is currently disabled on Apple operating systems - #endif diff --git a/contrib/depends/patches/unbound/disable-glibc-reallocarray.patch b/contrib/depends/patches/unbound/disable-glibc-reallocarray.patch deleted file mode 100644 index d66a821ad59..00000000000 --- a/contrib/depends/patches/unbound/disable-glibc-reallocarray.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 5c7da197..e2b25288 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1702,6 +1702,9 @@ AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT - #ifndef _OPENBSD_SOURCE - #define _OPENBSD_SOURCE 1 - #endif -+#ifdef __linux__ -+# error reallocarray() is currently disabled on Linux to support glibc < 2.26 -+#endif - #include - int main(void) { - void* p = reallocarray(NULL, 10, 100); diff --git a/contrib/gitian/gitian-linux.yml b/contrib/gitian/gitian-linux.yml index 41915deb9ee..1dff45f9d98 100644 --- a/contrib/gitian/gitian-linux.yml +++ b/contrib/gitian/gitian-linux.yml @@ -160,13 +160,7 @@ script: | fi export C_INCLUDE_PATH="$EXTRA_INCLUDES" export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES" - # glibc only added riscv support in 2.27, disable backwards compatibility - if [ "$i" == "riscv64-linux-gnu" ]; then - BACKCOMPAT_OPTION=OFF - else - BACKCOMPAT_OPTION=ON - fi - cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=${BACKCOMPAT_OPTION} -DCMAKE_SKIP_RPATH=ON + cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DCMAKE_SKIP_RPATH=ON make ${MAKEOPTS} chmod 755 bin/* cp ../LICENSE ../README.md ../docs/ANONYMITY_NETWORKS.md bin diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index cf38466fe27..ffa0f5601b8 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -52,10 +52,6 @@ if (STACK_TRACE) list(APPEND common_sources stack_trace.cpp) endif() -if (BACKCOMPAT) - list(APPEND common_sources compat/glibc_compat.cpp) -endif() - set(common_headers) monero_find_all_headers(common_private_headers "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/src/common/compat/glibc_compat.cpp b/src/common/compat/glibc_compat.cpp deleted file mode 100644 index 435e7930fca..00000000000 --- a/src/common/compat/glibc_compat.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#if defined(HAVE_SYS_SELECT_H) -#include -#endif - -// 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* memset(void* a, int b, long unsigned int 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__)); - -#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 - -/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero - redirects to that. */ -#undef explicit_bzero -/* Set LEN bytes of S to 0. The compiler will not delete a call to - this function, even if S is dead after the call. */ -void -explicit_bzero (void *s, size_t len) -{ - memset (s, '\0', len); - /* Compiler barrier. */ - asm volatile ("" ::: "memory"); -} - -// Redefine explicit_bzero_chk -void -__explicit_bzero_chk (void *dst, size_t len, size_t dstlen) -{ - /* Inline __memset_chk to avoid a PLT reference to __memset_chk. */ - if (__glibc_unlikely (dstlen < len)) - __chk_fail (); - memset (dst, '\0', len); - /* Compiler barrier. */ - asm volatile ("" ::: "memory"); -} -/* libc-internal references use the hidden - __explicit_bzero_chk_internal symbol. This is necessary if - __explicit_bzero_chk is implemented as an IFUNC because some - targets do not support hidden references to IFUNC symbols. */ -#define strong_alias (__explicit_bzero_chk, __explicit_bzero_chk_internal) - -#undef glob -extern "C" int glob_old(const char * pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob); -#ifdef __i386__ -__asm__(".symver glob_old,glob@GLIBC_2.0"); -#elif defined(__amd64__) -__asm__(".symver glob_old,glob@GLIBC_2.2.5"); -#elif defined(__arm__) -__asm(".symver glob_old,glob@GLIBC_2.4"); -#elif defined(__aarch64__) -__asm__(".symver glob_old,glob@GLIBC_2.17"); -#endif - -extern "C" int __wrap_glob(const char * pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob) -{ - return glob_old(pattern, flags, errfunc, pglob); -} -