Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,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.
-->
<PropertyGroup>
<_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '') and '$(TargetArchitecture)' != 'wasm'">true</_BuildAnyCrossArch>
<_BuildAnyCrossArch Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(HostOS)' != '$(TargetOS)' or '$(EnableNativeSanitizers)' != '')">true</_BuildAnyCrossArch>
<_BuildCrossComponents Condition="$(_subset.Contains('+clr.crossarchtools+'))">true</_BuildCrossComponents>
<_BuildCrossComponents Condition="'$(ClrRuntimeBuildSubsets)' != '' and ('$(PrimaryRuntimeFlavor)' == 'CoreCLR' or '$(TargetsMobile)' == 'true')">true</_BuildCrossComponents>
<_CrossBitwidthBuild Condition="'$(BuildArchitecture)' == 'x64' and ('$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'arm')">true</_CrossBitwidthBuild>
Expand All @@ -381,7 +381,9 @@

<ItemGroup>
<!-- crossgen2/ILC have dependencies on the JITs, so build them if the cross component includes crossgen2/ILC. -->
<_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and ($(_subset.Contains('+clr.tools+')) or $(_subset.Contains('+clr.nativecorelib+')) or $(_subset.Contains('+clr.crossarchtools+')))" Include="ClrAllJitsSubset=true" />
<_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and '$(TargetArchitecture)' != 'wasm' and ($(_subset.Contains('+clr.tools+')) or $(_subset.Contains('+clr.nativecorelib+')) or $(_subset.Contains('+clr.crossarchtools+')))" Include="ClrAllJitsSubset=true" />
<!-- When targeting WebAssembly, only build the wasm JIT for the cross component. -->
<_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and '$(TargetArchitecture)' == 'wasm' and ($(_subset.Contains('+clr.tools+')) or $(_subset.Contains('+clr.nativecorelib+')) or $(_subset.Contains('+clr.crossarchtools+')))" Include="ClrWasmJitSubset=true" />
<!-- When targeting Windows, we need to build a copy of the diagnostic libraries that can run on the host to enable remote debugging of a local build. -->
<_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true' and '$(TargetsWindows)' == 'true'" Include="ClrDebugSubset=true" />
<!--
Expand Down
2 changes: 1 addition & 1 deletion eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else()
if(CLR_CMAKE_RUNTIME_CORECLR)
if(CLR_CMAKE_TARGET_BROWSER)
if(CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CROSS_COMPONENTS_BUILD)
add_link_options(-fwasm-exceptions)
add_link_options(-Wno-unused-command-line-argument)
add_link_options(-Wl,--error-limit=0)
Expand Down
60 changes: 57 additions & 3 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ if(CLR_CMAKE_HOST_UNIX)

