[llvm] 27c8596 - [win][x64] Unwind v2: When making headroom leave space for the header (#188368)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 09:22:03 PDT 2026
Author: Daniel Paoliello
Date: 2026-04-01T09:21:58-07:00
New Revision: 27c85964006ec45bd8215ec3271c79fbda435735
URL: https://github.com/llvm/llvm-project/commit/27c85964006ec45bd8215ec3271c79fbda435735
DIFF: https://github.com/llvm/llvm-project/commit/27c85964006ec45bd8215ec3271c79fbda435735.diff
LOG: [win][x64] Unwind v2: When making headroom leave space for the header (#188368)
When the `ensureHeadroom` call was added during unwind v2 info emission,
it didn't take into account that there is a header of 2-bytes before all
the fixups, so not enough space was actually reserved.
Added:
Modified:
llvm/lib/MC/MCWin64EH.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index e88c37d22ebea..32f701019e528 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -335,7 +335,8 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
// Emit the epilog instructions.
if (EnableUnwindV2) {
// Ensure the fixups and appended content apply to the same fragment.
- OS->ensureHeadroom(info->EpilogMap.size() * 2);
+ // size byte + flags byte + 2 per epilog (for the distance).
+ OS->ensureHeadroom(2 + info->EpilogMap.size() * 2);
bool IsLast = true;
for (const auto &Epilog : llvm::reverse(info->EpilogMap)) {
More information about the llvm-commits
mailing list