[PATCH] D94835: Add ehcont section support
Arlo Siemsen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 15:10:38 PST 2021
arlosi created this revision.
arlosi added reviewers: ajpaverd, thakis, rnk, theraven, pcc.
Herald added subscribers: pengfei, hiraditya, mgorny.
arlosi requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
In the future Windows will enable Control-flow Enforcement Technology (CET aka shadow stacks). To protect the path where the context is updated during exception handling, the binary is required to enumerate valid unwind entrypoints in a dedicated section which is validated when the context is being set during exception handling.
This change allows llvm to generate the section that contains the appropriate symbol references in the form expected by the msvc linker.
This feature is enabled through a new module flag, ehcontguard, which was modelled on the cfguard flag.
The change includes a test that when the module flag is enabled the section is correctly generated.
The set of exception continuation information includes funclet entrypoints as well as returns from exceptional control flow (catchret in llvm).
Funclet entrypoints are simply collected as we process exception information.
In order to collect catchret we:
1. Includes an additional flag on machine basic blocks to indicate that the given block is the target of a catchret operation,
2. Introduces a new machine function pass to insert and collect symbols at the start of each of each block, and
3. Combines these targets with the other EHCont targets that were already being collected.
Change originally authored by Daniel Frampton <dframpto at microsoft.com>
For more details, see MSVC documentation for `/guard:ehcont`
https://docs.microsoft.com/en-us/cpp/build/reference/guard-enable-eh-continuation-metadata
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94835
Files:
llvm/include/llvm/CodeGen/MachineBasicBlock.h
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/MC/MCObjectFileInfo.h
llvm/lib/CodeGen/AsmPrinter/WinException.cpp
llvm/lib/CodeGen/AsmPrinter/WinException.h
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/EHContGuardCatchret.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/AArch64/ehcontguard.ll
llvm/test/CodeGen/X86/ehcontguard.ll
llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94835.317089.patch
Type: text/x-patch
Size: 19974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210115/5c6e46a4/attachment-0001.bin>
More information about the llvm-commits
mailing list