add_subdirectory(pal)
else()
if(CLR_CMAKE_TARGET_UNIX)
if(CLR_CMAKE_TARGET_UNIX AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/external/libunwind_extras ${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind)
endif()
endif()
Expand Down Expand Up @@ -149,9 +149,9 @@ endif()
include_directories("pal/prebuilt/inc")
include_directories(${CLR_ARTIFACTS_OBJ_DIR})

if (NOT CLR_CMAKE_TARGET_BROWSER)
if (NOT CLR_CMAKE_TARGET_BROWSER OR CLR_CROSS_COMPONENTS_BUILD)
add_subdirectory(tools/aot/jitinterface)
endif (NOT CLR_CMAKE_TARGET_BROWSER)
endif ()

if(NOT CLR_CROSS_COMPONENTS_BUILD)
# NativeAOT only buildable for a subset of CoreCLR-supported configurations
Expand Down Expand Up @@ -184,6 +184,60 @@ if(FEATURE_STANDALONE_GC)
add_definitions(-DFEATURE_STANDALONE_GC)
endif(FEATURE_STANDALONE_GC)

# For wasm cross-component builds, only the JIT and jitinterface are needed.
# Skip subsystems (GC, VM, debug, etc.) that don't support wasm as a target.
if(CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_TARGET_ARCH_WASM)
include_directories("inc")
include_directories("minipal")
if (CLR_CMAKE_HOST_UNIX)
include_directories("pal/inc")
include_directories("pal/inc/rt")
include_directories("pal/src/safecrt")
set (NATIVE_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nativeresources)
include_directories(${NATIVE_RESOURCE_DIR})

if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set (PROCESS_RC_SCRIPT ${NATIVE_RESOURCE_DIR}/processrc.ps1)
else()
set (PROCESS_RC_SCRIPT ${NATIVE_RESOURCE_DIR}/processrc.sh)
endif()
set (RESOURCE_STRING_HEADER_DIR ${NATIVE_RESOURCE_DIR})

function(build_resources SOURCE TARGET_NAME TARGET_FILE)
set_property(SOURCE ${SOURCE} APPEND PROPERTY COMPILE_DEFINITIONS "RC_INVOKED")
set(PREPROCESSED_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.rc.i)

preprocess_file(${SOURCE} ${PREPROCESSED_SOURCE})

set(RESOURCE_ENTRY_ARRAY_CPP ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.cpp)

if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
add_custom_command(
OUTPUT ${RESOURCE_ENTRY_ARRAY_CPP}
COMMAND powershell -NoProfile -ExecutionPolicy ByPass -File \"${PROCESS_RC_SCRIPT}\" ${PREPROCESSED_SOURCE} ${TARGET_NAME} >${RESOURCE_ENTRY_ARRAY_CPP}
DEPENDS ${PREPROCESSED_SOURCE} ${PROCESS_RC_SCRIPT}
)
else()
add_custom_command(
OUTPUT ${RESOURCE_ENTRY_ARRAY_CPP}
COMMAND ${PROCESS_RC_SCRIPT} ${PREPROCESSED_SOURCE} ${TARGET_NAME} >${RESOURCE_ENTRY_ARRAY_CPP}
DEPENDS ${PREPROCESSED_SOURCE} ${PROCESS_RC_SCRIPT}
)
endif()

include_directories(${RESOURCE_STRING_HEADER_DIR})
set(${TARGET_FILE} ${RESOURCE_ENTRY_ARRAY_CPP} PARENT_SCOPE)
endfunction()

add_subdirectory(nativeresources)
add_subdirectory(dlls/mscorrc)
endif (CLR_CMAKE_HOST_UNIX)
add_subdirectory(utilcode)
add_subdirectory(gcinfo)
add_subdirectory(jit)
return()
endif()
Comment thread
davidwrighton marked this conversation as resolved.

add_subdirectory(gc)

if (CLR_CMAKE_HOST_UNIX)
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/clrfeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ if(CLR_CMAKE_TARGET_TIZEN_LINUX)
endif()

if(NOT DEFINED FEATURE_EVENT_TRACE)
if (NOT CLR_CMAKE_TARGET_BROWSER)
if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT (CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_TARGET_ARCH_WASM))
# To actually disable FEATURE_EVENT_TRACE, also change clr.featuredefines.props
set(FEATURE_EVENT_TRACE 1)
endif()
endif(NOT DEFINED FEATURE_EVENT_TRACE)

if(NOT DEFINED FEATURE_EVENTSOURCE_XPLAT)
if (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_ANDROID)
if (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT (CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_TARGET_ARCH_WASM))
# To actually disable FEATURE_EVENTSOURCE_XPLAT, also change clr.featuredefines.props
set(FEATURE_EVENTSOURCE_XPLAT 1)
endif()
Expand Down
13 changes: 11 additions & 2 deletions src/coreclr/crossgen-corelib.proj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
<PublishReadyToRun>true</PublishReadyToRun>
<!-- Disable crossgen on NetBSD, illumos, Solaris and Haiku for now. This can be revisited when we have full support. -->
<PublishReadyToRun Condition="'$(TargetOS)' == 'netbsd' or '$(TargetOS)' == 'illumos' or '$(TargetOS)' == 'solaris' or '$(TargetOS)' == 'haiku'">false</PublishReadyToRun>
<!-- TODO-WASM: we will have WASM R2R after https://github.com/dotnet/runtime/issues/121257 -->
<PublishReadyToRun Condition="'$(TargetOS)' == 'browser' or '$(TargetOS)' == 'wasi'">false</PublishReadyToRun>
<PublishReadyToRun Condition="'$(TargetOS)' == 'wasi'">false</PublishReadyToRun>

