COFF: Ensure that objects produced by LLVM link with /safeseh
authorReid Kleckner <reid@kleckner.net>
Tue, 17 Sep 2013 23:18:05 +0000 (23:18 +0000)
committerReid Kleckner <reid@kleckner.net>
Tue, 17 Sep 2013 23:18:05 +0000 (23:18 +0000)
commit28860823ad34d41d4f58561dc14a982fb0843fdd
treec9accba4573b7a3d6dad99873d16f283411b017a
parentc61c8116212c68ebc81a9dc06327d6cc806b1f08
COFF: Ensure that objects produced by LLVM link with /safeseh

Summary:
We indicate that the object files are safe by emitting a @feat.00
absolute address symbol.  The address is presumably interpreted as a
bitfield of features that the compiler would like to enable.  Bit 0 is
documented in the PE COFF spec to opt in to "registered SEH", which is
what /safeseh enables.

LLVM's object files are safe by default because LLVM doesn't know how to
produce SEH handlers.

Reviewers: Bigcheese

CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1691

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190898 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/WinCOFFObjectWriter.cpp
lib/Target/X86/X86AsmPrinter.cpp
test/CodeGen/X86/coff-feat00.ll [new file with mode: 0644]
test/MC/COFF/feat00.s [new file with mode: 0644]