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

[mono][aot] Emit a list of exported methods into the AOT image and load them when the image is loaded. #82809

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

vargaz
Copy link
Contributor

@vargaz vargaz commented Mar 1, 2023

No description provided.

@ghost ghost assigned vargaz Mar 1, 2023
@vargaz vargaz added the NO-REVIEW Experimental/testing PR, do NOT review it label Mar 1, 2023
@vargaz vargaz changed the title . [mono][aot] Emit a list of exported methods into the AOT image and load them when the image is loaded. Mar 1, 2023
@vargaz vargaz removed the NO-REVIEW Experimental/testing PR, do NOT review it label Mar 1, 2023
@vargaz vargaz marked this pull request as ready for review March 1, 2023 18:37
@SamMonoRT
Copy link
Member

/cc @kotlarmilos @ivanpovazan

…ad them when the image is loaded.

If there is a runtime attach function specified, these methods can call into the runtime
before its initialized. In order for this to work, the runtime attach function needs
to load all the AOT images containing such methods, and load_aot_module () will
load and initialize these methods using the newly emitted table.
@lateralusX
Copy link
Member

lateralusX commented Mar 2, 2023

I will run this on the library builder scenario during the day and validate that it resolves the init issues.

Copy link
Member

@lateralusX lateralusX left a comment

Choose a reason for hiding this comment

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

LGTM! Ran it in both Full AOT and Full AOT + LLVM mode in a scenario where all is build into a native library, unmanagedcallersonly are exported out as entry points, library embedded in application that just call entry point, library init callback gets called that just loads the assembly and that now triggers the load of the methods marked with unmanagedcallersonly attribute, making sure all GOT and PLT slots have been initialized before continue executing the code in native-to-managed wrapper.

@vargaz
Copy link
Contributor Author

vargaz commented Mar 2, 2023

Failures are unrelated.

@vargaz vargaz merged commit aafed17 into dotnet:main Mar 2, 2023
@vargaz vargaz deleted the aot-exported-methods branch March 2, 2023 23:38
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 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.

4 participants