Build an apphost with hostfxr and hostpolicy linked in#35087
Closed
lpereira wants to merge 5 commits intodotnet:masterfrom
Closed
Build an apphost with hostfxr and hostpolicy linked in#35087lpereira wants to merge 5 commits intodotnet:masterfrom
lpereira wants to merge 5 commits intodotnet:masterfrom
Conversation
|
Tagging subscribers to this area: @vitek-karas, @swaroop-sridhar |
Contributor
Author
|
Found an issue with the hostpolicy DLL. Will fix this tomorrow morning. |
Contributor
|
CC: @VSadov |
Member
|
VSadov
reviewed
Apr 17, 2020
This is part of the work to create an apphost that bundles both hostfxr and hostpolicy. The main distinction between the static and shared versions of hostfxr is that the static version contains a hostpolicy resolver that references the hostpolicy symbols directly rather than loading them from a DLL.
This change is part of the work to enable an apphost that bundles both hostfxr and hostpolicy. There's no distinction between hostpolicy that's built as a shared library and as a static library: the shared library is built by linking an empty object file with the static library.
Provide a hostfxr_iface class, that abstracts how the hostfxr functions called by the early stage in the hosting layer is resolved.
This provides two implementations of hostfxr_iface: one for the static apphost, which bundles hostfxr and hostpolicy, and another for the conventional apphost, which loads them dynamically on startup.
Member
|
I had issues with pushing commits to the original branch, so I will open another PR to continue with this: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a few changes:
I have not built this on anything other than x64 Linux.
Right now, it shouldn't work anywhere else as it requires a ld-only flag to build the shared library from the static library in a way that it doesn't throw away the whole code.(I've force-pushed some changes that should make the hostpolicy DLL be built correctly regardless of the OS, so there's a good chance this will work fine in all platforms.)The generated binary,
static_apphost, isn't currently installed anywhere. It just lives in the artifacts directory. No changes have been performed to use this when publishing an application.One of the concerns with this was about the size of the executable. This table summarizes it:
This work started out as a big overhaul in how the whole hosting layer was built, but as I'm leaving the .NET team and I ran out of time, I ended up restarting the work and opting for a far simpler solution. There are a lot of things that I'd love to have done here, and I'll be happy to discuss that with anybody that wants to continue this work.