diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt
index a7038121e37daa..3d562610861b43 100644
--- a/src/mono/CMakeLists.txt
+++ b/src/mono/CMakeLists.txt
@@ -243,11 +243,16 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_compile_options(/EHsc) # set exception handling behavior
add_compile_options(/FC) # use full pathnames in diagnostics
if(CMAKE_BUILD_TYPE STREQUAL "Release")
- add_compile_options(/Oi) # enable intrinsics
- add_compile_options(/GF) # enable string pooling
- add_compile_options(/Zi) # enable debugging information
- add_compile_options(/GL) # whole program optimization
- add_link_options(/LTCG) # link-time code generation
+ add_compile_options(/Oi) # enable intrinsics
+ add_compile_options(/GF) # enable string pooling
+ add_compile_options(/Zi) # enable debugging information
+ add_compile_options(/GL) # whole program optimization
+ add_link_options(/LTCG) # link-time code generation
+ add_link_options(/DEBUG) # enable debugging information
+ add_link_options(/OPT:REF) # optimize: remove unreferenced functions & data
+ add_link_options(/OPT:ICF) # optimize: enable COMDAT folding
+ # the combination of /Zi compiler flag and /DEBUG /OPT:REF /OPT:ICF
+ # linker flags is needed to create .pdb output on release builds
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(HOST_SOLARIS 1)
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index 22fe6353233dee..6d69846fe52e2a 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -36,6 +36,8 @@
$(LibPrefix)$(MonoLibName)$(StaticLibExt)
$(MonoStaticLibFileName)
$(MonoSharedLibFileName)
+ mono-aot-cross$(ExeExt)
+ mono-aot-cross.pdb
$(Configuration)
$(Configuration)
$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'tests', 'coreclr', '$(TargetOS).$(Platform).$(CoreClrTestConfig)', 'Tests', 'Core_Root'))
@@ -677,6 +679,8 @@
+
+
@@ -750,7 +754,8 @@
<_MonoIncludeIcuFiles Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">true
- <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\mono-sgen$(ExeExt)
+ <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossFileName)
+ <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossPdbFileName)
@@ -779,7 +784,10 @@
$(RuntimeBinDir)%(_MonoRuntimeComponentsSharedFilePath.Filename)%(_MonoRuntimeComponentsSharedFilePath.Extension)
<_MonoRuntimeArtifacts Include="$(_MonoAotCrossFilePath)">
- $(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross$(ExeExt)
+ $(RuntimeBinDir)cross\$(PackageRID)\$(MonoAotCrossFileName)
+
+ <_MonoRuntimeArtifacts Include="$(_MonoAotCrossPdbFilePath)" Condition="Exists('$(_MonoAotCrossPdbFilePath)')">
+ $(RuntimeBinDir)cross\$(PackageRID)\$(MonoAotCrossPdbFileName)
<_MonoRuntimeArtifacts Condition="'$(MonoBundleLLVMOptimizer)' == 'true'" Include="$(MonoLLVMDir)\bin\llc$(ExeExt)">
$(RuntimeBinDir)\llc$(ExeExt)
diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt
index 5b2eac8f049ee9..07e04ec507bde3 100644
--- a/src/mono/mono/mini/CMakeLists.txt
+++ b/src/mono/mono/mini/CMakeLists.txt
@@ -475,6 +475,9 @@ if(NOT DISABLE_EXECUTABLES)
set(sgen_sources "${sgen_sources};${PROJECT_BINARY_DIR}/../../NativeVersion.rc")
endif()
add_executable(mono-sgen "${sgen_sources}")
+ if(MONO_CROSS_COMPILE_EXECUTABLE_NAME)
+ set_target_properties(mono-sgen PROPERTIES OUTPUT_NAME mono-aot-cross)
+ endif()
target_link_libraries(mono-sgen PRIVATE monosgen-static ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS})
if(NOT DISABLE_COMPONENTS AND STATIC_COMPONENTS AND NOT DISABLE_LINK_STATIC_COMPONENTS)
# if components are built statically, link them into runtime.
@@ -494,4 +497,7 @@ if(NOT DISABLE_EXECUTABLES)
set_property(TARGET mono-sgen APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}")
endif()
install(TARGETS mono-sgen RUNTIME)
+ if(HOST_WIN32)
+ install(FILES $ DESTINATION bin OPTIONAL)
+ endif()
endif()
diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj b/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj
index 6371df56223568..840115ca71b909 100644
--- a/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj
+++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj
@@ -36,6 +36,7 @@
<_PublishFramework Include="$(TargetFrameworks)" />
+
diff --git a/src/tasks/ILStripTask/ILStrip.csproj b/src/tasks/ILStripTask/ILStrip.csproj
index 879c56f26ae262..bb9c41f692e1cc 100644
--- a/src/tasks/ILStripTask/ILStrip.csproj
+++ b/src/tasks/ILStripTask/ILStrip.csproj
@@ -27,6 +27,7 @@
<_PublishFramework Include="$(TargetFrameworks)" />
+
diff --git a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj
index f68810fc3f1c26..17799fbf6570c1 100644
--- a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj
+++ b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj
@@ -32,6 +32,7 @@
<_PublishFramework Include="$(TargetFrameworks)" />
+
diff --git a/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj b/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj
index 2fb35e649eed73..c07e367def62ec 100644
--- a/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj
+++ b/src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj
@@ -33,6 +33,7 @@
<_PublishFramework Include="$(TargetFrameworks)" />
+