1
0
Fork 0

Get rid of unneeded glibc wraps

This commit is contained in:
Ilya Fedin 2021-06-29 06:10:37 +04:00 committed by John Preston
parent e921da8a83
commit 4a63a30c17
8 changed files with 0 additions and 191 deletions

View file

@ -5,9 +5,6 @@
# https://github.com/desktop-app/legal/blob/master/LEGAL
add_subdirectory(external)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
add_subdirectory(linux_glibc_wraps)
endif()
if (LINUX
AND NOT DESKTOP_APP_USE_PACKAGED
AND Qt5WaylandClient_FOUND)

View file

@ -21,14 +21,6 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
endif()
if (LINUX)
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_openssl_common
INTERFACE
desktop-app::linux_glibc_wraps
$<TARGET_FILE:desktop-app::linux_glibc_wraps>
)
endif()
target_link_libraries(external_openssl_common
INTERFACE
${CMAKE_DL_LIBS}

View file

@ -287,26 +287,6 @@ else()
-Wl,--no-as-needed,-lrt
)
endif()
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_options(external_qt
INTERFACE
-Wl,-wrap,aligned_alloc
-Wl,-wrap,secure_getenv
-Wl,-wrap,clock_gettime
-Wl,--no-as-needed,-lrt
)
if (NOT build_linux32)
target_link_options(external_qt
INTERFACE
-Wl,-wrap,__divmodti4
)
else()
target_link_options(external_qt
INTERFACE
-Wl,-wrap,__divmoddi4
)
endif()
endif()
target_link_static_libraries(external_qt
INTERFACE
proxy
@ -335,13 +315,6 @@ else()
$<TARGET_FILE:desktop-app::linux_allocation_tracer>
)
endif()
if (DESKTOP_APP_USE_GLIBC_WRAPS)
target_link_libraries(external_qt
INTERFACE
desktop-app::linux_glibc_wraps
$<TARGET_FILE:desktop-app::linux_glibc_wraps>
)
endif()
if (Qt5WaylandClient_FOUND)
target_link_libraries(external_qt
INTERFACE

View file

@ -1,22 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
add_library(linux_glibc_wraps STATIC)
add_library(desktop-app::linux_glibc_wraps ALIAS linux_glibc_wraps)
get_filename_component(src_loc . REALPATH)
nice_target_sources(linux_glibc_wraps ${src_loc}
PRIVATE
platform/linux/linux_glibc_wraps.c
platform/linux/linux_glibc_wraps_32.c
platform/linux/linux_glibc_wraps_64.c
)
if (NOT build_linux32)
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_32.c PROPERTIES HEADER_FILE_ONLY TRUE)
else()
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_64.c PROPERTIES HEADER_FILE_ONLY TRUE)
endif()

View file

@ -1,29 +0,0 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/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,49 +0,0 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/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,52 +0,0 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/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
typedef unsigned int UTItype __attribute__ ((mode (TI)));
typedef int TItype __attribute__ ((mode (TI)));
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);
}
UTItype __udivmodti4(UTItype num, UTItype den, UTItype *rem_p);
TItype __wrap___divmodti4(TItype num, TItype den, TItype *rem_p) {
int minus = 0;
TItype v;
if (num < 0) {
num = -num;
minus = 1;
}
if (den < 0) {
den = -den;
minus ^= 1;
}
v = __udivmodti4(num, den, (UTItype *)rem_p);
if (minus) {
v = -v;
if (rem_p)
*rem_p = -(*rem_p);
}
return v;
}

View file

@ -32,7 +32,6 @@ option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integrat
option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration (Linux only)." OFF)
option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration (Linux only)." OFF)
option(DESKTOP_APP_DISABLE_GTK_INTEGRATION "Disable all code for GTK integration (Linux only)." OFF)
option(DESKTOP_APP_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF)
option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer (Linux only)." OFF)
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target})
option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages. (Linux only)" OFF)