[llvm] r346440 - [ARM64] [Windows] Improve error reporting for unsupported SEH unwind.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 8 13:20:52 PST 2018


Author: efriedma
Date: Thu Nov  8 13:20:52 2018
New Revision: 346440

URL: http://llvm.org/viewvc/llvm-project?rev=346440&view=rev
Log:
[ARM64] [Windows] Improve error reporting for unsupported SEH unwind.

Use report_fatal_error instead of crashing or miscompiling. (It's
currently easier than it should be to hit this case because we don't
reuse codes across epilogs.)


Modified:
    llvm/trunk/lib/MC/MCWin64EH.cpp

Modified: llvm/trunk/lib/MC/MCWin64EH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCWin64EH.cpp?rev=346440&r1=346439&r2=346440&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCWin64EH.cpp (original)
+++ llvm/trunk/lib/MC/MCWin64EH.cpp Thu Nov  8 13:20:52 2018
@@ -487,8 +487,8 @@ static void ARM64EmitUnwindInfo(MCStream
 
   // Code Words, Epilog count, E, X, Vers, Function Length
   uint32_t row1 = 0x0;
-  uint8_t CodeWords = TotalCodeBytes / 4;
-  uint8_t CodeWordsMod = TotalCodeBytes % 4;
+  uint32_t CodeWords = TotalCodeBytes / 4;
+  uint32_t CodeWordsMod = TotalCodeBytes % 4;
   if (CodeWordsMod)
     CodeWords++;
   uint32_t EpilogCount = info->EpilogMap.size();
@@ -505,6 +505,11 @@ static void ARM64EmitUnwindInfo(MCStream
 
   // Extended Code Words, Extended Epilog Count
   if (ExtensionWord) {
+    // FIXME: We should be able to split unwind info into multiple sections.
+    // FIXME: We should share epilog codes across epilogs, where possible,
+    // which would make this issue show up less frequently.
+    if (CodeWords > 0xFF || EpilogCount > 0xFFFF)
+      report_fatal_error("SEH unwind data splitting not yet implemented");
     uint32_t row2 = 0x0;
     row2 |= (CodeWords & 0xFF) << 16;
     row2 |= (EpilogCount & 0xFFFF);




More information about the llvm-commits mailing list