<CrossgenTargetName Condition="!$(PublishReadyToRun)">CopyILCoreLib</CrossgenTargetName>

Expand All @@ -42,6 +41,11 @@
<CrossgenTargetName>$(CrossgenTargetName);LinkCoreLibMachO</CrossgenTargetName>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetOS)' == 'browser' and $(PublishReadyToRun)">
<PublishReadyToRunContainerFormat>wasm</PublishReadyToRunContainerFormat>
<CrossgenTargetName>CopyILCoreLib;$(CrossgenTargetName)</CrossgenTargetName>
</PropertyGroup>

<PropertyGroup Condition="'$(UseComposite)' == 'true'">
<CrossgenTargetName>$(CrossgenTargetName);CopyR2RComponentCoreLib</CrossgenTargetName>
</PropertyGroup>
Expand All @@ -68,6 +72,10 @@
<CoreLibDylibOutputPath>$([MSBuild]::NormalizePath('$(BinDir)', '$(CoreLibAssemblyName).dylib'))</CoreLibDylibOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm'">
<CrossgenCoreLibOutputPath>$([MSBuild]::NormalizePath('$(BinDir)', '$(CoreLibAssemblyName).NotReadyYet.wasm'))</CrossgenCoreLibOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(UseComposite)' == 'true'">
<CrossgenCoreLibComponentOutputPath>$([MSBuild]::NormalizePath('$(IntermediateOutputPath)', '$(CoreLibAssemblyName).dll'))</CrossgenCoreLibComponentOutputPath>
</PropertyGroup>
Expand Down Expand Up @@ -149,6 +157,7 @@
<CrossGenDllCmd>$(CrossGenDllCmd) -r:$([MSBuild]::NormalizePath('$(BinDir)', 'IL', '*.dll'))</CrossGenDllCmd>
<CrossGenDllCmd>$(CrossGenDllCmd) --targetarch:$(TargetArchitecture)</CrossGenDllCmd>
<CrossGenDllCmd Condition="'$(PublishReadyToRunContainerFormat)' != ''">$(CrossGenDllCmd) --obj-format:$(PublishReadyToRunContainerFormat)</CrossGenDllCmd>
<CrossGenDllCmd Condition="'$(PublishReadyToRunContainerFormat)' == 'wasm'">$(CrossGenDllCmd) --codegenopt:JitWasmNyiToR2RUnsupported=1</CrossGenDllCmd>
<CrossGenDllCmd Condition="'$(UseComposite)' == 'true'">$(CrossGenDllCmd) --composite</CrossGenDllCmd>
<CrossGenDllCmd Condition="'$(TargetsAndroid)' != 'true'">$(CrossGenDllCmd) --targetos:$(TargetOS)</CrossGenDllCmd>
<!-- Unless and until Android requires R2R specific customizations, we're just dealing with another linux -->
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/gcinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ endif (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX)

if (CLR_CMAKE_TARGET_ARCH_WASM)
create_gcinfo_lib(TARGET gcinfo_unix_wasm OS browser ARCH wasm)
create_gcinfo_lib(TARGET gcinfo_universal_wasm OS universal ARCH wasm)
install_clr(TARGETS gcinfo_unix_wasm DESTINATIONS sharedFramework COMPONENT runtime)
endif (CLR_CMAKE_TARGET_ARCH_WASM)
4 changes: 4 additions & 0 deletions src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,10 @@ if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
endif(CLR_CMAKE_BUILD_COMMUNITY_ALTJITS EQUAL 1)
endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)

if (CLR_CMAKE_TARGET_ARCH_WASM)
create_standalone_jit(TARGET clrjit_universal_wasm_${ARCH_HOST_NAME} OS universal ARCH wasm)
endif (CLR_CMAKE_TARGET_ARCH_WASM)

