[PATCH] D107784: Fix SEH and IP2State table addresses for Windows
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 9 19:37:29 PDT 2021
rnk requested changes to this revision.
rnk added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/WinException.cpp:336
- Asm->OutContext);
- return MCBinaryExpr::createAdd(create32bitRef(Label),
- MCConstantExpr::create(1, Asm->OutContext),
----------------
It seems that after several rounds of refactoring, there are no comments here explaining why this happens. :(
================
Comment at: llvm/lib/CodeGen/AsmPrinter/WinException.cpp:661
AddComment("LabelStart");
OS.emitValue(getLabel(BeginLabel), 4);
AddComment("LabelEnd");
----------------
Arguably, this is the special case that opens a range but does not end one, so the modification would be here.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/WinException.cpp:955
IPToStateTable.push_back(
std::make_pair(getLabel(ChangeLabel), StateChange.NewState));
// FIXME: assert that NewState is between CatchLow and CatchHigh.
----------------
This is the other call site of getLabel for C++.
================
Comment at: llvm/test/CodeGen/WinEH/wineh-noret-cleanup.ll:49
; CXX-NEXT: .long -1
-; CXX-NEXT: .long .Ltmp0 at IMGREL+1
+; CXX-NEXT: .long .Ltmp0 at IMGREL
; CXX-NEXT: .long 1
----------------
These changes are incorrect. The C++ ip2state table doesn't have a begin/end pair, it has a series of labels. When an exception is thrown from the last instruction in a range, these labels must be strictly greater than the return address.
Fortunately, there are no single-byte instructions that can throw a C++ exception, so the entire table can be biased forwards by one byte.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107784/new/
https://reviews.llvm.org/D107784
More information about the llvm-commits
mailing list