Disable Linux GLIBC wraps for special builds.

This commit is contained in:
John Preston 2020-11-06 08:48:05 +03:00
parent 547251f67c
commit 71de246411
5 changed files with 5 additions and 115 deletions

View File

@ -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 <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
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);
}

View File

@ -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 <time.h>
#include <stdint.h>
#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;
}

View File

@ -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 <time.h>
#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);
}

View File

@ -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

2
cmake

@ -1 +1 @@
Subproject commit 3a2d8a252d7e84547b532605aaa557a8c70d6d0f
Subproject commit 4bf45519f6b39afa85e394c19680971fd92bfac4