[COFF] Add minimal support for /guard:cf
authorReid Kleckner <rnk@google.com>
Tue, 6 Feb 2018 01:58:26 +0000 (01:58 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 6 Feb 2018 01:58:26 +0000 (01:58 +0000)
commitaf2f7da74c0de997a84f7ee1cf7dc88e6e48249d
tree36fd9a31cbcc913d02a1ad235ecbb446c8c227ea
parentdc51fb49194f1ff5107e3c9913cb08b9970106a1
[COFF] Add minimal support for /guard:cf

Summary:
This patch adds some initial support for Windows control flow guard. At
the end of the day, the linker needs to synthesize a table of RVAs very
similar to the structured exception handler table (/safeseh).

Both /safeseh and /guard:cf take sections of symbol table indices
(.sxdata and .gfids$y) and turn them into RVA tables referenced by the
load config struct in the CRT through special symbols.

Reviewers: ruiu, amccarth

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D42592

llvm-svn: 324306
14 files changed:
lld/COFF/Chunks.cpp
lld/COFF/Chunks.h
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/Driver.h
lld/COFF/DriverUtils.cpp
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/Options.td
lld/COFF/Writer.cpp
lld/test/COFF/gfids-corrupt.s [new file with mode: 0644]
lld/test/COFF/gfids-fallback.s [new file with mode: 0644]
lld/test/COFF/gfids-gc.s [new file with mode: 0644]
lld/test/COFF/gfids-icf.s [new file with mode: 0644]