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

Commit f0a23af

Browse files
authored
Merge pull request #89 from alexcrichton/probe2
[X86] Fix SP adjustment in stack probes emitted on 32-bit Windows.
2 parents 8e1b4fe + 202adef commit f0a23af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Target/X86/X86FrameLowering.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,13 @@ void X86FrameLowering::emitStackProbeCall(MachineFunction &MF,
745745
.addReg(SP, RegState::Define | RegState::Implicit)
746746
.addReg(X86::EFLAGS, RegState::Define | RegState::Implicit);
747747

748-
if (!STI.isTargetWin32()) {
748+
if (STI.isTargetWin64() || !STI.isOSWindows()) {
749+
// MSVC x32's _chkstk and cygwin/mingw's _alloca adjust %esp themselves.
749750
// MSVC x64's __chkstk and cygwin/mingw's ___chkstk_ms do not adjust %rsp
750-
// themselves. It also does not clobber %rax so we can reuse it when
751+
// themselves. They also does not clobber %rax so we can reuse it when
751752
// adjusting %rsp.
753+
// All other platforms do not specify a particular ABI for the stack probe
754+
// function, so we arbitrarily define it to not adjust %esp/%rsp itself.
752755
BuildMI(MBB, MBBI, DL, TII.get(getSUBrrOpcode(Is64Bit)), SP)
753756
.addReg(SP)
754757
.addReg(AX);

0 commit comments

Comments
 (0)