Skip to content

[CoreCLR] link app native runtime/library statically #9938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

grendello
Copy link
Contributor

No description provided.

@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch 7 times, most recently from e21e634 to 4e02da2 Compare March 27, 2025 11:52
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch from e15ccf6 to 9026080 Compare March 28, 2025 17:25
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch 3 times, most recently from 4aff532 to 0b7bb8c Compare April 2, 2025 20:47
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch 3 times, most recently from 96d8326 to 39031e6 Compare April 14, 2025 07:07
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch 5 times, most recently from 7cdfb21 to 86691d0 Compare April 28, 2025 07:53
jonpryor pushed a commit that referenced this pull request Apr 29, 2025
Context: #9938

PR #9938 is an attempt to build `libnet-android.Debug.so` and
`libnet-android.Release.so` so that CoreCLR is *statically linked* in
to `libnet-android*.so`.  This reduces the number of native libraries
that must be placed into the `.apk`, and allows the `.apk` to be
smaller, as the native linker can remove unused code.

*Note*: CoreCLR is ***not*** yet statically linked into
`libnet-android*.so`.  This is *preliminary* work to support that.

This iteration of static linking also requires that *all* symbols be
resolvable, by requiring `lld --no-undefined` by default.  This in
turn requires that we ship *copies* of `libc.so` et al, so that *all*
symbols needed by `libnet-android*.so` can be resolved, including
those from the Android NDK.

Update `build-tools/xaprepare` to extract required native libraries
from the NDK, and add those to the .NET for Android Workload packs.

Update `Xamarin.Android.Build.Tasks.dll` to cleanup and refactor
`ld` invocation, so that `libnet-android*.so` is built with
`ld --no-undefined`.  This makes it easier to maintain and update the
linker code in the future, as well as ensures that we use consistent
linking flags across the board.

Updates the LLVM IR code generator bits, also extracted from #9938,
which aren't strictly related to native linking, but they are placed
here in order to make #9938 smaller.
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch 2 times, most recently from 96649e1 to 75e6902 Compare May 6, 2025 08:49
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch 2 times, most recently from cc485b0 to 7059443 Compare May 13, 2025 12:00
@grendello grendello force-pushed the dev/grendel/clr-host-static-link branch from 29ac51a to bfc4af0 Compare May 16, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant