dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.38k stars 192 forks source link

[NativeAOT LLVM] Missing main export when using `IlcExportUnmanagedEntrypoint=true` #2433

Open maraf opened 9 months ago

maraf commented 9 months ago

If I set IlcExportUnmanagedEntrypoint=true, main is not exported. It can be fixed by adding <CustomLinkerArg Include="-Wl,--export,__main_argc_argv" />

https://github.com/dotnet/runtimelab/blob/feature/NativeAOT-LLVM/src/coreclr/tools/aot/ILCompiler/Program.cs#L590

Is it correct to add such export explicitly when IlcExportUnmanagedEntrypoint == true && NativeLib == ''?

ivanpovazan commented 9 months ago

Is the question related to the managed main?

If I am not mistaken, managed main is exposed via __managed__Main symbol

maraf commented 9 months ago

Good question. I didn't realized yesterday that I need to call the actual C# main, the one that user, possibly async, so that we can yield to JavaScript loop