diff options
author | Andrew Paverd <andrew.paverd@microsoft.com> | 2020-11-17 18:02:13 -0800 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2020-11-17 18:24:45 -0800 |
commit | 0139c8af8da7a89c02ed802df46492f5caddb41b (patch) | |
tree | 681a5c62ff97595cf8a5a149428b9e35d0ff396b /llvm/lib/MC/MCObjectFileInfo.cpp | |
parent | 63a8ee3ddabe633bd646ea5abb8b9fea38b3d2f2 (diff) | |
download | llvm-0139c8af8da7a89c02ed802df46492f5caddb41b.zip llvm-0139c8af8da7a89c02ed802df46492f5caddb41b.tar.gz llvm-0139c8af8da7a89c02ed802df46492f5caddb41b.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 6632220..b8c66c6 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -754,6 +754,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, |