Enable linker GC for Android native release builds#11504
Draft
simonrozsival wants to merge 3 commits into
Draft
Conversation
Use section splitting for common native compilation and pass --gc-sections to the linker for non-debug, non-sanitizer native builds. This mirrors the Unix native dead-code elimination pattern used by dotnet/runtime and reduces unused code in Android native runtime libraries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refresh apkdesc baselines from PR CI after enabling native linker GC sections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enable section splitting for common Android native compilation and pass
--gc-sectionsto the linker for non-Debug, non-sanitizer native builds.This is an experiment inspired by dotnet/runtime#128232.
Local validation
src/native/native-mono.csprojfor arm64 with the change.src/native/native-clr.csprojfor arm64 with the change.libmono-android.release.soandlibnet-android.release.so; exported symbol sets matched the previous local copies.Local size observation
Compared against the previous local packed arm64 runtime copies:
libmono-android.release.so:1,387,904 -> 1,276,304bytes (-111,600,-8.04%)libnet-android.release.so:1,366,776 -> 1,258,008bytes (-108,768,-7.96%)This is still a draft because broader ABI/runtime/device coverage is needed.