Browse Source

feat envoy: Fixes for building standalone binaries.

Add libstubs libarary from emscripten to contrib.
Change order of emscripten libraries in linker command-line to match one in em++.
commit_hash:3db62cdd7b7c90c2020308b083947ee3d3279bb5
vchigrin 1 week ago
parent
commit
033e3b0606
2 changed files with 10 additions and 1 deletions
  1. 3 0
      build/sysincl/emscripten.yml
  2. 7 1
      build/ymake.core.conf

+ 3 - 0
build/sysincl/emscripten.yml

@@ -108,6 +108,9 @@
     - contrib/restricted/emscripten/system/lib/libc/musl/src/internal/syscall.h
     - contrib/restricted/emscripten/system/lib/libc/musl/arch/emscripten/bits/syscall.h
 
+  - syscall_arch.h:
+    - contrib/restricted/emscripten/system/lib/libc/musl/arch/emscripten/syscall_arch.h
+
   - inttypes.h:             contrib/restricted/emscripten/system/lib/libc/musl/include/inttypes.h
   - stddef.h:               contrib/restricted/emscripten/system/lib/libc/musl/include/stddef.h
   - stdint.h:               contrib/restricted/emscripten/system/lib/libc/musl/include/stdint.h

+ 7 - 1
build/ymake.core.conf

@@ -780,9 +780,15 @@ module _BASE_UNIT: _BARE_UNIT {
     when ($OS_EMSCRIPTEN == "yes") {
         when ($NOLIBC != "yes") {
             PEERDIR+=contrib/restricted/emscripten/include
+            # Important: In arcadia we usually build standalone WASM applications,
+            # so standalone library must go before lib/c in linker command-line.
+            # Emscripten uses two weak definitions for __clock_gettime function,
+            # so linker will pick one from the first library present in command
+            # line.
+            PEERDIR+=contrib/restricted/emscripten/system/lib/standalonewasm
+            PEERDIR+=contrib/restricted/emscripten/system/lib/stubs
             PEERDIR+=contrib/restricted/emscripten/system/lib/c
             PEERDIR+=contrib/restricted/emscripten/system/lib/dlmalloc
-            PEERDIR+=contrib/restricted/emscripten/system/lib/standalonewasm
         }
     }