[android] Enable android-arm CoreCLR with softfp ABI handling#127578
[android] Enable android-arm CoreCLR with softfp ABI handling#127578simonrozsival wants to merge 33 commits into
Conversation
Enable the softfp ABI for Android ARM native/CoreCLR builds. Teach Crossgen2 to accept android as a target OS and choose the armel ABI for android-arm before normalizing the target OS to Linux for existing object and runtime behavior. Update the CoreLib, library test, SDK, and in-tree Android R2R callers to pass android/arm directly so linux-bionic RIDs keep their existing behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the android-arm CoreCLR runtime pack and CI enablement from dotnet#127225 now that the ABI handling is fixed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR re-enables android-arm (armeabi-v7a) CoreCLR runtime pack production and CI by ensuring Crossgen2/JIT agree on Android ARM32’s required softfp call-boundary ABI (modeled as armel in the type system), while keeping the rest of Crossgen2’s behavior on existing Linux/Bionic paths.
Changes:
- Teach Crossgen2 to accept
--targetos:android, and forandroid-armselect the softfp (armel) ABI then normalize the OS to Linux for the remaining pipeline. - Update Android build/plumbing to pass the real
$(TargetOS)to Crossgen2 (instead of remapping Android to Linux at the caller). - Re-enable
android_armCoreCLR runtime pack support and restore CI/Helix coverage, including Android ARM queue mapping.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs | Allows the Crossgen2 task logic to resolve android as a target OS from RID graph matching. |
| src/mono/msbuild/android/build/AndroidBuild.InTree.targets | Passes $(TargetOS) through to Crossgen2 for Android in-tree builds. |
| src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj | Stops remapping Android to Linux for Crossgen2 invocation; passes $(TargetOS) directly. |
| src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs | Adds TargetOS.Android to represent Android explicitly in target selection. |
| src/coreclr/tools/Common/CommandLineHelpers.cs | Enables parsing --targetos:android into TargetOS.Android. |
| src/coreclr/tools/aot/crossgen2/Program.cs | Implements Android normalization: select softfp (NativeAotArmel) for Android ARM32, then treat as Linux for the remaining Crossgen2 logic. |
| src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs | Updates extended help to include android as a valid --targetos value. |
| src/coreclr/crossgen-corelib.proj | Always passes --targetos:$(TargetOS) (removes Android→Linux remap at the caller). |
| src/coreclr/clrdefinitions.cmake | Defines ARM_SOFTFP for Android ARM32 targets so native/JIT compilation agrees on softfp. |
| eng/testing/tests.readytorun.targets | Passes $(TargetOS) to Crossgen2 for test R2R flows (removes Android→Linux remap). |
| eng/Subsets.props | Re-enables CoreCLR support gating for Android ARM32 (still excludes Android x86). |
| eng/pipelines/runtime.yml | Re-adds android_arm CoreCLR functional test coverage in the main pipeline matrix. |
| eng/pipelines/extra-platforms/runtime-extra-platforms-android.yml | Adds android_arm CoreCLR coverage in the extra-platforms Android pipeline. |
| eng/pipelines/coreclr/templates/helix-queues-setup.yml | Adds Helix queue mapping for the android_arm platform. |
| eng/native/configureplatform.cmake | Sets ARM_SOFTFP for Android ARM32 at CMake configuration time. |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Note This CI analysis comment was drafted with Copilot. I compared the current CI on #127578 with the original Android ARM runtime-pack enablement PR, #127225, and the first softfp follow-up, #127527. My read is that the original Android ARM ABI mismatch is not manifesting in the current run: the exact smoke job that exposed it before now passes.
Current Android pass/fail breakdown:
Failure classification:
I also searched the current downloaded Android AzDO/Helix logs for the old ABI signatures: So I would not treat the current red CI as evidence that the original Android ARM ABI mismatch is still present. The important ABI validation signal passed; the remaining Android failures are later library/test-suite issues, mostly already represented by known mobile issues, with the NativeAOT |
Keep Android as Linux for Crossgen2 and pass armel from in-tree MSBuild callers so the compiler selects the softfp ABI without making Android a first-class Crossgen2 OS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Align the Android ARM Crossgen2 remap with the existing _CrossGenTargetOS naming pattern and use _CrossGenTargetArch for the architecture remap. Keep the Android in-tree target simpler by hardcoding Crossgen2 TargetOS metadata to linux. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment out android_arm platform until issue is resolved.
Move the Android ARM softfp define to gen-buildsys.sh so the regular Android ARM native build gets the CMake ARM_SOFTFP variable before CoreCLR target definitions are applied. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| buildConfig: Release | ||
| runtimeFlavor: coreclr | ||
| platforms: | ||
| - android_arm |
| if (TARGETDETAILS_ARCH STREQUAL "armel" OR | ||
| (TARGETDETAILS_ARCH STREQUAL "arm" AND CLR_CMAKE_TARGET_ANDROID)) | ||
| target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ARM_SOFTFP) |
There was a problem hiding this comment.
For Android arm, configureplatform.cmake only sets the global ARM_SOFTFP variable for armel
We should fix configureplatform.cmake to set ARM_SOFTFP for Android as well.
set(CLR_CMAKE_TARGET_ANDROID 1)
if (CLR_CMAKE_TARGET_ARCH_ARM)
set(ARM_SOFTFP 1)
endif(CLR_CMAKE_TARGET_ARCH_ARM)
endif(CLR_CMAKE_TARGET_OS STREQUAL android)
|
|
||
| # | ||
| # Android arm64 devices and x64 emulators | ||
| # Android arm/arm64 devices and x64 emulators |
| targetOS = portablePlatform switch | ||
| { | ||
| "linux" => "linux", | ||
| "android" => "android", |
There was a problem hiding this comment.
This should be ported to SDK clone of this task once the PR is merged. (Check readme in this directory.)
Note
This PR description was updated with GitHub Copilot.
Fixes #127500.
Description
This re-enables the
android-armCoreCLR runtime pack and CI coverage, and fixes the Android ARM softfp ABI handling needed for native code, ReadyToRun/Crossgen2-generated code, and NativeAOT target handling.Android
armmaps to thearmeabi-v7aABI. That ABI can use VFP instructions internally, but floating-point arguments and return values cross function-call boundaries through core registers/stack rather than VFP argument registers. In .NET target terminology, the matching AOT/JIT ABI isarmel.The original enablement exposed runtime crashes caused by parts of the build and code-generation pipeline disagreeing on that ABI. Native/CoreCLR builds needed
ARM_SOFTFP, and AOT compiler target handling needed to treat Android ARM as Linux/Bionic with the softfp ABI.Changes
Re-enable
android-armas a supported CoreCLR runtime pack target.Re-enable Android ARM CoreCLR legs in the runtime and extra-platform CI pipelines.
Add Android ARM Helix queue selection.
Set
ARM_SOFTFPfor Android ARM native/CoreCLR builds.Treat Android ARM compile definitions as softfp when setting CoreCLR target definitions.
Keep Android as an accepted AOT command-line target OS without extending the internal
TargetOSenum.Centralize Android command-line normalization in both Crossgen2 and NativeAOT ILCompiler:
Update Crossgen2 call sites to pass the real Android target identity instead of duplicating Android-to-Linux remaps in MSBuild.
Update NativeAOT build integration to pass
--targetos:androidthrough to ILCompiler while preserving the existing bionic ARMarmeltarget-architecture handling.Validation
Built Android ARM locally:
Result:
Validated on a physical Android device with
armeabi-v7asupport.The following Android ARM test runs completed with zero failures with both
TestReadyToRun=trueandTestReadyToRun=false:System.Runtime.TestsSystem.Runtime.Numerics.TestsSystem.Numerics.Vectors.TestsSystem.Numerics.Tensors.TestsMicrosoft.Bcl.Numerics.TestsAdditional validation for the centralized AOT target handling:
Also smoke-tested that both Crossgen2 and ILCompiler accept Android target arguments, including
--targetos:android --targetarch:armand--targetos:android --targetarch:arm64, and that the existing--targetos:linux --targetarch:armelnormalization still works.