[release/6.0-rc2] Create and publish missing symbols (#59259)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Mon, 20 Sep 2021 19:41:38 +0000 (12:41 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Sep 2021 19:41:38 +0000 (12:41 -0700)
* Fix symbols for Microsoft.MonoTargets.Sdk

* Build and include .pdb file on Windows builds of mono-aot-cross

* Only TARGET_PDB_FILE on HOST_WIN32

* Another conditional

* Output directly "mono-aot-cross.exe", don't rename "mono-sgen.exe"

Co-authored-by: Jo Shields <directhex@apebox.org>
Co-authored-by: Jo Shields <joshield@microsoft.com>
src/mono/CMakeLists.txt
src/mono/mono.proj
src/mono/mono/mini/CMakeLists.txt
src/tasks/AotCompilerTask/MonoAOTCompiler.csproj
src/tasks/ILStripTask/ILStrip.csproj
src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.csproj
src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj

index bd636b9..bbd8de5 100644 (file)
@@ -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)
index 9b4d254..c4bd405 100644 (file)
@@ -36,6 +36,8 @@
     <MonoStaticLibFileName>$(LibPrefix)$(MonoLibName)$(StaticLibExt)</MonoStaticLibFileName>
     <MonoFileName Condition="'$(TargetsBrowser)' == 'true'">$(MonoStaticLibFileName)</MonoFileName>
     <MonoFileName Condition="'$(MonoFileName)' == ''">$(MonoSharedLibFileName)</MonoFileName>
+    <MonoAotCrossFileName>mono-aot-cross$(ExeExt)</MonoAotCrossFileName>
+    <MonoAotCrossPdbFileName>mono-aot-cross.pdb</MonoAotCrossPdbFileName>
     <CoreClrTestConfig Condition="'$(CoreClrTestConfig)' == ''">$(Configuration)</CoreClrTestConfig>
     <LibrariesTestConfig Condition="'$(LibrariesTestConfig)' == ''">$(Configuration)</LibrariesTestConfig>
     <CoreClrTestCoreRoot>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'tests', 'coreclr', '$(TargetOS).$(Platform).$(CoreClrTestConfig)', 'Tests', 'Core_Root'))</CoreClrTestCoreRoot>
       <MonoAOTCMakeArgs Include="$(_MonoAOTCXXFLAGSOption)" />
       <!-- thread suspend -->
       <MonoAOTCMakeArgs Include="-DGC_SUSPEND=$(MonoThreadSuspend)" />
+      <!-- rename exe -->
+      <MonoAOTCMakeArgs Include="-DMONO_CROSS_COMPILE_EXECUTABLE_NAME=1" />
     </ItemGroup>
 
     <PropertyGroup>
       <_MonoIncludeIcuFiles Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'">true</_MonoIncludeIcuFiles>
     </PropertyGroup>
     <PropertyGroup Condition="'$(BuildMonoAOTCrossCompiler)' == 'true'">
-      <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\mono-sgen$(ExeExt)</_MonoAotCrossFilePath>
+      <_MonoAotCrossFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossFileName)</_MonoAotCrossFilePath>
+      <_MonoAotCrossPdbFilePath>$(MonoObjCrossDir)out\bin\$(MonoAotCrossPdbFileName)</_MonoAotCrossPdbFilePath>
     </PropertyGroup>
 
     <!-- Copy Mono runtime files to artifacts directory -->
         <Destination>$(RuntimeBinDir)%(_MonoRuntimeComponentsSharedFilePath.Filename)%(_MonoRuntimeComponentsSharedFilePath.Extension)</Destination>
       </_MonoRuntimeArtifacts>
       <_MonoRuntimeArtifacts Include="$(_MonoAotCrossFilePath)">
-        <Destination>$(RuntimeBinDir)cross\$(PackageRID)\mono-aot-cross$(ExeExt)</Destination>
+        <Destination>$(RuntimeBinDir)cross\$(PackageRID)\$(MonoAotCrossFileName)</Destination>
+      </_MonoRuntimeArtifacts>
+      <_MonoRuntimeArtifacts Include="$(_MonoAotCrossPdbFilePath)" Condition="Exists('$(_MonoAotCrossPdbFilePath)')">
+        <Destination>$(RuntimeBinDir)cross\$(PackageRID)\$(MonoAotCrossPdbFileName)</Destination>
       </_MonoRuntimeArtifacts>
       <_MonoRuntimeArtifacts Condition="'$(MonoBundleLLVMOptimizer)' == 'true'" Include="$(MonoLLVMDir)\bin\llc$(ExeExt)">
         <Destination>$(RuntimeBinDir)\llc$(ExeExt)</Destination>
index 3e9ca49..1760e09 100644 (file)
@@ -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.
@@ -492,4 +495,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 $<TARGET_PDB_FILE:mono-sgen> DESTINATION bin OPTIONAL)
+  endif()
 endif()
index 6371df5..840115c 100644 (file)
@@ -36,6 +36,7 @@
       <_PublishFramework Include="$(TargetFrameworks)" />
 
       <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).dll" TargetPath="tasks\%(_PublishFramework.Identity)" />
+      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).pdb" TargetPath="tasks\%(_PublishFramework.Identity)" />
     </ItemGroup>
   </Target>
 </Project>
index 879c56f..bb9c41f 100644 (file)
@@ -27,6 +27,7 @@
       <_PublishFramework Include="$(TargetFrameworks)" />
 
       <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).dll" TargetPath="tasks\%(_PublishFramework.Identity)" />
+      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).pdb" TargetPath="tasks\%(_PublishFramework.Identity)" />
     </ItemGroup>
   </Target>
 </Project>
index f68810f..17799fb 100644 (file)
@@ -32,6 +32,7 @@
       <_PublishFramework Include="$(TargetFrameworks)" />
 
       <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).dll" TargetPath="tasks\%(_PublishFramework.Identity)" />
+      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).pdb" TargetPath="tasks\%(_PublishFramework.Identity)" />
     </ItemGroup>
   </Target>
 
index 2fb35e6..c07e367 100644 (file)
@@ -33,6 +33,7 @@
       <_PublishFramework Include="$(TargetFrameworks)" />
 
       <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\*.dll" TargetPath="tasks\%(_PublishFramework.Identity)" />
+      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\*.pdb" TargetPath="tasks\%(_PublishFramework.Identity)" />
     </ItemGroup>
   </Target>