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

[runtime/tools] Implement finding native support libraries when linking statically. Fixes #10950, #11145 and #12100. #12323

Merged
merged 2 commits into from
Aug 3, 2021

Conversation

rolfbjarne
Copy link
Member

  • Add support for Mono Components.

  • Modify how we look up symbols from native libraries shipped with Mono: we keep
    track of which native libraries we linked with, and depending on how we linked
    to those assemblies, we look the symbols up at runtime in either the current executable
    (if linking statically), or the actual library (where the P/Invoke says they're
    supposed to be).

  • This means that we have to propagate how libmono is linked from the MSBuild code
    to the Application class so that our existing logic is able to correctly determine
    which native mono lib to use.

  • Modify how we list the P/Invokes we need to preserve by taking into account the
    list of native libraries from Mono we have to link with (for .NET). For legacy
    Xamarin, I've reverted the logic to how it was before we started adding .NET support.

Fixes #10950.
Fixes #11145.
Fixes #12100.

…ng statically. Fixes xamarin#10950, xamarin#11145 and xamarin#12100.

* Add support for Mono Components.

* Modify how we look up symbols from native libraries shipped with Mono: we keep
  track of which native libraries we linked with, and depending on how we linked
  to those assemblies, we look the symbols up at runtime in either the current executable
  (if linking statically), or the actual library (where the P/Invoke says they're
  supposed to be).

* This means that we have to propagate how libmono is linked from the MSBuild code
  to the Application class so that our existing logic is able to correctly determine
  which native mono lib to use.

* Modify how we list the P/Invokes we need to preserve by taking into account the
  list of native libraries from Mono we have to link with (for .NET). For legacy
  Xamarin, I've reverted the logic to how it was before we started adding .NET support.

Fixes xamarin#10950.
Fixes xamarin#11145.
Fixes xamarin#12100.
@rolfbjarne rolfbjarne added not-notes-worthy Ignore for release notes run-dotnet-tests Run all the .NET tests labels Aug 2, 2021
@SamMonoRT
Copy link

@rolfbjarne @spouliot - do we know roughly any size gains, and/or startup perf impact if any ?

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

4 tests failed, 114 tests passed.

Failed tests

  • monotouch-test/Mac [dotnet]/Debug (CoreCLR) [dotnet]: BuildFailure
  • monotouch-test/Mac [dotnet]/Debug (CoreCLR, static registrar) [dotnet]: BuildFailure
  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2629 Passed: 2490 Inconclusive: 35 Failed: 1 Ignored: 138)
  • DotNet tests: Failed (Execution failed with exit code 1)

Pipeline on Agent XAMBOT-1101.BigSur
Merge a04302d into 0f15240

Copy link
Contributor

@spouliot spouliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

1 tests failed, 117 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2629 Passed: 2489 Inconclusive: 35 Failed: 2 Ignored: 138)

Pipeline on Agent XAMBOT-1101.BigSur'
Merge 9b64eb6 into 8bfa366

@rolfbjarne
Copy link
Member Author

Test failure is unrelated (https://github.com/xamarin/maccore/issues/2443).

@rolfbjarne
Copy link
Member Author

@rolfbjarne @spouliot - do we know roughly any size gains, and/or startup perf impact if any ?

I would be quite surprised if this had any measurable startup perf impact, the only new thing we do now are a few string comparisons.

I haven't done any size measurements, so I don't know the size gain (if any) there.

@rolfbjarne rolfbjarne merged commit eafe528 into xamarin:main Aug 3, 2021
@rolfbjarne rolfbjarne deleted the dotnet-pinvoke-lookup branch August 3, 2021 15:07
@spouliot
Copy link
Contributor

spouliot commented Aug 3, 2021

@SamMonoRT the size impact seems minimal between this commit and the previous one

Directories / Files Previous Commit This Commit diff %
./_CodeSignature
./
    embedded.mobileprovision 12,391 12,391 0 0.0%
    icudt.dat 1,913,136 1,913,136 0 0.0%
    Info.plist 1,057 1,057 0 0.0%
    MySingleView 7,720,544 7,717,344 -3,200 -0.0%
    MySingleView.aotdata.arm64 792 792 0 0.0%
    MySingleView.dll 4,608 4,608 0 0.0%
    PkgInfo 8 8 0 0.0%
    runtimeconfig.bin 733 733 0 0.0%
    System.Private.CoreLib.aotdata.arm64 729,656 729,656 0 0.0%
    System.Private.CoreLib.dll 772,608 772,608 0 0.0%
    System.Runtime.aotdata.arm64 504 504 0 0.0%
    System.Runtime.dll 5,120 5,120 0 0.0%
    Xamarin.iOS.aotdata.arm64 48,360 48,360 0 0.0%
    Xamarin.iOS.dll 73,728 73,728 0 0.0%
Statistics
Native subtotal 8,499,856 8,496,656 -3,200 -0.0%
    Executable 7,720,544 7,717,344 -3,200 -0.0%
    AOT data 779,312 779,312 0 0.0%
Managed *.dll/exe 856,064 856,064 0 0.0%
TOTAL 11,289,162 11,285,962 -3,200 -0.0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-notes-worthy Ignore for release notes run-dotnet-tests Run all the .NET tests
Projects
None yet
5 participants