From eafea0352a26faf652c055bcce7e462a4df46150 Mon Sep 17 00:00:00 2001
From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com>
Date: Wed, 22 Nov 2023 14:04:13 -0800
Subject: [PATCH] Revert "Make runtime compatible with VMR cross-builds
 (#95088)"

This reverts commit ef66447c3f3767da16c2e4db0acdeda5ac022844.
---
 eng/SourceBuild.props                                    | 6 ++----
 src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj       | 1 -
 src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj | 2 --
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 3e93e1aa4507fa..383c4cef575d7c 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,8 +15,7 @@
     <AllowTestProjectUsage>true</AllowTestProjectUsage>
 
     <!-- TargetRid names what gets built. -->
-    <HostRid>$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</HostRid>
-    <TargetRid Condition="'$(TargetRid)' == ''">$(HostRid)</TargetRid>
+    <TargetRid Condition="'$(TargetRid)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
 
     <!-- Split e.g. 'fedora.33-x64' into 'fedora.33' and 'x64'. -->
     <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-'))</_targetRidPlatformIndex>
@@ -38,7 +37,6 @@
       <InnerBuildArgs>$(InnerBuildArgs) --nodereuse false</InnerBuildArgs>
       <InnerBuildArgs>$(InnerBuildArgs) --warnAsError false</InnerBuildArgs>
       <InnerBuildArgs>$(InnerBuildArgs) --outputrid $(TargetRid)</InnerBuildArgs>
-      <InnerBuildArgs Condition="'$(TargetRid)' != '$(HostRid)'">$(InnerBuildArgs) --cross</InnerBuildArgs>
       <!-- PackageOS and ToolsOS control the rids of prebuilts consumed by the build.
            They are set to RuntimeOS so they match with the build SDK rid. -->
       <InnerBuildArgs Condition="'$(RuntimeOS)' != ''">$(InnerBuildArgs) /p:PackageOS=$(RuntimeOS) /p:ToolsOS=$(RuntimeOS)</InnerBuildArgs>
@@ -73,7 +71,7 @@
       <IntermediateNupkgArtifactFile
         Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)Shipping\Microsoft.NETCore.App.Crossgen2.*.nupkg"
         Category="Crossgen2Pack" />
-
+        
         <IntermediateNupkgArtifactFile
         Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)Shipping\dotnet-crossgen2-*.tar.gz;"
         Category="Crossgen2Archive" />
diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj
index 420887585d68a6..6c94731ffdade7 100644
--- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj
+++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj
@@ -18,7 +18,6 @@
     <PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot>
     <SysRoot Condition="'$(NativeAotSupported)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
     <PublishReadyToRun Condition="'$(NativeAotSupported)' != 'true'">true</PublishReadyToRun>
-    <PublishReadyToRun Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(CrossBuild)' == 'true'">false</PublishReadyToRun>
     <PublishSingleFile Condition="'$(NativeAotSupported)' != 'true'">true</PublishSingleFile>
     <PublishTrimmed Condition="'$(NativeAotSupported)' != 'true'">true</PublishTrimmed>
     <SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
index 9b84ac0f097b69..8243494d1e15ad 100644
--- a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
+++ b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj
@@ -28,8 +28,6 @@
     <PublishReadyToRun Condition="'$(TargetOS)' == 'netbsd' Or '$(TargetOS)' == 'illumos' Or '$(TargetOS)' == 'solaris' Or '$(TargetOS)' == 'haiku'">false</PublishReadyToRun>
     <!-- Disable crossgen on FreeBSD when cross building from Linux. -->
     <PublishReadyToRun Condition="'$(TargetOS)' == 'freebsd' and '$(CrossBuild)' == 'true'">false</PublishReadyToRun>
-    <!-- Source Build doesn't create a host runtime pack before the crossbuild, so crossgen fails to run on the host -->
-    <PublishReadyToRun Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(CrossBuild)' == 'true'">false</PublishReadyToRun>
     <PublishReadyToRunComposite>true</PublishReadyToRunComposite>
   </PropertyGroup>
 