if (CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
create_standalone_jit(TARGET clrjit_unix_loongarch64_${ARCH_HOST_NAME} OS unix ARCH loongarch64)
endif (CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3321,10 +3321,12 @@ void CodeGen::genEmitGSCookieCheck(bool tailCall)
NYI_WASM("genEmitGSCookieCheck");
}

#ifdef PROFILING_SUPPORTED
void CodeGen::genProfilingLeaveCallback(unsigned helper)
{
NYI_WASM("genProfilingLeaveCallback");
}
#endif

void CodeGen::genSpillVar(GenTree* tree)
{
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3113,10 +3113,12 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
printf("OPTIONS: compProcedureSplittingEH = %s\n", dspBool(opts.compProcedureSplittingEH));

// This is rare; don't clutter up the dump with it normally.
#ifdef PROFILING_SUPPORTED
if (compProfilerHookNeeded)
{
printf("OPTIONS: compProfilerHookNeeded = %s\n", dspBool(compProfilerHookNeeded));
}
#endif

if (jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT))
{
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/jit/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,9 @@ extern void notYetImplemented(const char* msg, const char* file, unsigned line);
#define NYI_LOONGARCH64(msg) do { } while (0)
#define NYI_RISCV64(msg) do { } while (0)

#if DEBUG
#define NYI_WASM(msg) do { if (JitConfig.JitWasmNyiToR2RUnsupported() > 0) \
{ JITDUMP("NYI_WASM: " msg); implReadyToRunUnsupported(); } \
else { NYIRAW("NYI_WASM: " msg); } } while (0)
#else
#define NYI_WASM(msg) NYIRAW("NYI_WASM: " msg)
#endif // DEBUG

#else

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/fgwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2313,8 +2313,8 @@ void Compiler::fgWasmEhTransformTry(ArrayStack<BasicBlock*>* catchRetBlocks,
BasicBlock* const rethrowBlock =
fgNewBBinRegion(BBJ_THROW, biasedEnclosingTryIndex, biasedEnclosingHndIndex, switchBlock);

switchBlock->bbSetRunRarely();
rethrowBlock->bbSetRunRarely();
switchBlock->inheritWeightPercentage(regionEntryBlock, 0);
rethrowBlock->inheritWeightPercentage(regionEntryBlock, 0);

// Split the header so we can branch to the switch on exception.
//
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ CONFIG_INTEGER(JitDispIns, "JitDispIns", 0)

#if defined(TARGET_WASM)
// Set this to 1 to turn NYI_WASM into R2R unsupported failures instead of asserts.
CONFIG_INTEGER(JitWasmNyiToR2RUnsupported, "JitWasmNyiToR2RUnsupported", 0)
RELEASE_CONFIG_INTEGER(JitWasmNyiToR2RUnsupported, "JitWasmNyiToR2RUnsupported", 0)
// Specify methods that will fail with R2R unsupported after codegen.
// Useful for bypassing methods that compile cleanly but have invalid Wasm codegen.
CONFIG_STRING(JitR2RUnsupportedRange, "JitR2RUnsupportedRange")
Expand Down
20 changes: 10 additions & 10 deletions src/coreclr/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ elseif (CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_OPENBSD)
include_directories(SYSTEM $ENV{ROOTFS_DIR}/usr/local/include)
endif()

if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM)
Comment thread
davidwrighton marked this conversation as resolved.
include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include)
include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include/tdep)
include_directories(${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind/include)
Comment thread
davidwrighton marked this conversation as resolved.
Expand All @@ -21,7 +21,7 @@ elseif(NOT CLR_CMAKE_TARGET_APPLE)
find_unwind_libs(UNWIND_LIBS)
else()
add_subdirectory(${CLR_SRC_NATIVE_DIR}/external/libunwind_extras ${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind)
endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM)

include(configure.cmake)

Expand Down Expand Up @@ -86,9 +86,9 @@ endif(CLR_CMAKE_TARGET_APPLE)
if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
add_definitions(-DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
if(NOT CLR_CMAKE_TARGET_ARCH_WASM OR FEATURE_MULTITHREADING)
if(NOT CLR_CMAKE_HOST_ARCH_WASM OR FEATURE_MULTITHREADING)
add_definitions(-DFEATURE_MULTITHREADING)
endif(NOT CLR_CMAKE_TARGET_ARCH_WASM OR FEATURE_MULTITHREADING)
endif(NOT CLR_CMAKE_HOST_ARCH_WASM OR FEATURE_MULTITHREADING)
add_definitions(-DLP64COMPATIBLE)
add_definitions(-DCORECLR)
add_definitions(-DPIC)
Expand Down Expand Up @@ -116,26 +116,26 @@ endif(CLR_CMAKE_TARGET_HAIKU)
# turn off capability to remove unused functions (which was enabled in debug build with sanitizers)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-gc-sections")

if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
if (NOT CLR_CMAKE_HOST_ARCH_WASM)
set(ARCH_SOURCES
arch/${PAL_ARCH_SOURCES_DIR}/context2.S
arch/${PAL_ARCH_SOURCES_DIR}/debugbreak.S
arch/${PAL_ARCH_SOURCES_DIR}/exceptionhelper.S
)
endif()

if (CLR_CMAKE_TARGET_ARCH_WASM)
if (CLR_CMAKE_HOST_ARCH_WASM)
set(PLATFORM_SOURCES
arch/${PAL_ARCH_SOURCES_DIR}/stubs.cpp
)
endif()

if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_HOST_ARCH_WASM)
list(APPEND PLATFORM_SOURCES
arch/${PAL_ARCH_SOURCES_DIR}/callsignalhandlerwrapper.S
arch/${PAL_ARCH_SOURCES_DIR}/signalhandlerhelper.cpp
)
endif(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
endif(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_HOST_ARCH_WASM)

if(CLR_CMAKE_HOST_ARCH_ARM)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down Expand Up @@ -215,9 +215,9 @@ set_source_files_properties(
INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/../inc/rt
)

if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM)
set(LIBUNWIND_OBJECTS $<TARGET_OBJECTS:libunwind>)
endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_HOST_ARCH_WASM)

