[llvm] 535f604 - [MC] [Win64EH] Clarify the comment about a skipped case of packed unwind info (#169784)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 2 02:11:17 PST 2025
Author: Martin Storsjö
Date: 2025-12-02T12:11:13+02:00
New Revision: 535f604dabfb6563dab2a2478fb665699523fd0a
URL: https://github.com/llvm/llvm-project/commit/535f604dabfb6563dab2a2478fb665699523fd0a
DIFF: https://github.com/llvm/llvm-project/commit/535f604dabfb6563dab2a2478fb665699523fd0a.diff
LOG: [MC] [Win64EH] Clarify the comment about a skipped case of packed unwind info (#169784)
Clarify the comment from 924defada9bc0e3c89b0c0e288d7cb4dd654e7d4. There
is no longer any ambiguity about this case; newer versions of Windows
correctly match the documentation, making it clear that the older
versions were incorrect. Mention specific versions that have and don't
have the inconsistency.
Even if we wouldn't care about the older versions of Windows, we can't
enable this case of unwind info packing, unless the implementation also
is changed to match for asymmetrical prologs/epilogs.
Added:
Modified:
llvm/lib/MC/MCWin64EH.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index a7ce8d527250f..f5f8bbb6a3859 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -1252,14 +1252,21 @@ static bool tryARM64PackedUnwind(WinEH::FrameInfo *info, uint32_t FuncLength,
if (PAC && !FPLRPair)
return false;
int H = Nops == 4;
- // There's an inconsistency regarding packed unwind info with homed
- // parameters; according to the documentation, the epilog shouldn't have
- // the same corresponding nops (and thus, to set the H bit, we should
- // require an epilog which isn't exactly symmetrical - we shouldn't accept
- // an exact mirrored epilog for those cases), but in practice,
- // RtlVirtualUnwind behaves as if it does expect the epilogue to contain
- // the same nops. See https://github.com/llvm/llvm-project/issues/54879.
- // To play it safe, don't produce packed unwind info with homed parameters.
+ // For packed unwind info with the H bit set, the prolog and epilog
+ // actually shouldn't be symmetrical; the epilog shouldn't have any
+ // nop instructions/opcodes while the prolog has them. We currently
+ // require exactly symmetrical prologs/epilogs, which is wrong for this
+ // case - therefore, don't emit packed unwind info for this case.
+ // See https://github.com/llvm/llvm-project/issues/54879 for details.
+ //
+ // Additionally - older versions of Windows also deviated from the
+ // documentation here; older versions of Windows (at least up until
+ // 10.0.22000.2176) incorrectly did assume that the epilog has matching
+ // nop instructions. This is fixed at least in version 10.0.26100.6899.
+ // As long as we can't assume that the generated code always will run on
+ // a new enough version, don't emit the packed format here, even if the
+ // implementation would be fixed to match for the asymmetrical form
+ // according to the documentation.
if (H)
return false;
int IntSZ = 8 * RegI;
More information about the llvm-commits
mailing list