Skip to content

Commit 229aaef

Browse files
[wasm] Consolidate native build logic for WASM (#116390)
1 parent 5cb2a05 commit 229aaef

File tree

10 files changed

+59
-90
lines changed

10 files changed

+59
-90
lines changed

eng/native/gen-buildsys.cmd

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,38 @@
22
rem
33
rem This file invokes cmake and generates the build system for windows.
44

5-
setlocal
5+
set __argCount=0
6+
for %%x in (%*) do set /A __argCount+=1
67

7-
set argC=0
8-
for %%x in (%*) do Set /A argC+=1
8+
if %__argCount% lss 4 goto :USAGE
9+
if %1=="/?" goto :USAGE
910

10-
if %argC% lss 4 GOTO :USAGE
11-
if %1=="/?" GOTO :USAGE
12-
13-
setlocal enabledelayedexpansion
11+
set __Os=%5
1412
set "__repoRoot=%~dp0..\.."
1513
:: normalize
1614
for %%i in ("%__repoRoot%") do set "__repoRoot=%%~fi"
1715

16+
:: Set up the EMSDK environment before setlocal so that it propagates to the caller.
17+
if /i "%__Os%" == "browser" (
18+
if "%EMSDK_PATH%" == "" (
19+
if not exist "%__repoRoot%\src\mono\browser\emsdk" (
20+
echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
21+
exit /B 1
22+
)
23+
set EMSDK_QUIET=1 && call "%__repoRoot%\src\mono\browser\emsdk\emsdk_env"
24+
) else (
25+
set EMSDK_QUIET=1 && call "%EMSDK_PATH%\emsdk_env"
26+
)
27+
)
28+
29+
setlocal enabledelayedexpansion
30+
1831
set __SourceDir=%1
1932
set __IntermediatesDir=%2
2033
set __VSVersion=%3
2134
set __Arch=%4
22-
set __Os=%5
2335
set __CmakeGenerator=Visual Studio
24-
set __UseEmcmake=0
36+
set __ExtraCmakeParams=
2537
if /i "%__Ninja%" == "1" (
2638
set __CmakeGenerator=Ninja
2739
) else (
@@ -38,22 +50,14 @@ if /i "%__Ninja%" == "1" (
3850
)
3951

4052
if /i "%__Arch%" == "wasm" (
41-
4253
if "%__Os%" == "" (
4354
echo Error: Please add target OS parameter
4455
exit /B 1
4556
)
4657
if /i "%__Os%" == "browser" (
47-
if "%EMSDK_PATH%" == "" (
48-
echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
49-
exit /B 1
50-
)
51-
5258
set CMakeToolPrefix=emcmake
5359
)
5460
if /i "%__Os%" == "wasi" (
55-
set "__repoRoot=!__repoRoot:\=/!"
56-
if not "!__repoRoot:~-1!" == "/" set "__repoRoot=!__repoRoot!/"
5761
if "%WASI_SDK_PATH%" == "" (
5862
if not exist "%__repoRoot%\src\mono\wasi\wasi-sdk" (
5963
echo Error: Should set WASI_SDK_PATH environment variable pointing to WASI SDK root.
@@ -62,11 +66,8 @@ if /i "%__Arch%" == "wasm" (
6266

6367
set "WASI_SDK_PATH=%__repoRoot%\src\mono\wasi\wasi-sdk"
6468
)
65-
:: replace backslash with forward slash and append last slash
66-
set "WASI_SDK_PATH=!WASI_SDK_PATH:\=/!"
67-
if not "!WASI_SDK_PATH:~-1!" == "/" set "WASI_SDK_PATH=!WASI_SDK_PATH!/"
6869
set __CmakeGenerator=Ninja
69-
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi -DCLR_CMAKE_TARGET_ARCH=wasm "-DWASI_SDK_PREFIX=!WASI_SDK_PATH!" "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_SYSROOT=!WASI_SDK_PATH!share/wasi-sysroot" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1"
70+
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1"
7071
)
7172
) else (
7273
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0"
@@ -140,6 +141,6 @@ exit /B %errorlevel%
140141
:USAGE
141142
echo "Usage..."
142143
echo "gen-buildsys.cmd <path to top level CMakeLists.txt> <path to location for intermediate files> <VSVersion> <arch> <os>"
143-
echo "Specify the path to the top level CMake file - <ProjectK>/src/NDP"
144-
echo "Specify the VSVersion to be used - VS2017 or VS2019"
144+
echo "Specify the path to the top level CMake file"
145+
echo "Specify the VSVersion to be used, e. g. 17.0 for VS2022"
145146
EXIT /B 1

eng/native/gen-buildsys.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,26 @@ fi
9797
cmake_extra_defines_wasm=()
9898
if [[ "$host_arch" == "wasm" ]]; then
9999
if [[ "$target_os" == "browser" ]]; then
100+
if [[ -z "$EMSDK_PATH" ]]; then
101+
if [[ -d "$reporoot"/src/mono/browser/emsdk/ ]]; then
102+
export EMSDK_PATH="$reporoot"/src/mono/browser/emsdk/
103+
else
104+
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
105+
exit 1
106+
fi
107+
fi
108+
export EMSDK_QUIET=1 && source "$EMSDK_PATH"/emsdk_env.sh
100109
cmake_command="emcmake $cmake_command"
101110
elif [[ "$target_os" == "wasi" ]]; then
102-
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCLR_CMAKE_TARGET_ARCH=wasm" "-DWASI_SDK_PREFIX=$WASI_SDK_PATH" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_SYSROOT=${WASI_SDK_PATH}/share/wasi-sysroot" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1")
111+
if [[ -z "$WASI_SDK_PATH" ]]; then
112+
if [[ -d "$reporoot"/src/mono/wasi/wasi-sdk ]]; then
113+
export WASI_SDK_PATH="$reporoot"/src/mono/wasi/wasi-sdk
114+
else
115+
echo "Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root."
116+
exit 1
117+
fi
118+
fi
119+
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1")
103120
else
104121
echo "target_os was not specified"
105122
exit 1

src/coreclr/runtime.proj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@
109109
<_CoreClrBuildScript Condition="$([MSBuild]::IsOsPlatform(Windows))">build-runtime.cmd</_CoreClrBuildScript>
110110
<_CoreClrBuildScript Condition="!$([MSBuild]::IsOsPlatform(Windows))">build-runtime.sh</_CoreClrBuildScript>
111111
<_CoreClrBuildCommand>&quot;$(MSBuildThisFileDirectory)$(_CoreClrBuildScript)&quot; @(_CoreClrBuildArg, ' ')</_CoreClrBuildCommand>
112-
<_CoreClrBuildCommand Condition="'$(TargetsBrowser)' == 'true' and $([MSBuild]::IsOsPlatform(Windows))">call &quot;$([MSBuild]::NormalizePath('$(RepoRoot)src/mono/browser/emsdk', 'emsdk_env.cmd'))&quot; &amp;&amp; $(_CoreClrBuildCommand)</_CoreClrBuildCommand>
113-
<_CoreClrBuildCommand Condition="'$(TargetsBrowser)' == 'true' and !$([MSBuild]::IsOsPlatform(Windows))">bash -c 'source &quot;$(RepoRoot)src/mono/browser/emsdk/emsdk_env.sh&quot; &amp;&amp; $(_CoreClrBuildCommand)'</_CoreClrBuildCommand>
114112
</PropertyGroup>
115113

116114
<!-- Use IgnoreStandardErrorWarningFormat because Arcade sets WarnAsError and we want to avoid upgrading compiler warnings to errors in release branches -->

src/native/libs/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
119119
add_subdirectory(System.IO.Ports.Native)
120120
endif ()
121121

122-
if (MONO_WASM_MT)
123-
add_definitions(-DMONO_WASM_MT)
124-
endif()
125-
126122
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
127123
add_compile_options(-Weverything)
128124
add_compile_options(-Wno-format-nonliteral)

src/native/libs/build-native.cmd

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set __TargetOS=windows
1919
set CMAKE_BUILD_TYPE=Debug
2020
set __Ninja=1
2121
set __icuDir=""
22-
set __usePThreads=0
2322
set __ExtraCmakeParams=
2423
set __CrossTarget=0
2524

@@ -39,15 +38,11 @@ if /i [%1] == [wasm] ( set __BuildArch=wasm&&shift&goto Arg_Loop)
3938

4039
if /i [%1] == [outconfig] ( set __outConfig=%2&&shift&&shift&goto Arg_Loop)
4140

42-
if /i [%1] == [browser] ( set __TargetOS=browser&&shift&goto Arg_Loop)
43-
if /i [%1] == [wasi] ( set __TargetOS=wasi&&shift&goto Arg_Loop)
44-
4541
if /i [%1] == [rebuild] ( set __BuildTarget=rebuild&&shift&goto Arg_Loop)
4642

4743
if /i [%1] == [msbuild] ( set __Ninja=0&&shift&goto Arg_Loop)
4844

4945
if /i [%1] == [icudir] ( set __icuDir=%2&&shift&&shift&goto Arg_Loop)
50-
if /i [%1] == [usepthreads] ( set __usePThreads=1&&shift&goto Arg_Loop)
5146

5247
if /i [%1] == [-fsanitize] ( set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCLR_CMAKE_ENABLE_SANITIZERS=$2"&&shift&&shift&goto Arg_Loop)
5348
if /i [%1] == [-cmakeargs] ( set __ExtraCmakeParams=%__ExtraCmakeParams% %2&&shift&&shift&goto Arg_Loop)
@@ -77,16 +72,11 @@ if %__CrossTarget% EQU 0 (
7772
call powershell -NoProfile -ExecutionPolicy ByPass -File "%__repoRoot%\eng\native\version\copy_version_files.ps1"
7873
)
7974

80-
:: cmake requires forward slashes in paths
81-
set __cmakeRepoRoot=%__repoRoot:\=/%
82-
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_REPO_ROOT=%__cmakeRepoRoot%"
8375
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE%"
8476

8577
if NOT %__icuDir% == "" (
8678
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_ICU_DIR=%__icuDir%"
8779
)
88-
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_USE_PTHREADS=%__usePThreads%"
89-
9080

9181
if [%__outConfig%] == [] set __outConfig=%__TargetOS%-%__BuildArch%-%CMAKE_BUILD_TYPE%
9282

src/native/libs/build-native.proj

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
<_RuntimeVariant />
1515
<_RuntimeVariant Condition="'$(WasmEnableThreads)' == 'true'">-threads</_RuntimeVariant>
16-
<_UsePThreads />
17-
<_UsePThreads Condition="'$(WasmEnableThreads)' == 'true'"> usepthreads</_UsePThreads>
18-
1916
<_IcuDir Condition="'$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)' != ''">$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)$(_RuntimeVariant)/native</_IcuDir>
2017
<_IcuDirArg Condition="'$(_IcuDir)' != ''"> icudir "$(_IcuDir)"</_IcuDirArg>
2118

22-
<_BuildNativeArgs>$(_BuildNativeArgs)$(_IcuDirArg)$(_UsePThreads)</_BuildNativeArgs>
19+
<_CMakeArgs Condition="'$(CMakeArgs)' != ''"> -cmakeargs "$(CMakeArgs)"</_CMakeArgs>
20+
<_CMakeArgs Condition="'$(WasmEnableThreads)' == 'true'">$(_CMakeArgs) -cmakeargs "-DCMAKE_USE_PTHREADS=1"</_CMakeArgs>
21+
22+
<_BuildNativeArgs>$(_BuildNativeArgs)$(_IcuDirArg)$(_CMakeArgs)</_BuildNativeArgs>
2323
</PropertyGroup>
2424

2525
<ItemGroup>
@@ -50,17 +50,14 @@
5050
<_PortableBuildArg Condition="'$(PortableBuild)' != 'true'"> -portablebuild=false</_PortableBuildArg>
5151
<_CrossBuildArg Condition="'$(CrossBuild)' == 'true'"> -cross</_CrossBuildArg>
5252
<_KeepNativeSymbolsBuildArg Condition="'$(KeepNativeSymbols)' != 'false'"> -keepnativesymbols</_KeepNativeSymbolsBuildArg>
53-
<_MonoWasmMTCMakeArgs Condition="'$(WasmEnableThreads)' == 'true'"> -DMONO_WASM_MT=1</_MonoWasmMTCMakeArgs>
54-
<_CMakeArgs Condition="'$(CMakeArgs)' != '' or '$(_MonoWasmMTCMakeArgs)' != ''"> -cmakeargs "$(CMakeArgs)$(_MonoWasmMTCMakeArgs)"</_CMakeArgs>
5553

5654
<!--
5755
BuildNativeCompiler is a pass-through argument, to pass an argument to build-native.sh. It is intended to be
5856
used to force a specific compiler toolset.
5957
-->
6058
<_BuildNativeCompilerArg Condition="'$(BuildNativeCompiler)' != ''"> $(BuildNativeCompiler)</_BuildNativeCompilerArg>
61-
<_BuildNativeUnixArgs>$(_BuildNativeArgs)$(_ProcessorCountArg)$(_PortableBuildArg)$(_CrossBuildArg)$(_BuildNativeCompilerArg)$(_KeepNativeSymbolsBuildArg)$(_CMakeArgs) $(Compiler)</_BuildNativeUnixArgs>
59+
<_BuildNativeUnixArgs>$(_BuildNativeArgs)$(_ProcessorCountArg)$(_PortableBuildArg)$(_CrossBuildArg)$(_BuildNativeCompilerArg)$(_KeepNativeSymbolsBuildArg) $(Compiler)</_BuildNativeUnixArgs>
6260
<_BuildNativeBuildCommand>&quot;$(MSBuildThisFileDirectory)build-native.sh&quot; $(_BuildNativeUnixArgs)</_BuildNativeBuildCommand>
63-
<_BuildNativeBuildCommand Condition="'$(TargetsBrowser)' == 'true'">bash -c 'source &quot;$(RepoRoot)src/mono/browser/emsdk/emsdk_env.sh&quot; &amp;&amp; $(_BuildNativeBuildCommand)'</_BuildNativeBuildCommand>
6461
</PropertyGroup>
6562

6663
<ItemGroup>
@@ -100,11 +97,7 @@
10097
Condition="$([MSBuild]::IsOsPlatform(Windows))">
10198
<PropertyGroup>
10299
<_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild</_BuildNativeArgs>
103-
<_MonoWasmMTCMakeArgs Condition="'$(WasmEnableThreads)' == 'true'">-DMONO_WASM_MT=1</_MonoWasmMTCMakeArgs>
104-
<_MonoWasmMTCMakeArgs Condition="'$(CMakeArgs)' != ''"> $(_MonoWasmMTCMakeArgs)</_MonoWasmMTCMakeArgs>
105-
<_BuildNativeArgs Condition="'$(CMakeArgs)' != '' or '$(_MonoWasmMTCMakeArgs)' != ''">$(_BuildNativeArgs) -cmakeargs "$(CMakeArgs)$(_MonoWasmMTCMakeArgs)"</_BuildNativeArgs>
106100
<_BuildNativeBuildCommand>&quot;$(MSBuildThisFileDirectory)build-native.cmd&quot; $(_BuildNativeArgs)</_BuildNativeBuildCommand>
107-
<_BuildNativeBuildCommand Condition="'$(TargetsBrowser)' == 'true'">call &quot;$([MSBuild]::NormalizePath('$(RepoRoot)src/mono/browser/emsdk', 'emsdk_env.cmd'))&quot; &amp;&amp; $(_BuildNativeBuildCommand)</_BuildNativeBuildCommand>
108101
</PropertyGroup>
109102
<!-- Run script that uses CMake to generate and build the native files. -->
110103
<!-- Use IgnoreStandardErrorWarningFormat because Arcade sets WarnAsError and we want to avoid upgrading compiler warnings to errors in release branches -->

src/native/libs/build-native.sh

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ handle_arguments() {
2121
__ShiftArgs=1
2222
;;
2323

24-
usepthreads|-usepthreads)
25-
__usePThreads=1
26-
;;
27-
2824
staticliblink|-staticliblink)
2925
__StaticLibLink=1
3026
;;
@@ -48,36 +44,11 @@ __StaticLibLink=0
4844
__UnprocessedBuildArgs=
4945
__VerboseBuild=false
5046
__icuDir=""
51-
__usePThreads=0
5247

5348
source "$__RepoRootDir"/eng/native/build-commons.sh
5449

5550
# Set cross build
56-
if [[ "$__TargetOS" == browser ]]; then
57-
if [[ -z "$EMSDK_PATH" ]]; then
58-
if [[ -d "$__RepoRootDir"/src/mono/browser/emsdk/ ]]; then
59-
export EMSDK_PATH="$__RepoRootDir"/src/mono/browser/emsdk/
60-
else
61-
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
62-
exit 1
63-
fi
64-
fi
65-
source "$EMSDK_PATH"/emsdk_env.sh
66-
export CLR_CC=$(which emcc)
67-
elif [[ "$__TargetOS" == wasi ]]; then
68-
if [[ -z "$WASI_SDK_PATH" ]]; then
69-
if [[ -d "$__RepoRootDir"/src/mono/wasi/wasi-sdk ]]; then
70-
export WASI_SDK_PATH="$__RepoRootDir"/src/mono/wasi/wasi-sdk
71-
else
72-
echo "Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root."
73-
exit 1
74-
fi
75-
fi
76-
export WASI_SDK_PATH="${WASI_SDK_PATH%/}/"
77-
export CLR_CC="$WASI_SDK_PATH"bin/clang
78-
export TARGET_BUILD_ARCH=wasm
79-
__CMakeArgs="-DCLR_CMAKE_TARGET_OS=wasi -DCLR_CMAKE_TARGET_ARCH=wasm -DWASI_SDK_PREFIX=$WASI_SDK_PATH -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake $__CMakeArgs"
80-
elif [[ "$__TargetOS" == ios || "$__TargetOS" == iossimulator ]]; then
51+
if [[ "$__TargetOS" == browser || "$__TargetOS" == wasi || "$__TargetOS" == ios || "$__TargetOS" == iossimulator ]]; then
8152
# nothing to do here
8253
true
8354
elif [[ "$__TargetOS" == tvos || "$__TargetOS" == tvossimulator ]]; then
@@ -158,7 +129,6 @@ fi
158129
if [[ -n "$__icuDir" ]]; then
159130
__CMakeArgs="-DCMAKE_ICU_DIR=\"$__icuDir\" $__CMakeArgs"
160131
fi
161-
__CMakeArgs="-DCMAKE_USE_PTHREADS=$__usePThreads $__CMakeArgs"
162132

163133
# Set the remaining variables based upon the determined build configuration
164134
__outConfig="${__outConfig:-"$__TargetOS-$__TargetArch-$__BuildType"}"

src/native/minipal/descriptorlimit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
bool minipal_increase_descriptor_limit(void)
1515
{
16-
#if TARGET_WASM
16+
#ifdef __wasm__
1717
// WebAssembly cannot set limits
1818
#elif TARGET_LINUX_MUSL
1919
// Setting RLIMIT_NOFILE breaks debugging of coreclr on Alpine Linux for some reason

src/native/minipal/memorybarrierprocesswide.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
#ifndef HOST_WINDOWS
5-
#include <assert.h>
6-
#include <pthread.h>
5+
76
#include <stdbool.h>
87
#include <stdint.h>
8+
#include <assert.h>
9+
#include <minipal/memorybarrierprocesswide.h>
10+
11+
#ifndef HOST_WASM
12+
#include <pthread.h>
913
#include <stdio.h>
1014
#include <sys/mman.h>
1115
#include <unistd.h>
12-
#include <minipal/memorybarrierprocesswide.h>
1316

1417
#ifdef __APPLE__
1518
#include <stdlib.h>
@@ -72,15 +75,16 @@ static bool CanFlushUsingMembarrier(void)
7275
static bool s_flushUsingMemBarrier = false;
7376
#endif // HAVE_SYS_MEMBARRIER_H
7477

75-
#if !defined(HOST_APPLE) && !defined(HOST_WASM)
78+
#ifndef HOST_APPLE
7679
// Helper memory page used by the fallback path
7780
static uint8_t* g_helperPage = NULL;
7881

7982
// Mutex to make the fallback path thread safe
8083
static pthread_mutex_t g_flushProcessWriteBuffersMutex;
8184

8285
static size_t s_pageSize = 0;
83-
#endif // !TARGET_APPLE && !HOST_WASM
86+
#endif // !HOST_APPLE
87+
#endif // !HOST_WASM
8488

8589
static bool s_initializedMemoryBarrierSuccessfullyInitialized = false;
8690

src/native/minipal/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern "C" {
4343
*/
4444
static inline size_t minipal_get_current_thread_id(void)
4545
{
46-
#if defined(__wasm) && defined(MONO_WASM_MT)
46+
#if defined(__wasm) && !defined(_REENTRANT)
4747
return 0;
4848
#else
4949
#if defined(__GNUC__) && !defined(__clang__) && defined(__cplusplus)

0 commit comments

Comments
 (0)