add_library(coreclrpal_objects
OBJECT
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/aot/crossgen2/crossgen2.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
CopyToPublishDirectory="PreserveNewest"
ExcludeFromSingleFile="$(PublishSingleFile)"
Link="%(FileName)%(Extension)"
Condition="'$(TargetsWasm)' != 'true'"
Condition="'$(TargetsWasm)' != 'true' or '$(CrossHostArch)' != ''"
/>

<Content Include="$(CoreCLRArtifactsPath)/$(CrossHostArch)/$(_LibPrefix)clrjit_*_$(TargetArchitectureForSharedLibraries)$(_LibSuffix)"
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/utilcode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ if(CLR_CMAKE_HOST_WIN32)
target_compile_definitions(utilcodestaticnohost PRIVATE _CRTIMP=) # use static version of crt

link_natvis_sources_for_target(utilcodestaticnohost INTERFACE utilcode.natvis)
link_natvis_sources_for_target(utilcode_dac INTERFACE utilcode.natvis)
if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
link_natvis_sources_for_target(utilcode_dac INTERFACE utilcode.natvis)
endif()
link_natvis_sources_for_target(utilcode INTERFACE utilcode.natvis)
endif(CLR_CMAKE_HOST_WIN32)

Expand Down
6 changes: 4 additions & 2 deletions src/native/minipal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ set(SOURCES
# ospagesize is provided inline in the header on Windows and WASM; the .c file
# only contains the POSIX implementation. Including it on those platforms would
# produce a redefinition error (mono builds for wasi/browser set HOST_WASM but
# not CLR_CMAKE_TARGET_ARCH_WASM, so check both).
if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT HOST_WASM)
# not CLR_CMAKE_TARGET_ARCH_WASM, so check both). In cross-component builds
# (e.g. host=x64, target=wasm) the code runs on the host, so we still need the
# POSIX implementation; only skip when the HOST is actually wasm.
if(NOT WIN32 AND NOT HOST_WASM AND NOT (CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CROSS_COMPONENTS_BUILD))
list(APPEND SOURCES ospagesize.c)
endif()

Expand Down
Loading