Skip to content

Conversation

@MichalStrehovsky
Copy link
Member

/wholearchive: is the voodoo necessary for linker to include object files from a library that are otherwise not referenced. We need to include the bootstrapper because it has an initializer to initialize runtime that we depend on.

I'm keeping the other workaround (IlcProcessEntrypoint) in place because we need it due to the main/WinMain schism for OutputType=Exe/WinExe.

The test is from the CoreRT repo.

`/wholearchive:` is the voodoo necessary for linker to include object files from a library that are otherwise not referenced. We need to include the bootstrapper because it has an initializer to initialize runtime that we depend on.

I'm keeping the other workaround (`IlcProcessEntrypoint`) in place because we need it due to the `main`/`WinMain` schism for `OutputType=Exe/WinExe`.
@MichalStrehovsky MichalStrehovsky added the area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation label Sep 18, 2020
@jkotas
Copy link
Member

jkotas commented Sep 18, 2020

Would it be better to add unresolved reference to runtime library (e.g. a dummy call in the runtime initialization) and satisfy it in the bootstrapper? It would make it work like it used to work before by accident.

@MichalStrehovsky
Copy link
Member Author

Would it be better to add unresolved reference to runtime library (e.g. a dummy call in the runtime initialization) and satisfy it in the bootstrapper? It would make it work like it used to work before by accident.

I'm indifferent about those options - turns out the /wholearchive is a common linker switch for these kinds of problems (also exists as --whole-archive on ld and -all_load on mac). Adding a dummy reference feels hackier.

@jkotas
Copy link
Member

jkotas commented Sep 18, 2020

I'm indifferent about those options

Ok, let's give the wholearchive approach a try.

jkotas added a commit to jkotas/runtimelab that referenced this pull request Oct 26, 2020
@MichalStrehovsky
Copy link
Member Author

Superseded by #270.

@MichalStrehovsky MichalStrehovsky deleted the sharedLib branch October 26, 2020 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants