[llvm] r369423 - [WebAssembly][lld] Fix crash when applying relocations to debug sections

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 11:39:24 PDT 2019


Author: sbc
Date: Tue Aug 20 11:39:24 2019
New Revision: 369423

URL: http://llvm.org/viewvc/llvm-project?rev=369423&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/MC/MCParser/WasmAsmParser.cpp

Modified: llvm/trunk/lib/MC/MCParser/WasmAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/WasmAsmParser.cpp?rev=369423&r1=369422&r2=369423&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/WasmAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/WasmAsmParser.cpp Tue Aug 20 11:39:24 2019
@@ -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);




More information about the llvm-commits mailing list