]> xenbits.xensource.com Git - unikraft/libs/libcxxabi.git/commitdiff
patches: Use unikraft syscall in cxa_guard RELEASE-0.14.0
authorAndrei Tatar <andrei@unikraft.io>
Fri, 5 May 2023 18:29:23 +0000 (20:29 +0200)
committerUnikraft <monkey@unikraft.io>
Thu, 1 Jun 2023 19:28:51 +0000 (19:28 +0000)
This patch replaces calls to libc syscall() with short-circuited
unikraft-specific static implementations of these syscalls.

Co-authored-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #4

Makefile.uk
patches/0001-cxa_guard_impl_syscall.patch [new file with mode: 0644]

index 1ac401d7ce79d9b062fb5631306a2e567510e0ba..9fdae2983372a0b137c8e85cb7ea39a05eba5841 100644 (file)
@@ -51,6 +51,7 @@ LIBCXXABI_VERSION=14.0.6
 LIBCXXABI_URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXXABI_VERSION)/libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
 LIBCXXABI_PATCHDIR=$(LIBCXXABI_BASE)/patches
 $(eval $(call fetch,libcxxabi,$(LIBCXXABI_URL)))
+$(eval $(call patch,libcxxabi,$(LIBCXXABI_PATCHDIR),libcxxabi-$(LIBCXXABI_VERSION).src))
 
 ################################################################################
 # Helpers
diff --git a/patches/0001-cxa_guard_impl_syscall.patch b/patches/0001-cxa_guard_impl_syscall.patch
new file mode 100644 (file)
index 0000000..12914b6
--- /dev/null
@@ -0,0 +1,37 @@
+diff --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h
+index 72940cc7e..822765d89 100644
+--- a/src/cxa_guard_impl.h
++++ b/src/cxa_guard_impl.h
+@@ -56,6 +56,7 @@
+ #include <limits.h>
+ #include <stdlib.h>
++#include <uk/syscall.h>
+ #include <__threading_support>
+ #ifndef _LIBCXXABI_HAS_NO_THREADS
+ #  if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
+@@ -157,7 +158,7 @@ uint32_t PlatformThreadID() {
+ #elif defined(SYS_gettid) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+ uint32_t PlatformThreadID() {
+   static_assert(sizeof(pid_t) == sizeof(uint32_t), "");
+-  return static_cast<uint32_t>(syscall(SYS_gettid));
++  return static_cast<uint32_t>(uk_syscall_static(SYS_gettid));
+ }
+ #else
+ constexpr uint32_t (*PlatformThreadID)() = nullptr;
+@@ -410,13 +411,13 @@ private:
+ #if defined(SYS_futex)
+ void PlatformFutexWait(int* addr, int expect) {
+   constexpr int WAIT = 0;
+-  syscall(SYS_futex, addr, WAIT, expect, 0);
++  uk_syscall_static(SYS_futex, addr, WAIT, expect, 0);
+   __tsan_acquire(addr);
+ }
+ void PlatformFutexWake(int* addr) {
+   constexpr int WAKE = 1;
+   __tsan_release(addr);
+-  syscall(SYS_futex, addr, WAKE, INT_MAX);
++  uk_syscall_static(SYS_futex, addr, WAKE, INT_MAX);
+ }
+ #else
+ constexpr void (*PlatformFutexWait)(int*, int) = nullptr;