From 71de24641131deaeac9be5d0f99812f11f1ff022 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 6 Nov 2020 08:48:05 +0300 Subject: [PATCH] Disable Linux GLIBC wraps for special builds. --- .../platform/linux/linux_glibc_wraps.c | 30 ----------- .../platform/linux/linux_glibc_wraps_32.c | 50 ------------------- .../platform/linux/linux_glibc_wraps_64.c | 25 ---------- Telegram/build/docker/centos_env/run.sh | 13 ++--- cmake | 2 +- 5 files changed, 5 insertions(+), 115 deletions(-) delete mode 100644 Telegram/SourceFiles/platform/linux/linux_glibc_wraps.c delete mode 100644 Telegram/SourceFiles/platform/linux/linux_glibc_wraps_32.c delete mode 100644 Telegram/SourceFiles/platform/linux/linux_glibc_wraps_64.c diff --git a/Telegram/SourceFiles/platform/linux/linux_glibc_wraps.c b/Telegram/SourceFiles/platform/linux/linux_glibc_wraps.c deleted file mode 100644 index f937dcd6db..0000000000 --- a/Telegram/SourceFiles/platform/linux/linux_glibc_wraps.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include -#include -#include - -void *__wrap_aligned_alloc(size_t alignment, size_t size) { - void *result = NULL; - return (posix_memalign(&result, alignment, size) == 0) - ? result - : NULL; -} - -int enable_secure_inited = 0; -int enable_secure = 1; - -char *__wrap_secure_getenv(const char *name) { - if (enable_secure_inited == 0) { - enable_secure_inited = 1; - enable_secure = (geteuid() != getuid()) - || (getegid() != getgid()); - } - return enable_secure ? NULL : getenv(name); -} - diff --git a/Telegram/SourceFiles/platform/linux/linux_glibc_wraps_32.c b/Telegram/SourceFiles/platform/linux/linux_glibc_wraps_32.c deleted file mode 100644 index 5ddf94fe70..0000000000 --- a/Telegram/SourceFiles/platform/linux/linux_glibc_wraps_32.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include -#include - -#if defined(_M_IX86) || defined(__i386__) -#define GETTIME_GLIBC_VERSION "2.2" -#elif defined(_M_ARM) || defined(__arm__) -#define GETTIME_GLIBC_VERSION "2.4" -#else -#error Please add glibc wraps for your architecture -#endif - -int __clock_gettime_glibc_old(clockid_t clk_id, struct timespec *tp); -__asm__(".symver __clock_gettime_glibc_old,clock_gettime@GLIBC_" GETTIME_GLIBC_VERSION); - -int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp) { - return __clock_gettime_glibc_old(clk_id, tp); -} - -uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem_p); - -int64_t __wrap___divmoddi4(int64_t num, int64_t den, int64_t *rem_p) { - int minus = 0; - int64_t v; - - if (num < 0) { - num = -num; - minus = 1; - } - if (den < 0) { - den = -den; - minus ^= 1; - } - - v = __udivmoddi4(num, den, (uint64_t *)rem_p); - if (minus) { - v = -v; - if (rem_p) - *rem_p = -(*rem_p); - } - - return v; -} - diff --git a/Telegram/SourceFiles/platform/linux/linux_glibc_wraps_64.c b/Telegram/SourceFiles/platform/linux/linux_glibc_wraps_64.c deleted file mode 100644 index f0ec95577b..0000000000 --- a/Telegram/SourceFiles/platform/linux/linux_glibc_wraps_64.c +++ /dev/null @@ -1,25 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include - -#if defined(_M_X64) || defined(__x86_64__) -#define GETTIME_GLIBC_VERSION "2.2.5" -#elif defined(__aarch64__) -#define GETTIME_GLIBC_VERSION "2.17" -#else -#error Please add glibc wraps for your architecture -#endif - -int __clock_gettime_glibc_old(clockid_t clk_id, struct timespec *tp); -__asm__(".symver __clock_gettime_glibc_old,clock_gettime@GLIBC_" GETTIME_GLIBC_VERSION); - - -int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp) { - return __clock_gettime_glibc_old(clk_id, tp); -} - diff --git a/Telegram/build/docker/centos_env/run.sh b/Telegram/build/docker/centos_env/run.sh index 2e65751cf1..84e211e506 100755 --- a/Telegram/build/docker/centos_env/run.sh +++ b/Telegram/build/docker/centos_env/run.sh @@ -13,14 +13,9 @@ if [ ! -d "$FullScriptPath/../../../../../DesktopPrivate" ]; then exit fi -Error () { - cd $FullExecPath - echo "$1" - exit 1 -} - -if [ "$1" == "" ]; then - Error "Script not found!" +Command="$1" +if [ "$Command" == "" ]; then + Command="scl enable devtoolset-8 -- bash" fi -docker run -it --rm --cpus=8 --memory=10g -v $HOME/Telegram/DesktopPrivate:/usr/src/DesktopPrivate -v $HOME/Telegram/tdesktop:/usr/src/tdesktop tdesktop:centos_env $1 +docker run -it --rm --cpus=8 --memory=10g -v $HOME/Telegram/DesktopPrivate:/usr/src/DesktopPrivate -v $HOME/Telegram/tdesktop:/usr/src/tdesktop tdesktop:centos_env $Command diff --git a/cmake b/cmake index 3a2d8a252d..4bf45519f6 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 3a2d8a252d7e84547b532605aaa557a8c70d6d0f +Subproject commit 4bf45519f6b39afa85e394c19680971fd92bfac4