diff options
author | Wesley Wiser <wwiser@gmail.com> | 2024-03-27 15:05:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 15:05:58 +0000 |
commit | 58de1e2c5eee548a9b365e3b1554d87317072ad9 (patch) | |
tree | 76550c90842854462c519557ad8f4d16e1bae883 /llvm/lib/MC/MCDwarf.cpp | |
parent | 91896607ffb84561a7a2e466a00fdf1938c5bb63 (diff) | |
download | llvm-58de1e2c5eee548a9b365e3b1554d87317072ad9.zip llvm-58de1e2c5eee548a9b365e3b1554d87317072ad9.tar.gz llvm-58de1e2c5eee548a9b365e3b1554d87317072ad9.tar.bz2 |
Fix stack layout for frames larger than 2gb (#84114)
For very large stack frames, the offset from the stack pointer to a local can be more than 2^31 which overflows various `int` offsets in the frame lowering code.
This patch updates the frame lowering code to calculate the offsets as 64-bit values and resolves the overflows, resulting in the correct codegen for very large frames.
Fixes #48911
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 2ee0c3e..9b8ec9b 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -1298,8 +1298,8 @@ static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol, namespace { class FrameEmitterImpl { - int CFAOffset = 0; - int InitialCFAOffset = 0; + int64_t CFAOffset = 0; + int64_t InitialCFAOffset = 0; bool IsEH; MCObjectStreamer &Streamer; @@ -1413,7 +1413,7 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) { if (!IsEH) Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg); - int Offset = Instr.getOffset(); + int64_t Offset = Instr.getOffset(); if (IsRelative) Offset -= CFAOffset; Offset = Offset / dataAlignmentFactor; |