Open RalfKornmannEnvision opened 4 years ago
We have an implementation for this here:
It's used by the crossgen2 AOT compiler over in the dotnet/runtime repo (crossgen2 targets CoreCLR and generates CoreCLR's ReadyToRun assemblies, which is CoreCLR's AOT technology). CoreRT AOT compiler shares a lot of code with crossgen2.
This code is currently ifdeffed out because the NativeLibrary
API was added in .NET Core 3.0 and upgrading the build tooling in this repo to .NET Core 3.0 would be a lot of work.
We'll get this "for free" once the migration to the dotnet/runtimelab repo is completed because that build tooling already does that (hopefully, in the coming weeks). We can just mirror what crossgen2 is doing.
There's also dotnet/runtime#41126 in flight which will make it possible to build crosstargeting RyuJITs by passing flags to the root build script. The runtimelab repo will get that "for free" too.
Thanks for the information. In this case I will just use my hack a little bit longer.
If you have one or more RyuJIT variants that are compiled to generated code for a different CPU/target OS the CoreRT compiler is able to do cross compile. I successfully tested this with AMD64/Windows => AMD64/Unix and AMD64/Windows => ARM64/Unix.
But to make it actually work I ether need to replace clrjitilc with the needed variant or change the JitLibrary constant. Both solutions are not optimal.
I currently see 3 options
In any case this codepath might only be used when the host and target are different. If they are the same the current solution can still be used.