Repository navigation
Support/jitlink coff seh #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ikappaki
wants to merge
25
commits into
lhames:windows-easy-eh-plugin
Choose a base branch
from
ikappaki:support/jitlink-coff-seh
base: windows-easy-eh-plugin
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
296a6d1
apply msys2 patches, correct plugin windows.h header
ikappaki 2019be5
[ORC] Enable JITLink by default for x86_64 COFF targets
ikappaki 8fcef75
[JITLink][COFF] Resolve __ImageBase before ADDR32NB lowering
ikappaki 5bb9763
[JITLink][COFF] Add GOT/PLT stub support for ext calls in COFFx86_64
ikappaki f9f8a22
[JITLink][COFF] Add ADDR32NB stubs for image rel refs to externals
ikappaki aa807e6
fixup! [JITLink][COFF] Resolve __ImageBase before ADDR32NB lowering
ikappaki 59c2bca
[JITLink][COFF] Fix missing symbol reg for COMDAT sect def symbols
ikappaki f226c46
[ORC] Set OverrideObjectFlags for JITLink on COFF
ikappaki 8327fd8
[ORC] Add SEHFrameRegistrationPlugin for Windows COFF x86_64
ikappaki 905aef3
[ORC] Add filterd DLLImportDefinitionGenerator for COFF gen platform
ikappaki 4198c16
[JITLink][ORC] Extend SEHFrameKeepAlivePass and registration for COMD…
ikappaki 1b574b0
[JITLink][COFF] Remove dead findDefinedSymbolByName call from GetImag…
ikappaki 13c2f43
[ORC] Add end-to-end SEH integration tests for COFF x86_64
ikappaki 137a555
[JITLink][COFF] Add GOT/Stubs optimizer pass for COFF x86_64
ikappaki 45b892f
[ORC] Fix crash in SEHFrameRegistrationPlugin on dead-stripped COMDAT…
ikappaki 713a692
[JITLink][COFF] Migrate COFF x86_64 edge kinds to generic EdgeKind_x8…
ikappaki 5b0d332
[JITLink][COFF] Synthesize __imp_ IAT entries (#203906)
mkovacevic99 0022615
[ORC] Remove DLLImportDefinitionGenerator filter, superseded by JITLi…
ikappaki ba9c711
[JITLink][COFF] Declare buildTables and synthesizeIATEntries in COFF_…
ikappaki 9405b95
Revert MSYS2 distro patches (out of scope for upstream)
ikappaki 8b79c2b
[JITLink][COFF] Move __ImageBase resolution to PostAllocationPass
ikappaki 4f138de
[ORC] Add release note for JITLink default on COFF x86_64
ikappaki ea9e72f
[JITLink][COFF][test] Replace IR imagebase test with assembly jitlink…
ikappaki f098c39
[JITLink][COFF] Remove SectionIdx16 edge kind, emit Pointer16 directly
ikappaki b2d3965
[JITLink][COFF] Define COFFIATSectionName constant in COFF.h
ikappaki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
52 changes: 52 additions & 0 deletions
52
llvm/include/llvm/ExecutionEngine/Orc/SEHFrameRegistrationPlugin.h
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //===- SEHFrameRegistrationPlugin.h - Register COFF EH info in-process -*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Register and deregister .pdata sections in-process using RtlAddFunctionTable | ||
| // and RtlDeleteFunctionTable. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_EXECUTIONENGINE_ORC_SEHFRAMEREGISTRATIONPLUGIN_H | ||
| #define LLVM_EXECUTIONENGINE_ORC_SEHFRAMEREGISTRATIONPLUGIN_H | ||
|
|
||
| #include "llvm/ExecutionEngine/Orc/LinkGraphLinkingLayer.h" | ||
|
|
||
| namespace llvm::orc { | ||
|
|
||
| /// Registers .pdata sections with the Windows unwinder via RtlAddFunctionTable. | ||
| /// | ||
| /// This plugin enables SEH-based stack unwinding for JIT'd code on Windows | ||
| /// by registering unwind metadata at finalization and deregistering it on | ||
| /// deallocation. | ||
| class LLVM_ABI SEHFrameRegistrationPlugin : public LinkGraphLinkingLayer::Plugin { | ||
| public: | ||
| /// Adds a pass to PassConfig that registers .pdata sections in LG with the | ||
| /// OS unwinder. | ||
| void modifyPassConfig(MaterializationResponsibility &MR, | ||
| jitlink::LinkGraph &LG, | ||
| jitlink::PassConfiguration &PassConfig) override; | ||
|
|
||
| Error notifyFailed(MaterializationResponsibility &MR) override { | ||
| return Error::success(); | ||
| } | ||
|
|
||
| Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override { | ||
| return Error::success(); | ||
| } | ||
|
|
||
| void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, | ||
| ResourceKey SrcKey) override {} | ||
|
|
||
| /// Registers .pdata sections in G with the OS unwinder. | ||
| /// Returns an error if registration setup fails. | ||
| Error registerFrameInfo(jitlink::LinkGraph &G); | ||
| }; | ||
|
|
||
| } // namespace llvm::orc | ||
|
|
||
| #endif // LLVM_EXECUTIONENGINE_ORC_SEHFRAMEREGISTRATIONPLUGIN_H |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but we should try to share the logic here with COFFAutoImportGenerator.cpp if possible (CC @mkovacevic99, who wrote that class).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did you have in mind to merge here? The only possibility I see here is to create a shared function that will create and IAT pointer slot and call it instead of CreatePointer(*G, Sec, &Target, 0)/createAnonymousPointer(G, IATSec, Target).
This pattern is also called inside DLLImportDefinitionGenerator (I have added a FIXME comment for COFFAutoImportGenerator)