1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-25 06:35:46 +00:00

Fix llvm x86 frame lowering for -msave-args

The problem only shows up with KASAN builds where it causes registers
saved below SP leading to fills not finding what was spilled.

go for it dlg@
This commit is contained in:
gnezdo
2025-11-14 09:57:02 +00:00
parent 5da4765bbb
commit 077d2ea485

View File

@@ -2576,8 +2576,8 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
if (TRI->hasStackRealignment(MF))
MBBI = FirstCSPop;
unsigned SEHFrameOffset = calculateSetFPREG(SEHStackAllocAmt);
uint64_t LEAAmount =
IsWin64Prologue ? SEHStackAllocAmt - SEHFrameOffset : -CSSize;
uint64_t LEAAmount = IsWin64Prologue ? SEHStackAllocAmt - SEHFrameOffset
: -(CSSize + X86FI->getSaveArgSize());
if (X86FI->hasSwiftAsyncContext())
LEAAmount -= 16;
@@ -2726,7 +2726,7 @@ StackOffset X86FrameLowering::getFrameIndexReference(const MachineFunction &MF,
"FPDelta isn't aligned per the Win64 ABI!");
}
if (FI >= 0)
if (FI >= 0 && FrameReg != TRI->getStackRegister())
Offset -= X86FI->getSaveArgSize();
if (FrameReg == TRI->getFramePtr()) {