[llvm-objdump][WebAssembly] Fix llvm-objdump on files without symbols
authorAndy Wingo <wingo@igalia.com>
Wed, 7 Jul 2021 09:13:13 +0000 (11:13 +0200)
committerAndy Wingo <wingo@igalia.com>
Mon, 19 Jul 2021 06:59:26 +0000 (08:59 +0200)
commitdb69ea40a91a683a4b1a2d581c5b5a2b46154677
tree8c7766b79e417e63f1722a48e2b6079c84b686d7
parent4504e1134c9118f3c322685f8a90129e09bab92c
[llvm-objdump][WebAssembly] Fix llvm-objdump on files without symbols

If a file has no symbols, perhaps because it is a linked executable,
synthesize some symbols by walking the code section.  Otherwise the
disassembler will try to treat the whole code section as a function,
which won't parse.  Fixes https://bugs.llvm.org/show_bug.cgi?id=50957.

Differential Revision: https://reviews.llvm.org/D105539
llvm/test/tools/llvm-objdump/wasm/executable-without-symbols-debugnames.test [new file with mode: 0644]
llvm/test/tools/llvm-objdump/wasm/executable-without-symbols.test [new file with mode: 0644]
llvm/tools/llvm-objdump/llvm-objdump.cpp