Skip to content

Commit

Permalink
Mark functions as not having CFI once we finalize an x86 stack frame
Browse files Browse the repository at this point in the history
We'll set it back to true in emitPrologue if it gets called. It doesn't
get called for naked functions.

Fixes PR32912

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302092 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rnk committed May 3, 2017
1 parent 64c8cdf commit 6e53fe2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Target/X86/X86FrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2990,6 +2990,10 @@ unsigned X86FrameLowering::getWinEHParentFrameOffset(const MachineFunction &MF)

void X86FrameLowering::processFunctionBeforeFrameFinalized(
MachineFunction &MF, RegScavenger *RS) const {
// Mark the function as not having WinCFI. We will set it back to true in
// emitPrologue if it gets called and emits CFI.
MF.setHasWinCFI(false);

// If this function isn't doing Win64-style C++ EH, we don't need to do
// anything.
const Function *Fn = MF.getFunction();
Expand Down
9 changes: 9 additions & 0 deletions test/CodeGen/X86/win64_eh_leaf.ll
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ entry:
; and no unwind info in the object file.
; READOBJ-NOT: leaf_func
}

define void @naked_func() naked {
call void asm sideeffect "ret", ""()
unreachable
}
; ASM-LABEL: naked_func:
; ASM-NOT: .seh_
; ASM: ret
; ASM-NOT: .seh_

0 comments on commit 6e53fe2

Please sign in to comment.