diff --git a/eng/Subsets.props b/eng/Subsets.props index 1f08b59af84004..5f592075c54e3f 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -54,7 +54,7 @@ <_SdkToolsSupportedOS Condition="'$(TargetsMobile)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">true - <_SdkToolsSupportedArch Condition="'$(TargetArchitecture)' != 'armel'">true + <_SdkToolsSupportedArch Condition="'$(TargetArchitecture)' != 'armel' and '$(TargetsWasm)' != 'true'">true true <_UseNativeAotForComponentsCrossOS Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'">true @@ -109,7 +109,8 @@ clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools+host.native clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools - clr.native+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.crossarchtools+host.native + + mono.emsdk+clr.native+clr.corelib+clr.tools+clr.packages+clr.crossarchtools clr.iltools+clr.packages @@ -364,7 +365,7 @@ The cross tools are used as part of the build process with the downloaded build tools, so we need to build them for the host architecture and build them as unsanitized binaries. --> - <_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '') and '$(TargetArchitecture)' != 'wasm'">true + <_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '') and '$(TargetsWasm)' != 'true'">true <_BuildCrossComponents Condition="$(_subset.Contains('+clr.crossarchtools+'))">true <_BuildCrossComponents Condition="'$(ClrRuntimeBuildSubsets)' != '' and ('$(PrimaryRuntimeFlavor)' == 'CoreCLR' or '$(TargetsMobile)' == 'true')">true <_CrossBitwidthBuild Condition="'$(BuildArchitecture)' == 'x64' and ('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'arm')">true diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 3d5edd9ea06160..29f99870456374 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -215,27 +215,31 @@ $(LibrariesNativeArtifactsPath)*.dex; $(LibrariesNativeArtifactsPath)*.jar;" IsNative="true" /> - + + - - - - - or( eq(variables['wasmDarcDependenciesChanged'], true), diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index b465aa0a54321e..2bc06d83bc8495 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -41,7 +41,6 @@ if (CLR_CMAKE_TARGET_ARCH_WASM) -msimd128) add_link_options( -fwasm-exceptions - -msimd128 ) endif() diff --git a/src/coreclr/hosts/CMakeLists.txt b/src/coreclr/hosts/CMakeLists.txt index 529a06b916760a..826eecc98a51cf 100644 --- a/src/coreclr/hosts/CMakeLists.txt +++ b/src/coreclr/hosts/CMakeLists.txt @@ -4,8 +4,4 @@ if(CLR_CMAKE_HOST_WIN32) add_subdirectory(coreshim) endif(CLR_CMAKE_HOST_WIN32) -if (CLR_CMAKE_TARGET_ARCH_WASM) - add_subdirectory(corewasmrun) -endif() - add_subdirectory(corerun) \ No newline at end of file diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 8aa49f56f0fc4d..56aa91453621fe 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -69,7 +69,6 @@ else(CLR_CMAKE_HOST_WIN32) RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") target_link_options(corerun PRIVATE -fwasm-exceptions - -msimd128 -sEXIT_RUNTIME=1 -sINITIAL_MEMORY=134217728 -sENVIRONMENT=node,shell diff --git a/src/coreclr/hosts/corewasmrun/CMakeLists.txt b/src/coreclr/hosts/corewasmrun/CMakeLists.txt index 5d96f9cdf49754..a8ed9e8c996f8b 100644 --- a/src/coreclr/hosts/corewasmrun/CMakeLists.txt +++ b/src/coreclr/hosts/corewasmrun/CMakeLists.txt @@ -33,7 +33,6 @@ set_target_properties(corewasmrun PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") target_link_options(corewasmrun PRIVATE -fwasm-exceptions - -msimd128 -sEXIT_RUNTIME=1 -sINITIAL_MEMORY=134217728 -sSTACK_SIZE=5MB diff --git a/src/coreclr/pal/CMakeLists.txt b/src/coreclr/pal/CMakeLists.txt index b086e20850b9e2..7c83e540be6907 100644 --- a/src/coreclr/pal/CMakeLists.txt +++ b/src/coreclr/pal/CMakeLists.txt @@ -15,7 +15,6 @@ else() ) add_link_options( -fwasm-exceptions - -msimd128 ) endif() diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index 5ae9f528f506f9..569fb48bc9e151 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -67,6 +67,7 @@ CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Link="%(FileName)%(Extension)" + Condition="'$(TargetsWasm)' != 'true'" /> $(runtimelinuxmuslx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion) $(runtimewinx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion) $(runtimeosxx64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion) - .Debug + .Debug @@ -74,9 +74,9 @@ Version="$(MonoLLVMToolsVersion)" PackageArch="$(BuildArchitecture)"/> - - <_PackageReferenceDeduplicated Remove="runtime.$(MonoLLVMHostOS)-wasm.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk" /> - <_PackageReferenceDeduplicated Include="runtime.$(MonoLLVMHostOS)-$(BuildArchitecture).Microsoft.NETCore.Runtime.Mono.LLVM.Sdk" + + <_PackageReferenceDeduplicated Remove="runtime.$(MonoLLVMHostOS)-wasm.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk$(MonoLLVMSDKDebugSuffix)" /> + <_PackageReferenceDeduplicated Include="runtime.$(MonoLLVMHostOS)-$(BuildArchitecture).Microsoft.NETCore.Runtime.Mono.LLVM.Sdk$(MonoLLVMSDKDebugSuffix)" Version="$(MonoLLVMSDKVersion)" PackageArch="$(BuildArchitecture)"/> diff --git a/src/native/corehost/browserhost/CMakeLists.txt b/src/native/corehost/browserhost/CMakeLists.txt index a56a15655714c7..375d17c3cb9257 100644 --- a/src/native/corehost/browserhost/CMakeLists.txt +++ b/src/native/corehost/browserhost/CMakeLists.txt @@ -93,7 +93,6 @@ target_link_options(browserhost PRIVATE -sEXPORTED_FUNCTIONS=_posix_memalign,_free,stackAlloc,stackRestore,stackSave,_BrowserHost_InitializeCoreCLR,_BrowserHost_ExecuteAssembly,___cpp_exception -sEXPORT_NAME=createDotnetRuntime -fwasm-exceptions - -msimd128 -lnodefs.js -Wno-unused-command-line-argument -Wl,-error-limit=0) diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index a343ca0269ea9b..97924a6e27ec7d 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -20,6 +20,7 @@ <_CMakeArgs Condition="'$(WasmEnableThreads)' == 'true'">$(_CMakeArgs) -cmakeargs "-DCMAKE_USE_PTHREADS=1" <_CMakeArgs Condition="'$(_IcuDir)' != ''">$(_CMakeArgs) -cmakeargs "-DCMAKE_ICU_DIR=$(_IcuDir)" <_CMakeArgs Condition="'$(_TzdDir)' != ''">$(_CMakeArgs) -cmakeargs "-DCMAKE_TZD_DIR=$(_TzdDir)" + <_CMakeArgs Condition="'$(TargetsBrowser)' == 'true' and '$(RuntimeFlavor)' == 'CoreCLR'">$(_CMakeArgs) -cmakeargs "-DBUILD_LIBS_NATIVE_BROWSER=1" <_BuildNativeArgs>$(_BuildNativeArgs)$(_CMakeArgs) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 48440806fbea55..26c19240be13bb 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -41,26 +41,40 @@ if (CLR_CMAKE_HOST_WIN32) set_property(DIRECTORY PROPERTY CLR_EH_OPTION /EHa) # enable C++ EH (w/ SEH exceptions) endif() -MACRO(SUBDIRLIST result curdir) - FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) - SET(dirlist "") - FOREACH(child ${children}) - IF(IS_DIRECTORY ${curdir}/${child}) - LIST(APPEND dirlist ${child}) - ENDIF() - ENDFOREACH() - SET(${result} ${dirlist}) -ENDMACRO() - -MACRO(ADDSUBDIR_REC curdir) - SUBDIRLIST(SUB_DIRS ${curdir}) - FOREACH(subdir ${SUB_DIRS}) - if(EXISTS "${curdir}/${subdir}/CMakeLists.txt") - ADD_SUBDIRECTORY(${curdir}/${subdir}) - else() - ADDSUBDIR_REC(${curdir}/${subdir}) - endif(EXISTS "${curdir}/${subdir}/CMakeLists.txt") +if(NOT CLR_CMAKE_TARGET_ARCH_WASM) + set(TEST_LIB_TYPE SHARED) + MACRO(SUBDIRLIST result curdir) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() ENDFOREACH() -ENDMACRO() + SET(${result} ${dirlist}) + ENDMACRO() + + MACRO(ADDSUBDIR_REC curdir) + SUBDIRLIST(SUB_DIRS ${curdir}) + FOREACH(subdir ${SUB_DIRS}) + if(EXISTS "${curdir}/${subdir}/CMakeLists.txt") + ADD_SUBDIRECTORY(${curdir}/${subdir}) + else() + ADDSUBDIR_REC(${curdir}/${subdir}) + endif(EXISTS "${curdir}/${subdir}/CMakeLists.txt") + ENDFOREACH() + ENDMACRO() + ADDSUBDIR_REC("${CMAKE_CURRENT_SOURCE_DIR}") +else() + set(TEST_LIB_TYPE STATIC) -ADDSUBDIR_REC("${CMAKE_CURRENT_SOURCE_DIR}") + add_compile_options( + -fwasm-exceptions + -msimd128) + add_link_options( + -fwasm-exceptions + ) + + # opt in into tests that make sense for WASM + add_subdirectory(JIT/interpreter) +endif() diff --git a/src/tests/JIT/interpreter/CMakeLists.txt b/src/tests/JIT/interpreter/CMakeLists.txt index 8370c4824a523b..22a5171fc28571 100644 --- a/src/tests/JIT/interpreter/CMakeLists.txt +++ b/src/tests/JIT/interpreter/CMakeLists.txt @@ -5,7 +5,7 @@ include_directories(${INC_PLATFORM_DIR}) set(SOURCES pinvoke.cpp) # add the executable -add_library (pinvoke SHARED ${SOURCES}) +add_library (pinvoke ${TEST_LIB_TYPE} ${SOURCES}) # add the install targets install (TARGETS pinvoke DESTINATION bin) diff --git a/src/tests/JIT/interpreter/Interpreter.cs b/src/tests/JIT/interpreter/Interpreter.cs index 64cecb59b8ac0f..b8783d9c7f266f 100644 --- a/src/tests/JIT/interpreter/Interpreter.cs +++ b/src/tests/JIT/interpreter/Interpreter.cs @@ -723,6 +723,13 @@ static void EnsureCallingConventionTestTargetMethodsAreJitted() static int Main(string[] args) { + // WASM-TODO this is just hello world for now + if (RuntimeInformation.ProcessArchitecture == Architecture.Wasm) + { + Console.WriteLine("WASM-TODO: Interpreter tests"); + return 100; + } + jitField1 = 42; jitField2 = 43; @@ -2406,15 +2413,19 @@ static object BoxedSubtraction(object lhs, object rhs) public static bool TestPInvoke() { - if (sumTwoInts(1, 2) != 3) - return false; + // WASM-TODO enable once we have generated pinvoke and in-tree native re-link + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + if (sumTwoInts(1, 2) != 3) + return false; - double summed = sumTwoDoubles(1, 2); - if (summed != 3) - return false; + double summed = sumTwoDoubles(1, 2); + if (summed != 3) + return false; - // Test marshaling wrappers - writeToStdout("Hello world from pinvoke.dll!writeToStdout\n"); + // Test marshaling wrappers + writeToStdout("Hello world from pinvoke.dll!writeToStdout\n"); + } bool caught = false; try { diff --git a/src/tests/build.cmd b/src/tests/build.cmd index c500bcb1cc30d4..73691be70ac458 100644 --- a/src/tests/build.cmd +++ b/src/tests/build.cmd @@ -72,6 +72,11 @@ if /i "%1" == "--" (set processedArgs=!processedArgs! %1&s if /i "%1" == "x64" (set __BuildArch=x64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "x86" (set __BuildArch=x86&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "arm64" (set __BuildArch=arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "wasm" (set __BuildArch=wasm&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) + +if /i "%1" == "os" (set __TargetOS=%2&set processedArgs=!processedArgs! %1&shift&shift&goto Arg_Loop) +if /i "%1" == "browser" (set __TargetOS=browser&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "wasi" (set __TargetOS=wasi&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "debug" (set __BuildType=Debug&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "release" (set __BuildType=Release&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) diff --git a/src/tests/build.sh b/src/tests/build.sh index e7be4cf88b778e..1a556196b24902 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -60,7 +60,7 @@ build_Tests() export MSBUILDDEBUGPATH if [[ "$__SkipNative" != 1 && "$__BuildTestWrappersOnly" != 1 && "$__GenerateLayoutOnly" != 1 && "$__CopyNativeTestBinaries" != 1 && \ - "$__TargetOS" != "browser" && "$__TargetOS" != "android" && "$__TargetOS" != "ios" && "$__TargetOS" != "iossimulator" && "$__TargetOS" != "tvos" && "$__TargetOS" != "tvossimulator" ]]; then + "$__TargetOS" != "android" && "$__TargetOS" != "ios" && "$__TargetOS" != "iossimulator" && "$__TargetOS" != "tvos" && "$__TargetOS" != "tvossimulator" ]]; then build_native "$__TargetOS" "$__TargetArch" "$__TestDir" "$__NativeTestIntermediatesDir" "install" "$__CMakeArgs" "CoreCLR test component" if [[ "$?" -ne 0 ]]; then