diff options
author | Andrew Paverd <andrew.paverd@microsoft.com> | 2020-10-01 10:07:40 +0100 |
---|---|---|
committer | David Chisnall <David.Chisnall@microsoft.com> | 2020-10-01 12:45:07 +0100 |
commit | ef4e971e5e18ae796466623df8f26265ba6bdfb5 (patch) | |
tree | fbe0513ea96471d4cc405b17f63708833eaeb6d9 /llvm/lib/MC/MCObjectFileInfo.cpp | |
parent | fcf70e1e3b1d57d5fde6b99d0188d1b1774429af (diff) | |
download | llvm-ef4e971e5e18ae796466623df8f26265ba6bdfb5.zip llvm-ef4e971e5e18ae796466623df8f26265ba6bdfb5.tar.gz llvm-ef4e971e5e18ae796466623df8f26265ba6bdfb5.tar.bz2 |
[CFGuard] Add address-taken IAT tables and delay-load support
This patch adds support for creating Guard Address-Taken IAT Entry Tables (.giats$y sections) in object files, matching the behavior of MSVC. These contain lists of address-taken imported functions, which are used by the linker to create the final GIATS table.
Additionally, if any DLLs are delay-loaded, the linker must look through the .giats tables and add the respective load thunks of address-taken imports to the GFIDS table, as these are also valid call targets.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D87544
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectFileInfo.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index ae7345c..eec2615 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -752,6 +752,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) { COFF::IMAGE_SCN_MEM_READ, SectionKind::getMetadata()); + GIATsSection = Ctx->getCOFFSection(".giats$y", + COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | + COFF::IMAGE_SCN_MEM_READ, + SectionKind::getMetadata()); + GLJMPSection = Ctx->getCOFFSection(".gljmp$y", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ, |