[llvm-bugs] [Bug 50312] New: llvm-objdump crash when disassemble a webassembly file which incudling bytecode "unreachable"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 12 01:08:51 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50312

            Bug ID: 50312
           Summary: llvm-objdump crash when disassemble a webassembly file
                    which incudling bytecode "unreachable"
           Product: tools
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: TableGen
          Assignee: unassignedbugs at nondot.org
          Reporter: jie.he.cn at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24852
  --> https://bugs.llvm.org/attachment.cgi?id=24852&action=edit
the wasm file causes llvm-objdump crash.

I have a wasm file, built from C code with option "-g".
To dump the bytecode, I launchs the llvm-objdump, but it gets crash.

enter the llvm-objdump code, find the crash caused by an assertion when print
the instruction "unreachable", the wrong index to access opinfo0 couldn't get
the instruction asm string.

we know, these data structures related to ISA are generated by llvm-tablegen,
thus, I track the corresponding code and td file, find that the pseudo
instructions in webassembly*.td have opcode value 0, they often occupy the
position the instruction "unreachable" should take, because the opcode of
"unreachable" is also 0.

so that, I tried to modify them to -1, and add isPseudo = 1 for some pseudo
instructions, rebuild the llvm, seems llvm-objdump works well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210512/428e00db/attachment.html>


More information about the llvm-bugs mailing list