<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/109251>109251</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            UNREACHABLE executed at llvm/tools/llvm-readobj/Win64EHDumper.cpp:97!
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          glandium
      </td>
    </tr>
</table>

<pre>
    Running `llvm-readobj -a` or `llvm-readobj --unwind` on a binary that was produced by lld, I'm getting the following:
```
Invalid unwind code
UNREACHABLE executed at /tmp/llvm/llvm/tools/llvm-readobj/Win64EHDumper.cpp:97!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /tmp/llvm/obj/bin/llvm-readobj --unwind /tmp/crashreporter-6497c44cdd21c683.exe
 #0 0x00007f9012cc1f1d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /tmp/llvm/llvm/lib/Support/Unix/Signals.inc:723:11
 #1 0x00007f9012cc240b PrintStackTraceSignalHandler(void*) /tmp/llvm/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00007f9012cc0476 llvm::sys::RunSignalHandlers() /tmp/llvm/llvm/lib/Support/Signals.cpp:105:5
 #3 0x00007f9012cc2bc5 SignalHandler(int) /tmp/llvm/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f9010f5c050 (/lib/x86_64-linux-gnu/libc.so.6+0x3c050)
 #5 0x00007f9010faae2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007f9010f5bfb2 raise ./signal/../sysdeps/posix/raise.c:27:6
 #7 0x00007f9010f46472 abort ./stdlib/abort.c:81:7
 #8 0x00007f9012b8e730 llvm::install_out_of_memory_new_handler() /tmp/llvm/llvm/lib/Support/ErrorHandling.cpp:195:0
 #9 0x000056062c9a5e70 getNumUsedSlots(llvm::Win64EH::UnwindCode const&) /tmp/llvm/llvm/tools/llvm-readobj/Win64EHDumper.cpp:102:5
#10 0x000056062c9a663d llvm::Win64EH::Dumper::printUnwindInfo(llvm::Win64EH::Dumper::Context const&, llvm::object::coff_section const*, long, llvm::Win64EH::UnwindInfo const&) /tmp/llvm/llvm/tools/llvm-readobj/Win64EHDumper.cpp:334:16
#11 0x000056062c9a6bcd llvm::Win64EH::Dumper::printRuntimeFunction(llvm::Win64EH::Dumper::Context const&, llvm::object::coff_section const*, unsigned long, llvm::Win64EH::RuntimeFunction const&) /tmp/llvm/llvm/tools/llvm-readobj/Win64EHDumper.cpp:390:1
#12 0x000056062c9a71bf llvm::Win64EH::Dumper::printData(llvm::Win64EH::Dumper::Context const&) /tmp/llvm/llvm/tools/llvm-readobj/Win64EHDumper.cpp:420:7
#13 0x000056062c7b2284 (anonymous namespace)::COFFDumper::printUnwindInfo() /tmp/llvm/llvm/tools/llvm-readobj/COFFDumper.cpp:1797:5
#14 0x000056062c980939 dumpObject(llvm::object::ObjectFile&, llvm::ScopedPrinter&, llvm::object::Archive const*) /tmp/llvm/llvm/tools/llvm-readobj/llvm-readobj.cpp:444:21
#15 0x000056062c9800d4 dumpCOFFObject(llvm::object::COFFObjectFile*, llvm::ScopedPrinter&) /tmp/llvm/llvm/tools/llvm-readobj/llvm-readobj.cpp:588:46
#16 0x000056062c97f0b5 dumpInput(llvm::StringRef, llvm::ScopedPrinter&) /tmp/llvm/llvm/tools/llvm-readobj/llvm-readobj.cpp:637:5
#17 0x000056062c97dec3 llvm_readobj_main(int, char**, llvm::ToolContext const&) /tmp/llvm/llvm/tools/llvm-readobj/llvm-readobj.cpp:720:29
#18 0x000056062c9b71e5 main /tmp/llvm/obj/tools/llvm-readobj/llvm-readobj-driver.cpp:17:3
#19 0x00007f9010f4724a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#20 0x00007f9010f47305 call_init ./csu/../csu/libc-start.c:128:20
#21 0x00007f9010f47305 __libc_start_main ./csu/../csu/libc-start.c:347:5
#22 0x000056062c799ae1 _start (/tmp/llvm/obj/bin/llvm-readobj+0x46ae1)
```
The (probably broken) file can be found at https://drive.google.com/file/d/1mMhbAX9SikIwSRXNRQA22frfazJACy6k/view?usp=sharing

Cc @mstorsjo 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WF1vnLoW_TWeF2tGxubzYR5oEtRcndvTm7S65w0ZYxg3YCPbJJn7669sJmWgyWnSE1WqGhjstdda3t5sQ40RreR8D6IPILrc0NEelN63HZW1GPtNperj_maUUsgWghh13X2_1ZzWqvoGtxTECCr944PtKB-ErP1jCSmshKT6CO2BWvhADRy0qkfGa1gdYdfVAF_Aa4CTHrbcWhfKHjhsVNepByFbQHKALgHKQYxO__zttbynnajhFAwyVfPpwddPN1f5xcf8wx9XkD9yNlpeQ2ohwIXtB4ALx3b-Y5XqzOn2SQPAxX-FjMOrj5djP3C9Y8MASJ4lAAdTkM9_XOW3V9CMVS-s0zi2UPNBaQutggdrB-OI4wLgohX2MFY7pvpl8O2g1TfOLMCFMGbkjgWksoZCsm6sufeBaWoOsKLszmrK-G4Kf2spu4P12A_f7UE7gLLPWrWa9pDqduy5tI7ED8IngZWQK9XfV26e4aNPurjexmGWsDBkdY0DFqdkxx9PnkOACYLoESGEkiZDAWYsaIIa-pAkByQ3RzNdfNZCWi_gi1MEcDoP0vShVMZqTnuAY5cZQlqAs5cWrxMVwMXtODiGABdfpXh0P4hW0s7shGSA5AkmgORBMFMNVlRxiCq44jVhfKSy7rgGOL1XogY4_8dkstSRmbngFRcUJvFztt2MckHJAJy-gcwTiymTAxQBkkczC7J2pGIRXFvwDmsRBmQpPzwPjJqIoQhBL-0E-JjGZRxuOyHHx20rx-kB2xm1iwH-gB6JmwJwNmNGS0xKOWawLAd7cJle3omuK0U_dNxtEWqFknAHcCEH2wFcnA_bec6hW7d4xo9XnKumwlBTYbjHMV4xwMXO3x1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