From 133e2770d13cb75f21c3471d347bf7f935abfe85 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Tue, 7 Sep 2021 15:03:38 -0400 Subject: [PATCH 1/5] Fix symbols for Microsoft.MonoTargets.Sdk --- src/tasks/AotCompilerTask/MonoAOTCompiler.csproj | 1 + src/tasks/ILStripTask/ILStrip.csproj | 1 + src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj | 1 + src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj | 1 + 4 files changed, 4 insertions(+) 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 d6df214fce7963..5af66648360295 100644 --- a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj +++ b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj @@ -26,6 +26,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)" /> + From 8eca3ef8748203929cd66f94e2879c68f229dcee Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Wed, 8 Sep 2021 18:22:49 -0400 Subject: [PATCH 2/5] Build and include .pdb file on Windows builds of mono-aot-cross --- src/mono/CMakeLists.txt | 15 ++++++++++----- src/mono/mono.proj | 4 ++++ src/mono/mono/mini/CMakeLists.txt | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) 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..a0021d16a4e063 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -751,6 +751,7 @@ <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\mono-sgen$(ExeExt) + <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\mono-sgen.pdb @@ -781,6 +782,9 @@ <_MonoRuntimeArtifacts Include="$(_MonoAotCrossFilePath)"> $(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross$(ExeExt) + <_MonoRuntimeArtifacts Include="$(_MonoAotCrossPdbFilePath)"> + $(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross.pdb + <_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..b3de9d1e9972cc 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -494,4 +494,5 @@ if(NOT DISABLE_EXECUTABLES) set_property(TARGET mono-sgen APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") endif() install(TARGETS mono-sgen RUNTIME) + install(FILES $ DESTINATION bin OPTIONAL) endif() From 2a65b906c594fa718b76ee36af48c7a079492ed0 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 9 Sep 2021 09:39:53 -0400 Subject: [PATCH 3/5] Only TARGET_PDB_FILE on HOST_WIN32 --- src/mono/mono/mini/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index b3de9d1e9972cc..5e0aab15609a78 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -494,5 +494,7 @@ if(NOT DISABLE_EXECUTABLES) set_property(TARGET mono-sgen APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") endif() install(TARGETS mono-sgen RUNTIME) - install(FILES $ DESTINATION bin OPTIONAL) + if(HOST_WIN32) + install(FILES $ DESTINATION bin OPTIONAL) + endif() endif() From 6a433ca1bf7ace0da15d5980a00accae99464307 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Thu, 9 Sep 2021 11:05:46 -0400 Subject: [PATCH 4/5] Another conditional --- src/mono/mono.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index a0021d16a4e063..b3a4479d2e0cc6 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -782,7 +782,7 @@ <_MonoRuntimeArtifacts Include="$(_MonoAotCrossFilePath)"> $(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross$(ExeExt) - <_MonoRuntimeArtifacts Include="$(_MonoAotCrossPdbFilePath)"> + <_MonoRuntimeArtifacts Include="$(_MonoAotCrossPdbFilePath)" Condition="Exists('$(_MonoAotCrossPdbFilePath)')"> $(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross.pdb <_MonoRuntimeArtifacts Condition="'$(MonoBundleLLVMOptimizer)' == 'true'" Include="$(MonoLLVMDir)\bin\llc$(ExeExt)"> From f4f58ca19398ae58424bde7c99092751a93a1b6f Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Fri, 10 Sep 2021 11:12:46 -0400 Subject: [PATCH 5/5] Output directly "mono-aot-cross.exe", don't rename "mono-sgen.exe" --- src/mono/mono.proj | 12 ++++++++---- src/mono/mono/mini/CMakeLists.txt | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index b3a4479d2e0cc6..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,8 +754,8 @@ <_MonoIncludeIcuFiles Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">true - <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\mono-sgen$(ExeExt) - <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\mono-sgen.pdb + <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossFileName) + <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossPdbFileName) @@ -780,10 +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)\mono-aot-cross.pdb + $(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 5e0aab15609a78..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.