diff options
author | Wesley Wiser <wwiser@gmail.com> | 2024-07-23 11:43:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-23 09:43:30 -0700 |
commit | ca076f7a63f6a80e2e38315ec462be354b196b8d (patch) | |
tree | e7e3bc2bf12709c54cc49029367e9cb47c4c050d /llvm/lib/MC/MCDwarf.cpp | |
parent | 5623b06f30e5e55aab0cd664af72d33c4bfa9b84 (diff) | |
download | llvm-ca076f7a63f6a80e2e38315ec462be354b196b8d.zip llvm-ca076f7a63f6a80e2e38315ec462be354b196b8d.tar.gz llvm-ca076f7a63f6a80e2e38315ec462be354b196b8d.tar.bz2 |
[LLVM] [MC] Update frame layout & CFI generation to handle frames larger than 2gb (#99263)
Rebase of #84114. I've only included the core changes to frame layout
calculation & CFI generation which sidesteps the regressions found after
merging #84114. Since these changes are a necessary precursor to the
overall fix and are themselves slightly beneficial as CFI is now
generated correctly, I think it is reasonable to merge this first step.
---
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 fixes CFI to use the corrected sizes.
After this patch, additional work is needed to fix offset truncations in
each target's codegen.
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 efafd55..1297dc3 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -1299,8 +1299,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; @@ -1414,7 +1414,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; |