aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/WinCOFFObjectWriter.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-11-26 00:34:47 +0200
committerMartin Storsjö <martin@martin.st>2022-06-01 11:25:49 +0300
commit298e9cac9204b788dd6a18dba669b40acf2aaa3c (patch)
treecdb581b2fbb7538e5ce22593fcb6e027dc083b55 /llvm/lib/MC/WinCOFFObjectWriter.cpp
parentd4022ff3310635f682e9937c8ffa4aeb0d2e2854 (diff)
downloadllvm-298e9cac9204b788dd6a18dba669b40acf2aaa3c.zip
llvm-298e9cac9204b788dd6a18dba669b40acf2aaa3c.tar.gz
llvm-298e9cac9204b788dd6a18dba669b40acf2aaa3c.tar.bz2
[MC] [Win64EH] Check that the SEH unwind opcodes match the actual instructions
It's a fairly common issue that the generating code incorrectly marks instructions as narrow or wide; check that the instruction lengths add up to the expected value, and error out if it doesn't. This allows catching code generation bugs. Also check that prologs and epilogs are properly terminated, to catch other code generation issues. Differential Revision: https://reviews.llvm.org/D125647
Diffstat (limited to 'llvm/lib/MC/WinCOFFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WinCOFFObjectWriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp
index 1de1532..33e496b 100644
--- a/llvm/lib/MC/WinCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp
@@ -958,7 +958,7 @@ void WinCOFFObjectWriter::assignFileOffsets(MCAssembler &Asm,
for (const auto &Section : Asm) {
COFFSection *Sec = SectionMap[&Section];
- if (Sec->Number == -1)
+ if (!Sec || Sec->Number == -1)
continue;
Sec->Header.SizeOfRawData = Layout.getSectionAddressSize(&Section);