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] Support exporting methods from referenced assemblies in a formal way #83396

Merged
merged 20 commits into from
Mar 22, 2023

Conversation

ivanpovazan
Copy link
Member

@ivanpovazan ivanpovazan commented Mar 14, 2023

This PR adds support for exporting methods from referenced assemblies in a more controllable way.

The changes include:

  1. UnmanagedEntryPointsAssembly - new ItemGroup which can be used to include names of assemblies for which unmanaged entry points have to be exported
  2. --generateunmanagedentrypoints- new ILCompiler switch which can be used to pass the list of assemblies for which methods have to be exported and is populated with items from 1.
  1. Test case which verifies the added functionality
  2. Exporting unmanaged entry points from the system module is now achieved by explicitly including System.Private.CoreLib in 1.
  3. Includes --export-dynamic native linker switch in the build, when it is required to dynamically access exported symbols from the main executable targeting linux systems (more information here)

Fixes #65755

@ghost
Copy link

ghost commented Mar 14, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR adds support for exporting methods from referenced assemblies in a more controllable way.

The changes include:

  • new ItemGroup: IlcRootedAssembliesExports which can be used to include names of assemblies for which methods have to be exported
  • new ILCompiler switch: --rootedassembliesexports which can be used to pass the list of assemblies for which methods have to be exported (and is populated with the above-mentioned ItemGroup)
  • the feature is enabled in the library and CustomNativeMain compilation modes.
  • test case which verifies the added functionality

NOTE: It is possible that the naming is not ideal and I am open for any suggestions.


Fixes #65755

Author: ivanpovazan
Assignees: ivanpovazan
Labels:

area-NativeAOT-coreclr

Milestone: -

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@ivanpovazan ivanpovazan merged commit b69b359 into dotnet:main Mar 22, 2023
@ivanpovazan ivanpovazan deleted the exports-from-ref-assemblies branch March 22, 2023 09:08
@ghost ghost locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NativeAOT: Export native methods from referenced assemblies.
4 participants