Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

IJW Host #5185

Merged
merged 52 commits into from
Mar 20, 2019
Merged

IJW Host #5185

merged 52 commits into from
Mar 20, 2019

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Feb 15, 2019

Add a hosting shim for IJW assemblies on Windows.

When an IJW assembly is loaded, the shim will swap out the tokens in the vtfixup table with delayed-activation thunks that activate the runtime when called (to avoid the Windows Loader Lock). The shim also provides an entry-point to resolve these delayed-activation thunks back to tokens for the case where the IJW assembly is being loaded from managed code.

IJW executables will be built into DLLs (same as the rest of the .NET Core ecosystem), so we don't need any additional entrypoints.

cc: @jkotas @jeffschwMSFT @sdmaclea

See dotnet/coreclr#22636 for the runtime component.

…ET Core host. Functions that use runtime data structures are stubbed out.
…lidation, just enough to ensure that the assembly is a .NET assembly.
…rchitecture, so we don't need to branch on architecture.
…ectly handle an empty TPA when appending S.P.CL. Pass app-path to delegate.
@AaronRobinsonMSFT
Copy link
Member

cc @elinor-fung

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

I think we need to figure out the error handling (Specifically writing errors to stderr).

src/corehost/cli/ijwhost/ijwthunk.cpp Show resolved Hide resolved
src/corehost/cli/ijwhost/ijwhost.cpp Show resolved Hide resolved
src/corehost/cli/ijwhost/ijwhost.cpp Show resolved Hide resolved
Documentation/design-docs/IJW-activation.md Outdated Show resolved Hide resolved
Documentation/design-docs/IJW-activation.md Outdated Show resolved Hide resolved
Documentation/design-docs/IJW-activation.md Outdated Show resolved Hide resolved
Documentation/design-docs/IJW-activation.md Outdated Show resolved Hide resolved
src/corehost/cli/fxr_resolver.cpp Outdated Show resolved Hide resolved
src/corehost/cli/ijwhost/ijwthunk.cpp Show resolved Hide resolved
src/corehost/cli/ijwhost/ijwthunk.cpp Outdated Show resolved Hide resolved
src/corehost/cli/ijwhost/ijwthunk.cpp Outdated Show resolved Hide resolved
src/corehost/cli/ijwhost/ijwthunk.cpp Outdated Show resolved Hide resolved
src/settings.cmake Outdated Show resolved Hide resolved
@jkoritzinsky jkoritzinsky merged commit bc7bcc6 into dotnet:master Mar 20, 2019
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* First pass porting mscoree/mscoreei's IJW hosting hooks into a new .NET Core host. Functions that use runtime data structures are stubbed out.

* Use Windows heap functions for allocating executable memory.

* Add IJW activation design document.

* Add talking point about loading dependencies from *.deps.json* files and what work needs to be done for those.

* Clean up design doc.

* Update design doc.

* Feedback.

* Clean up the PEDecoder since we don't need to port over all of the validation, just enough to ensure that the assembly is a .NET assembly.

* The OS will verify that the IJW image and the IJW host are the same architecture, so we don't need to branch on architecture.

* Clean up ijwhost and PEDecoder code based on review feedback.

* Refactor corehost.cpp and add implementations of functions to fetch IJW delegates from hostfxr.

* Move hostfxr resolution into separate file and make corehost only relevant for the exe hosts.

* Make get_latest_fxr local to fxr_resolver.cpp

* Implement fxr wire-up for ijwhost.

* Rvas are already mapped for loaded images.

* Don't use stubs if being loaded into currently running runtime.

* Update IJW activation doc based on updated info about callbacks.

* Implement token resolution from thunks. Fix calling a users native entry-point from _CorDllMain.

* Correctly resolve side-by-side hostfxr from ijwhost and comhost. Correctly handle an empty TPA when appending S.P.CL. Pass app-path to delegate.

* Update design doc.

* Remove unneeded validation.

* Fix assembler selection for ARM/ARM64.

* Fix indentation.

* Remove dead code in PEDecoder.

* Fix missing CommandLineToArgvW symbol in arm/arm64 builds.

* Fix ARM/ARM64 build by bringing over custom arm assembler supporting cmake from coreclr.

* Remove IJWBootstrapThunk opaque class. Rename all non-exported apis to match the snake_case convention in this repo.

* Remove exports.cpp files per pr feedback.

* Use an enum to specify which delegate to load from the runtime in the hostfxr<->hostpolicy API.

* Fix x86 build

* Make x86 implementation of get_thunk_from_cookie clearer.

* Symbol export changes needed for x86 as found by testing.

* Remove ijw-exe-specific path.

* clean up ijwhost.cpp since we only have one entrypoint into hostfxr from ijwhost now.

* Use enum for delegate getter in hostfxr-exposed api as well.

* PR Feedback.

* Add ijwhost to Microsoft.NetCore.DotNetAppHost package.

* Setup tracing on comhost and ijwhost entry points.

* PR Feedback.

* Remove IsILOnly checks.

* Clean up design doc.

* More cleanup on IJW activation design doc

* swallow tracing on IJW. Remove as much of corhdr.h as possible.

* Fix bad copy-paste in the install command in ijwhost cmake script.

* Fix cmake

* Add error message to trace for failure to find the "corehost_get_coreclr_delegate" entrypoint.

* Sign ijwhost. Fixes dotnet/core-setup#5485.


Commit migrated from dotnet/core-setup@bc7bcc6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants