[WebAssembly][lld] Fix crash when applying relocations to debug sections
authorSam Clegg <sbc@chromium.org>
Tue, 20 Aug 2019 18:39:24 +0000 (18:39 +0000)
committerSam Clegg <sbc@chromium.org>
Tue, 20 Aug 2019 18:39:24 +0000 (18:39 +0000)
commitcf2b8722d4e3bc4f0c106a5724778d56074e1ec7
tree6974d5751613018c217bf20e67a1b9e5c6f7a6c1
parentfc4486c2472b84384d4a31d2436a91bdb9b29792
[WebAssembly][lld] Fix crash when applying relocations to debug sections

Debug sections are special in that they can contain relocations against
symbols that are not present in the final output (i.e. not live).
However it is also possible to have R_WASM_TABLE_INDEX relocations
against symbols that don't have a table index assigned (since they are
not address taken by actual code.

Fixes: https://github.com/emscripten-core/emscripten/issues/9023

Differential Revision: https://reviews.llvm.org/D66435

llvm-svn: 369423
lld/test/wasm/debuginfo-relocs.s [new file with mode: 0644]
lld/wasm/InputChunks.cpp
lld/wasm/InputFiles.cpp
llvm/lib/MC/MCParser/WasmAsmParser.cpp