Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 6c9ab9b

Browse files
rnkarielb1
authored andcommitted
Mark functions as not having CFI once we finalize an x86 stack frame
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
1 parent bf7872f commit 6c9ab9b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/Target/X86/X86FrameLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,6 +2952,10 @@ unsigned X86FrameLowering::getWinEHParentFrameOffset(const MachineFunction &MF)
29522952

29532953
void X86FrameLowering::processFunctionBeforeFrameFinalized(
29542954
MachineFunction &MF, RegScavenger *RS) const {
2955+
// Mark the function as not having WinCFI. We will set it back to true in
2956+
// emitPrologue if it gets called and emits CFI.
2957+
MF.setHasWinCFI(false);
2958+
29552959
// If this function isn't doing Win64-style C++ EH, we don't need to do
29562960
// anything.
29572961
const Function *Fn = MF.getFunction();

test/CodeGen/X86/win64_eh_leaf.ll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ entry:
2929
; and no unwind info in the object file.
3030
; READOBJ-NOT: leaf_func
3131
}
32+
33+
define void @naked_func() naked {
34+
call void asm sideeffect "ret", ""()
35+
unreachable
36+
}
37+
; ASM-LABEL: naked_func:
38+
; ASM-NOT: .seh_
39+
; ASM: ret
40+
; ASM-NOT: .seh_

0 commit comments

Comments
 (0)