Browse Source

feat envoy: Fix linking errors in util when building for WASM platform.

Fix linking errors due to missed _Unwind_Backtrace symbol.

Fix linking error due to missed CurrentThreadId implementation.
commit_hash:ba09595a0e5feaefe5ad506c0005815f4c11a153
vchigrin 1 week ago
parent
commit
247abd10e4
3 changed files with 4 additions and 4 deletions
  1. 1 1
      util/system/backtrace.cpp
  2. 2 2
      util/system/thread.cpp
  3. 1 1
      util/ya.make

+ 1 - 1
util/system/backtrace.cpp

@@ -32,7 +32,7 @@ extern "C" __stdcall unsigned short CaptureStackBackTrace(unsigned long FramesTo
         #define HAVE_BACKTRACE
     #endif
 
-    #if !defined(HAVE_BACKTRACE) && defined(__GNUC__)
+    #if !defined(HAVE_BACKTRACE) && defined(__GNUC__) && !defined(__EMSCRIPTEN__)
         #define USE_GCC_BACKTRACE
         #define HAVE_BACKTRACE
     #endif

+ 2 - 2
util/system/thread.cpp

@@ -535,11 +535,11 @@ TCurrentThreadLimits::TCurrentThreadLimits() noexcept
     : StackBegin(nullptr)
     , StackLength(0)
 {
-#if defined(_linux_) || defined(_cygwin_) || defined(_freebsd_)
+#if defined(_linux_) || defined(_cygwin_) || defined(_freebsd_) || defined(__EMSCRIPTEN__)
     pthread_attr_t attr;
     pthread_attr_init(&attr);
 
-    #if defined(_linux_) || defined(_cygwin_)
+    #if defined(_linux_) || defined(_cygwin_) || defined(__EMSCRIPTEN__)
     Y_ABORT_UNLESS(pthread_getattr_np(pthread_self(), &attr) == 0, "pthread_getattr failed");
     #else
     Y_ABORT_UNLESS(pthread_attr_get_np(pthread_self(), &attr) == 0, "pthread_attr_get_np failed");

+ 1 - 1
util/ya.make

@@ -322,6 +322,7 @@ JOIN_SRCS(
     system/sys_alloc.cpp
     system/sysstat.cpp
     system/tempfile.cpp
+    system/thread.cpp
     system/tls.cpp
     system/type_name.cpp
     system/unaligned_mem.cpp
@@ -335,7 +336,6 @@ JOIN_SRCS(
     all_system_4.cpp
     system/mem_info.cpp
     system/sem.cpp
-    system/thread.cpp
     system/types.cpp
 )
 ENDIF()