Skip to content
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

NativeAOT: re-enable dead stripping #18605

Closed
Tracked by #80905
rolfbjarne opened this issue Aug 1, 2023 · 4 comments
Closed
Tracked by #80905

NativeAOT: re-enable dead stripping #18605

rolfbjarne opened this issue Aug 1, 2023 · 4 comments
Labels
app-size dotnet-external-dependency .NET: this issue/pull request is blocked on external work enhancement The issue or pull request is an enhancement performance If an issue or pull request is related to performance
Milestone

Comments

@rolfbjarne
Copy link
Member

We've disabled passing -dead_strip to ld for NativeAOT:

It should be re-enabled once this is fixed:

@ivanpovazan
Copy link
Contributor

Once dotnet/runtime@d9a6607 flows in, we should try enable -dead_strip by default with NativeAOT.

@akoeplinger
Copy link
Member

Is xamarin-macios still using ld_classic? then I assume it'd still be affected by dotnet/runtime#88032

@ivanpovazan
Copy link
Contributor

ivanpovazan commented Jun 14, 2024

Is xamarin-macios still using ld_classic? then I assume it'd still be affected by dotnet/runtime#88032

Yes ld_classic is still used (this will have to be fixed as the option is getting removed by Apple in XCode 16).

dotnet/runtime#88032 reported an issue that occasionally monotouch-test crashes the platform linker. However, at that time object file produced by NativeAOT was not marking all symbols as non-strippable.

The idea is to try turning -dead_strip back on and track if it is going to cause any failures.

rolfbjarne pushed a commit that referenced this issue Jul 3, 2024
…ault (#20796)

### Description

NativeAOT now properly marks all symbols as non-deadstrippable in the object file it generates: dotnet/runtime@d9a6607
And uses `-dead_strip` as the default build option.

In this PR we are doing the same - reenabling the `-dead_strip` as the default platform linker switch.
This reverts previous workaround introduced in: f212f6b 

### Size savings

| MySingleView | Main | This PR | diff (%) |
|--------------|------|---------|----------|
| SOD (MB)     | 2,87 | 2,70    | -5,99%   |
|,ipa (MB)    | 1,22 | 1,17    | -4,61%   |

Even though this brings `4-5%` size reduction for a MySingleView app, the size savings are not proportional to the app size, as the savings are coming from stripping native libraries only. 
Based on measurements reported in dotnet/runtime@d9a6607 the actual expected savings for a MAUI app are around `~1.5%`.

---
Fixes #18605 and dotnet/runtime#88032

---------

Co-authored-by: Ivan Povazan <ivan.povazan@gmail.com>
@rolfbjarne
Copy link
Member Author

Fixed in #20796.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-size dotnet-external-dependency .NET: this issue/pull request is blocked on external work enhancement The issue or pull request is an enhancement performance If an issue or pull request is related to performance
Projects
Status: Done
Development

No branches or pull requests

3 participants