diff --git a/eng/Subsets.props b/eng/Subsets.props
index ba8bc03906a1cb..a7b6af15bac138 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -29,8 +29,7 @@
<_CoreCLRSupportedOS Condition="'$(TargetsMobile)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">true
-
- <_CoreCLRSupportedOS Condition="'$(TargetsAndroid)' == 'true' and '$(TargetArchitecture)' != 'arm' and '$(TargetArchitecture)' != 'x86'">true
+ <_CoreCLRSupportedOS Condition="'$(TargetsAndroid)' == 'true' and '$(TargetArchitecture)' != 'x86'">true
<_CoreCLRSupportedOS Condition="'$(TargetsBrowser)' == 'true'">true
<_CoreCLRSupportedOS Condition="'$(TargetsAppleMobile)' == 'true'">true
diff --git a/eng/pipelines/coreclr/templates/helix-queues-setup.yml b/eng/pipelines/coreclr/templates/helix-queues-setup.yml
index ad687d71b45604..951d7ba6b52ffc 100644
--- a/eng/pipelines/coreclr/templates/helix-queues-setup.yml
+++ b/eng/pipelines/coreclr/templates/helix-queues-setup.yml
@@ -46,6 +46,13 @@ jobs:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- OSX.15.Amd64
+ # Android arm
+ - ${{ if in(parameters.platform, 'android_arm') }}:
+ - ${{ if eq(variables['System.TeamProject'], 'public') }}:
+ - Windows.11.Amd64.Android.Arm32.Open
+ - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
+ - Windows.11.Amd64.Android.Arm32
+
# Android arm64
- ${{ if in(parameters.platform, 'android_arm64') }}:
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml
index e9fedea2ff9135..d8579d34b876b4 100644
--- a/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml
+++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml
@@ -96,6 +96,7 @@ jobs:
buildConfig: Release
runtimeFlavor: coreclr
platforms:
+ - android_arm
- android_arm64
variables:
# map dependencies variables to local variables
diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml
index 103c4aa1fc3cf7..44ea3d22cbf9ae 100644
--- a/eng/pipelines/libraries/helix-queues-setup.yml
+++ b/eng/pipelines/libraries/helix-queues-setup.yml
@@ -93,7 +93,9 @@ jobs:
- Ubuntu.2204.Amd64.Android.29.Open
- ${{ if and(ne(variables['System.TeamProject'], 'public'), in(parameters.platform, 'android_arm', 'android_arm64', 'linux_bionic_arm', 'linux_bionic_arm64')) }}:
- Ubuntu.2204.Amd64.Android.29.Open
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.platform, 'android_arm', 'android_arm64', 'linux_bionic_arm', 'linux_bionic_arm64')) }}:
+ - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.platform, 'android_arm', 'linux_bionic_arm')) }}:
+ - Windows.11.Amd64.Android.Arm32.Open
+ - ${{ if and(eq(variables['System.TeamProject'], 'public'), in(parameters.platform, 'android_arm64', 'linux_bionic_arm64')) }}:
- Windows.11.Amd64.Android.Open
# iOS Simulator/Mac Catalyst arm64
diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml
index a1eb3eec103e5d..1009a500704b33 100644
--- a/eng/pipelines/runtime.yml
+++ b/eng/pipelines/runtime.yml
@@ -1100,7 +1100,7 @@ extends:
eq(variables['isRollingBuild'], true))
#
- # Android arm64 devices and x64 emulators
+ # Android arm/arm64 devices and x64 emulators
# Build the whole product using CoreCLR and run functional tests
#
- template: /eng/pipelines/common/platform-matrix.yml
@@ -1110,6 +1110,7 @@ extends:
buildConfig: Release
runtimeFlavor: coreclr
platforms:
+ - android_arm
- android_x64
- android_arm64
variables:
diff --git a/eng/testing/tests.readytorun.targets b/eng/testing/tests.readytorun.targets
index 82fde4e2cb4897..17777679db90dc 100644
--- a/eng/testing/tests.readytorun.targets
+++ b/eng/testing/tests.readytorun.targets
@@ -3,14 +3,12 @@
$([MSBuild]::NormalizePath('$(Crossgen2InBuildDir)', 'crossgen2$(ExeSuffix)'))
- <_CrossGenTargetOS Condition="'$(TargetsAndroid)' != 'true'">$(TargetOS)
- <_CrossGenTargetOS Condition="'$(TargetsAndroid)' == 'true'">linux
diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake
index 543ef485f0d525..d38589419c4141 100644
--- a/src/coreclr/clrdefinitions.cmake
+++ b/src/coreclr/clrdefinitions.cmake
@@ -289,7 +289,8 @@ function(set_target_definitions_to_custom_os_and_arch)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WASM32)
endif()
- if (TARGETDETAILS_ARCH STREQUAL "armel")
+ if (TARGETDETAILS_ARCH STREQUAL "armel" OR
+ (TARGETDETAILS_ARCH STREQUAL "arm" AND CLR_CMAKE_TARGET_ANDROID))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ARM_SOFTFP)
endif()
endfunction()
diff --git a/src/coreclr/crossgen-corelib.proj b/src/coreclr/crossgen-corelib.proj
index 069d3b7278e143..aec6cbc08526b1 100644
--- a/src/coreclr/crossgen-corelib.proj
+++ b/src/coreclr/crossgen-corelib.proj
@@ -150,9 +150,7 @@
$(CrossGenDllCmd) --targetarch:$(TargetArchitecture)
$(CrossGenDllCmd) --obj-format:$(PublishReadyToRunContainerFormat)
$(CrossGenDllCmd) --composite
- $(CrossGenDllCmd) --targetos:$(TargetOS)
-
- $(CrossGenDllCmd) --targetos:linux
+ $(CrossGenDllCmd) --targetos:$(TargetOS)
$(CrossGenDllCmd) -m:$(MergedMibcPath) --embed-pgo-data
$(CrossGenDllCmd) -O
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
index 950cc3d538a236..9c961cbee95b34 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -215,9 +215,7 @@ The .NET Foundation licenses this file to you under the MIT license.
-
-
-
+
diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs
index 5aedd6781601fe..d13d782327467b 100644
--- a/src/coreclr/tools/Common/CommandLineHelpers.cs
+++ b/src/coreclr/tools/Common/CommandLineHelpers.cs
@@ -25,6 +25,9 @@ internal static partial class Helpers
{
public const string DefaultSystemModule = "System.Private.CoreLib";
+ public static string[] ValidOS { get; } = ["windows", "linux", "freebsd", "osx", "maccatalyst", "ios", "iossimulator", "tvos", "tvossimulator", "android", "browser", "wasi"];
+ public static string[] ValidArchitectures { get; } = ["arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64", "wasm"];
+
public static Dictionary BuildPathDictionary(IReadOnlyList tokens, bool strict)
{
Dictionary dictionary = new(StringComparer.OrdinalIgnoreCase);
@@ -73,7 +76,7 @@ public static TargetOS GetTargetOS(string token)
return token.ToLowerInvariant() switch
{
- "linux" => TargetOS.Linux,
+ "linux" or "android" => TargetOS.Linux,
"win" or "windows" => TargetOS.Windows,
"osx" => TargetOS.OSX,
"freebsd" => TargetOS.FreeBSD,
@@ -120,6 +123,23 @@ public static TargetArchitecture GetTargetArchitecture(string token)
}
}
+ public static (TargetArchitecture, TargetOS, TargetAbi) GetTargetSpec(string targetArchitectureToken, string targetOSToken)
+ {
+ targetArchitectureToken = targetArchitectureToken?.ToLowerInvariant();
+ targetOSToken = targetOSToken?.ToLowerInvariant();
+
+ TargetArchitecture targetArchitecture = GetTargetArchitecture(targetArchitectureToken);
+ TargetOS targetOS = GetTargetOS(targetOSToken);
+ TargetAbi targetAbi = (targetOSToken, targetArchitectureToken) switch
+ {
+ (_, "armel") => TargetAbi.NativeAotArmel,
+ ("android", "arm") => TargetAbi.NativeAotArmel,
+ _ => TargetAbi.NativeAot,
+ };
+
+ return (targetArchitecture, targetOS, targetAbi);
+ }
+
public static RootCommand UseVersion(this RootCommand command)
{
for (int i = 0; i < command.Options.Count; i++)
diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
index fa5340d80a13fc..91547f5749adc0 100644
--- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
+++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
@@ -160,10 +160,10 @@ internal sealed class ILCompilerRootCommand : RootCommand
new("--trim") { DefaultValueFactory = _ => Array.Empty(), Description = "Trim the specified assembly" };
public Option RootDefaultAssemblies { get; } =
new("--defaultrooting") { Description = "Root assemblies that are not marked [IsTrimmable]" };
- public Option TargetArchitecture { get; } =
- new("--targetarch") { CustomParser = MakeTargetArchitecture, DefaultValueFactory = MakeTargetArchitecture, Description = "Target architecture for cross compilation", HelpName = "arg" };
- public Option TargetOS { get; } =
- new("--targetos") { CustomParser = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), DefaultValueFactory = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), Description = "Target OS for cross compilation", HelpName = "arg" };
+ public Option TargetArchitecture { get; } =
+ new("--targetarch") { Description = "Target architecture for cross compilation" };
+ public Option TargetOS { get; } =
+ new("--targetos") { Description = "Target OS for cross compilation" };
public Option JitPath { get; } =
new("--jitpath") { Description = "Path to JIT compiler library" };
public Option SingleMethodTypeName { get; } =
@@ -187,8 +187,6 @@ internal sealed class ILCompilerRootCommand : RootCommand
public OptimizationMode OptimizationMode { get; private set; }
public ParseResult Result;
- public static bool IsArmel { get; private set; }
-
public ILCompilerRootCommand(string[] args) : base(".NET Native IL Compiler")
{
Arguments.Add(InputFilePaths);
@@ -349,12 +347,9 @@ public static void PrintExtendedHelp(ParseResult _)
Console.WriteLine("Use the '--' option to disambiguate between input files that have begin with -- and options. After a '--' option, all arguments are " +
"considered to be input files. If no input files begin with '--' then this option is not necessary.\n");
- string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64", "riscv64", "loongarch64" };
- string[] ValidOS = new string[] { "windows", "linux", "freebsd", "osx", "maccatalyst", "ios", "iossimulator", "tvos", "tvossimulator" };
-
- Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant());
+ Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", Helpers.ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant());
- Console.WriteLine(string.Format("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetarch", string.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
+ Console.WriteLine(string.Format("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetarch", string.Join("', '", Helpers.ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
Console.WriteLine("The allowable values for the --instruction-set option are described in the table below. Each architecture has a different set of valid " +
"instruction sets, and multiple instruction sets may be specified by separating the instructions sets by a ','. By default other instruction sets not " +
@@ -362,7 +357,7 @@ public static void PrintExtendedHelp(ParseResult _)
"All such light-up can be disallowed by specifying '-optimistic'. The instruction sets supported by the machine invoking the tool can be targeted by " +
"specifying 'native'. For example 'native', 'avx,aes', 'avx,aes,-avx2', or 'avx,aes,-optimistic'");
- foreach (string arch in ValidArchitectures)
+ foreach (string arch in Helpers.ValidArchitectures)
{
TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
bool first = true;
@@ -395,18 +390,6 @@ public static void PrintExtendedHelp(ParseResult _)
Console.WriteLine(string.Join(", ", Internal.JitInterface.InstructionSetFlags.AllCpuNames));
}
- private static TargetArchitecture MakeTargetArchitecture(ArgumentResult result)
- {
- string firstToken = result.Tokens.Count > 0 ? result.Tokens[0].Value : null;
- if (firstToken != null && firstToken.Equals("armel", StringComparison.OrdinalIgnoreCase))
- {
- IsArmel = true;
- return Internal.TypeSystem.TargetArchitecture.ARM;
- }
-
- return Helpers.GetTargetArchitecture(firstToken);
- }
-
private static int MakeParallelism(ArgumentResult result)
{
if (result.Tokens.Count > 0)
diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs
index 469a09b95224a7..b0f39723c9ce70 100644
--- a/src/coreclr/tools/aot/ILCompiler/Program.cs
+++ b/src/coreclr/tools/aot/ILCompiler/Program.cs
@@ -104,8 +104,8 @@ public int Run()
// directly encoded as part of the required ISAs.
bool isVectorTOptimistic = false;
- TargetArchitecture targetArchitecture = Get(_command.TargetArchitecture);
- TargetOS targetOS = Get(_command.TargetOS);
+ (TargetArchitecture targetArchitecture, TargetOS targetOS, TargetAbi targetAbi) =
+ Helpers.GetTargetSpec(Get(_command.TargetArchitecture), Get(_command.TargetOS));
InstructionSetSupport instructionSetSupport = Helpers.ConfigureInstructionSetSupport(Get(_command.InstructionSet), Get(_command.MaxVectorTBitWidth), isVectorTOptimistic, targetArchitecture, targetOS,
"Unrecognized instruction set {0}", "Unsupported combination of instruction sets: {0}/{1}", logger,
allowOptimistic: _command.OptimizationMode != OptimizationMode.PreferSize,
@@ -122,7 +122,6 @@ public int Run()
SharedGenericsMode genericsMode = SharedGenericsMode.CanonicalReferenceTypes;
var simdVectorLength = instructionSetSupport.GetVectorTSimdVector();
- var targetAbi = ILCompilerRootCommand.IsArmel ? TargetAbi.NativeAotArmel : TargetAbi.NativeAot;
var targetDetails = new TargetDetails(targetArchitecture, targetOS, targetAbi, simdVectorLength);
CompilerTypeSystemContext typeSystemContext =
new CompilerTypeSystemContext(targetDetails, genericsMode, supportsReflection ? DelegateFeature.All : 0,
diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
index 49127d3077831a..e6eb8a62178bc4 100644
--- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
+++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
@@ -86,16 +86,16 @@ internal class Crossgen2RootCommand : RootCommand
new("--resilient") { Description = SR.ResilientOption };
public Option ImageBase { get; } =
new("--imagebase") { Description = SR.ImageBase };
- public Option TargetArchitecture { get; } =
- new("--targetarch") { CustomParser = MakeTargetArchitecture, DefaultValueFactory = MakeTargetArchitecture, Description = SR.TargetArchOption, Arity = ArgumentArity.OneOrMore, HelpName = "arg" };
+ public Option TargetArchitecture { get; } =
+ new("--targetarch") { Description = SR.TargetArchOption };
public Option EnableGenericCycleDetection { get; } =
new("--enable-generic-cycle-detection") { Description = SR.EnableGenericCycleDetection };
public Option GenericCycleDepthCutoff { get; } =
new("--maxgenericcycle") { DefaultValueFactory = _ => ReadyToRunCompilerContext.DefaultGenericCycleDepthCutoff, Description = SR.GenericCycleDepthCutoff };
public Option GenericCycleBreadthCutoff { get; } =
new("--maxgenericcyclebreadth") { DefaultValueFactory = _ => ReadyToRunCompilerContext.DefaultGenericCycleBreadthCutoff, Description = SR.GenericCycleBreadthCutoff };
- public Option TargetOS { get; } =
- new("--targetos") { CustomParser = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), DefaultValueFactory = result => Helpers.GetTargetOS(result.Tokens.Count > 0 ? result.Tokens[0].Value : null), Description = SR.TargetOSOption, HelpName = "arg" };
+ public Option TargetOS { get; } =
+ new("--targetos") { Description = SR.TargetOSOption };
public Option JitPath { get; } =
new("--jitpath") { Description = SR.JitPathOption };
public Option PrintReproInstructions { get; } =
@@ -160,8 +160,6 @@ internal class Crossgen2RootCommand : RootCommand
public OptimizationMode OptimizationMode { get; private set; }
public ParseResult Result { get; private set; }
- public static bool IsArmel { get; private set; }
-
public Crossgen2RootCommand(string[] args) : base(SR.Crossgen2BannerText)
{
Arguments.Add(InputFilePaths);
@@ -308,12 +306,9 @@ public static void PrintExtendedHelp(ParseResult _)
Console.WriteLine(SR.DashDashHelp);
Console.WriteLine();
- string[] ValidArchitectures = ["arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64", "wasm"];
- string[] ValidOS = ["windows", "linux", "osx", "ios", "iossimulator", "maccatalyst", "browser"];
-
- Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()));
+ Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", Helpers.ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()));
Console.WriteLine();
- Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
+ Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", Helpers.ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
Console.WriteLine();
Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--type-validation", String.Join("', '", Enum.GetNames()), nameof(TypeValidationRule.Automatic)));
Console.WriteLine();
@@ -326,7 +321,7 @@ public static void PrintExtendedHelp(ParseResult _)
Console.WriteLine();
Console.WriteLine(SR.InstructionSetHelp);
- foreach (string arch in ValidArchitectures)
+ foreach (string arch in Helpers.ValidArchitectures)
{
TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
bool first = true;
@@ -359,18 +354,6 @@ public static void PrintExtendedHelp(ParseResult _)
Console.WriteLine(string.Join(", ", Internal.JitInterface.InstructionSetFlags.AllCpuNames));
}
- private static TargetArchitecture MakeTargetArchitecture(ArgumentResult result)
- {
- string firstToken = result.Tokens.Count > 0 ? result.Tokens[0].Value : null;
- if (firstToken != null && firstToken.Equals("armel", StringComparison.OrdinalIgnoreCase))
- {
- IsArmel = true;
- return Internal.TypeSystem.TargetArchitecture.ARM;
- }
-
- return Helpers.GetTargetArchitecture(firstToken);
- }
-
private static int MakeParallelism(ArgumentResult result)
{
if (result.Tokens.Count > 0)
diff --git a/src/coreclr/tools/aot/crossgen2/Program.cs b/src/coreclr/tools/aot/crossgen2/Program.cs
index 592e6bc4300669..1b7ddda01b7468 100644
--- a/src/coreclr/tools/aot/crossgen2/Program.cs
+++ b/src/coreclr/tools/aot/crossgen2/Program.cs
@@ -83,8 +83,8 @@ public int Run()
// that would cause the entire image to be invalidated.
bool isVectorTOptimistic = true;
- TargetArchitecture targetArchitecture = Get(_command.TargetArchitecture);
- TargetOS targetOS = Get(_command.TargetOS);
+ (TargetArchitecture targetArchitecture, TargetOS targetOS, TargetAbi targetAbi) =
+ Helpers.GetTargetSpec(Get(_command.TargetArchitecture), Get(_command.TargetOS));
bool allowOptimistic = _command.OptimizationMode != OptimizationMode.PreferSize;
if (targetOS is TargetOS.iOS or TargetOS.tvOS or TargetOS.iOSSimulator or TargetOS.tvOSSimulator or TargetOS.MacCatalyst or TargetOS.Browser)
@@ -100,7 +100,7 @@ public int Run()
allowOptimistic: allowOptimistic,
isReadyToRun: true);
SharedGenericsMode genericsMode = SharedGenericsMode.CanonicalReferenceTypes;
- var targetDetails = new TargetDetails(targetArchitecture, targetOS, Crossgen2RootCommand.IsArmel ? TargetAbi.NativeAotArmel : TargetAbi.NativeAot, instructionSetSupport.GetVectorTSimdVector());
+ var targetDetails = new TargetDetails(targetArchitecture, targetOS, targetAbi, instructionSetSupport.GetVectorTSimdVector());
ConfigureImageBase(targetDetails);
diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj
index f8e03ff1dc0b71..063aa3124cd217 100644
--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj
+++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj
@@ -48,14 +48,12 @@
$([MSBuild]::NormalizePath('$(Crossgen2InBuildDir)', 'crossgen2$(ExeSuffix)'))
- <_CrossGenTargetOS Condition="'$(TargetsAndroid)' != 'true'">$(TargetOS)
- <_CrossGenTargetOS Condition="'$(TargetsAndroid)' == 'true'">linux
diff --git a/src/mono/msbuild/android/build/AndroidBuild.InTree.targets b/src/mono/msbuild/android/build/AndroidBuild.InTree.targets
index ed3562c65694d2..af0dba5dd80ec6 100644
--- a/src/mono/msbuild/android/build/AndroidBuild.InTree.targets
+++ b/src/mono/msbuild/android/build/AndroidBuild.InTree.targets
@@ -33,7 +33,7 @@
diff --git a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs
index 42605de23d9f8f..d487eb995a396b 100644
--- a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs
+++ b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs
@@ -210,12 +210,13 @@ private bool GetCrossgen2TargetOS(out string targetOS)
string portablePlatform = NuGetUtils.GetBestMatchingRid(
runtimeGraph,
_targetRuntimeIdentifier,
- new[] { "linux", "osx", "win", "freebsd", "illumos" },
+ new[] { "linux", "android", "osx", "win", "freebsd", "illumos" },
out _);
targetOS = portablePlatform switch
{
"linux" => "linux",
+ "android" => "android",
"osx" => "osx",
"win" => "windows",
"freebsd" => "freebsd",