From 7a021b26cfd11df162b3f58d99f0e7ebff75e520 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 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)" /> + From 5932a09cbeddd5e957b3687a75d8ca8b89cddc01 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 bd636b92e284ea..bbd8de5308a45a 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -245,11 +245,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 9b4d254d42598a..ea39a8c8b602cb 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -746,6 +746,7 @@ <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\mono-sgen$(ExeExt) + <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\mono-sgen.pdb @@ -776,6 +777,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 3e9ca497336abf..6ee19989d3dafd 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -492,4 +492,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 ce3d49157e226fc2b592c93e1e32e0e4c1f0e431 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 6ee19989d3dafd..4225ee205c1ff1 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -492,5 +492,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 d886fb2326a16935fc5be419854325c95a4884bc 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 ea39a8c8b602cb..d2f4f9ecf28311 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -777,7 +777,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 802aa5024d731df60f05167e85812a20c03b55a8 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 d2f4f9ecf28311..c4bd405f0e606b 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')) @@ -672,6 +674,8 @@ + + @@ -745,8 +749,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) @@ -775,10 +779,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 4225ee205c1ff1..1760e0982cc24a 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -473,6 +473,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.