-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 exports marked functions for exe apps. #78738
NativeAOT exports marked functions for exe apps. #78738
Conversation
Functions decorated with the attribute UnmanagedCallersOnlyAttribute are not inserted in the export table of the compiled file when the .NET project is an executable (i.e., as opposed to a library). This change removes the difference between a library and an executable regarding the handling of the attribute UnmanagedCallersOnlyAttribute. As such, decorated functions with this attribute are now adequately exported for libraries and executables. Fix dotnet#78663
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDear all, This PR fixes the behavior observed in #78663. To summarize the issue, functions decorated with the attribute UnmanagedCallersOnlyAttribute are not inserted in the export table of the compiled file when the .NET project is an executable (i.e., as opposed to a library) when compiled with NativeAOT. This change removes the difference between a library and an executable regarding the handling of the attribute UnmanagedCallersOnlyAttribute. As such, decorated functions with this attribute are now adequately exported for libraries and executables.
|
FYI @agocke, @jkotas, @MichalStrehovsky. |
I do not think this behavior should be enabled by default for .exe. And in case we end up enabling by default, there should be a way to disable it. |
The usage of the attribute I think setting the property On the other hand, if you prefer an explicit opt-in (or opt-out) in the project file, I can think of adding a new tag for that particular purpose. WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request! Jan's argument in #78663 (comment) convinced me that we shouldn't do this by default. How about this? You'll be able to set <IlcExportUnmanagedEntrypoints>true</IlcExportUnmanagedEntrypoints>
to opt in. (I'm open to suggestions at naming this - we prefix properties that control not-quite-documented behaviors with Ilc
so that part is motivated by that.)
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
Outdated
Show resolved
Hide resolved
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Hello @jkotas, and @MichalStrehovsky, thanks for the review! This solution is also fine for me. :) |
The test failure is an unrelated test that got deadlettered. Infra issue. |
Thanks for the support over this PR! |
Dear all,
This PR fixes the behavior observed in #78663.
To summarize the issue, functions decorated with the attribute UnmanagedCallersOnlyAttribute are not inserted in the export table of the compiled file when the .NET project is an executable (i.e., as opposed to a library) when compiled with NativeAOT.
This change removes the difference between a library and an executable regarding the handling of the attribute UnmanagedCallersOnlyAttribute.
As such, decorated functions with this attribute are now adequately exported for libraries and executables.