Crafter.Build/packaging/flatpak/wasi-sdk-asm-target.patch

20 lines
977 B
Diff
Raw Permalink Normal View History

wasi-sdk-sysroot.cmake: tell the compiler-rt sub-build the ASM target too
The sub-build gets CMAKE_C_COMPILER_TARGET but nothing for the ASM
language, so compiler-rt's wasm/*.S stubs (the setjmp/longjmp and C++
exception tags) are assembled for the host when the driving clang is not
a wasm-default build. wasm-ld then warns that the archive members are
neither Wasm objects nor bitcode, and code that needs the tags fails to
link. wasi-sdk's own toolchain hides this because its clang defaults to
wasm32-wasip1; the sysroot-only mode against a host clang does not.
--- a/cmake/wasi-sdk-sysroot.cmake
+++ b/cmake/wasi-sdk-sysroot.cmake
@@ -107,6 +107,7 @@
-DCOMPILER_RT_BUILD_ORC=OFF
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
-DCMAKE_C_COMPILER_TARGET=${target}
+ -DCMAKE_ASM_COMPILER_TARGET=${target}
-DCMAKE_C_FLAGS=${WASI_SDK_CPU_CFLAGS}
-DCMAKE_CXX_FLAGS=${WASI_SDK_CPU_CFLAGS}
-DCMAKE_ASM_FLAGS=${WASI_SDK_CPU_CFLAGS}