[PATCH] D95838: [WebAssembly] Prevent data inside text sections in assembly

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 17:58:43 PST 2021


sbc100 accepted this revision.
sbc100 added a comment.
This revision is now accepted and ready to land.

lgtm with a test for the parse error.



================
Comment at: llvm/lib/MC/MCParser/WasmAsmParser.cpp:224
     auto TypeName = Lexer->getTok().getString();
+    auto *Current =
+        cast<MCSectionWasm>(getStreamer().getCurrentSection().first);
----------------
CurrentSection?  


================
Comment at: llvm/lib/MC/MCParser/WasmAsmParser.cpp:235
+        return error("WASM doesn\'t support data symbols in text sections: ",
+                     Lexer->getTok());
       WasmSym->setType(wasm::WASM_SYMBOL_TYPE_DATA);
----------------
I think it would be good to have a test for this user-facing error.. partly because I think we could use more `.s` file tests in general and the tests kind of act as documentation for what is and isn't possible with our .s format.  




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95838/new/

https://reviews.llvm.org/D95838



More information about the llvm-commits mailing list