HomePhabricator

X86: Don't emit zero-byte functions on Windows

Authored by hansw on Apr 21 2017, 1:58 PM.

Description

X86: Don't emit zero-byte functions on Windows

Empty functions can lead to duplicate entries in the Guard CF Function
Table of a binary due to multiple functions sharing the same RVA,
causing the kernel to refuse to load that binary.

We had a terrific bug due to this in Chromium.

It turns out we were already doing this for Mach-O in certain
situations. This patch expands the code for that in
AsmPrinter::EmitFunctionBody() and renames
TargetInstrInfo::getNoopForMachoTarget() to simply getNoop() since it
seems it was used for not just Mach-O anyway.

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

llvm-svn: 301040

Details

Committed
hanswApr 21 2017, 1:58 PM
Differential Revision
D32330: X86: Don't emit zero-byte functions on Windows
Parents
rG79873efcfb3a: Add comments to the diagnostic kinds in Diagnostic.td.
Branches
Unknown
Tags
Unknown