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: Do not pass -dead_strip to the native linker #18552

Closed
Tracked by #80905 ...
ivanpovazan opened this issue Jul 12, 2023 · 1 comment
Closed
Tracked by #80905 ...

NativeAOT: Do not pass -dead_strip to the native linker #18552

ivanpovazan opened this issue Jul 12, 2023 · 1 comment
Assignees
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@ivanpovazan
Copy link
Contributor

Description

As reported in: dotnet/runtime#88032 NativeAOT can produce object files which cause the native linker to seg fault during linking when -dead_strip is enabled.

This issue is reproducible with .NET8 preview 6 release: https://github.com/xamarin/xamarin-macios/tree/release/8.0.1xx-preview6 when building MAUI Podcast app with NativeAOT, resulting with build failures.

Proposal

As a workaround, do not include -dead_strip as an optimisation switch to the native linker in case of NativeAOT runtime, so we ship a more stable product in .NET8 preview 7 release

@ivanpovazan ivanpovazan added the bug If an issue is a bug or a pull request a bug fix label Jul 12, 2023
@ivanpovazan ivanpovazan added this to the .NET 8 milestone Jul 12, 2023
@ivanpovazan ivanpovazan self-assigned this Jul 12, 2023
dalexsoto pushed a commit that referenced this issue Jul 13, 2023
#18553)

This PR disables passing `-dead_strip` to the native linker in case of
NativeAOT runtime to prevent build failures.

Additionally, this change affects the size of the application in the
following way - measured with `dotnet new maui` app version
`8.0.0-preview.7.23359.1`:

| MAUI iOS | -dead_strip | no -dead_strip | diff (b) | diff (Kb) | diff
(%) |
|----------|--------------|----------|----------|-----------|----------|
| .ipa (b) | 13377583 | 13435276 | 57693 | 57,693 | 0,43% |
| Size on disk (b) | 41883897 | 42038873 | 154976 | 154,976 | 0,37% |
| binary (b) | 39614336 | 39769312 | 154976 | 154,976 | 0,39% |

Even though the size of the application regresses, with this change we
have a more stable product.

Finally, once this PR gets merged we can open a tracking issue to solve
the size regression either by fixing:
- dotnet/runtime#88032 or
- by manually removing the dead code as proposed by @filipnavara here:
dotnet/runtime#88032 (comment)

--- 
Fixes: #18552
@ivanpovazan
Copy link
Contributor Author

Fixed by: f212f6b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

No branches or pull requests

1 participant