lld-link: align sections to 16 bytes if referenced from the gfids table
authorBob Haarman <llvm@inglorion.net>
Thu, 28 Jun 2018 15:22:40 +0000 (15:22 +0000)
committerBob Haarman <llvm@inglorion.net>
Thu, 28 Jun 2018 15:22:40 +0000 (15:22 +0000)
commitc103156c606d76b4f1a8d424b2f37a423ad34c47
treecfcbaf651ea8332f3817f97e88edd7c197f38bda
parentf7ad8bfbad4a095a0b9b4378da023573ef854418
lld-link: align sections to 16 bytes if referenced from the gfids table

Summary:
Control flow guard works best when targets it checks are 16-byte aligned.
Microsoft's link.exe helps ensure this by aligning code from sections
that are referenced from the gfids table to 16 bytes when linking with
-guard:cf, even if the original section specifies a smaller alignment.
This change implements that behavior in lld-link.

See https://crbug.com/857012 for more details.

Reviewers: ruiu, hans, thakis, zturner

Subscribers: llvm-commits

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

llvm-svn: 335864
lld/COFF/Writer.cpp
lld/test/COFF/Inputs/guardcf-align-foobar.yaml [new file with mode: 0644]
lld/test/COFF/guardcf-align.s [new file with mode: 0644]