]> granicus.if.org Git - llvm/commitdiff
[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)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369423 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/WasmAsmParser.cpp

index 28d4459fecd4498a02cb56bb054bade628ecc606..0c242aed706d1be1d85e888c717f6c791c5c1dea 100644 (file)
@@ -123,6 +123,7 @@ public:
                     // See use of .init_array in WasmObjectWriter and
                     // TargetLoweringObjectFileWasm
                     .StartsWith(".init_array", SectionKind::getData())
+                    .StartsWith(".debug_", SectionKind::getMetadata())
                     .Default(Optional<SectionKind>());
     if (!Kind.hasValue())
       return Parser->Error(Lexer->getLoc(), "unknown section kind: " + Name);