[PATCH] D53842: [WebAssembly] Parsing missing directives to produce valid .o
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 2 12:38:29 PDT 2018
sbc100 added inline comments.
================
Comment at: lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp:376
+ .Case("global", wasm::WASM_SYMBOL_TYPE_GLOBAL)
+ .Case("section", wasm::WASM_SYMBOL_TYPE_SECTION)
+ .NoDefault();
----------------
sbc100 wrote:
> Can we limit this to supporting just `function` and `global` here? Sections are created using `.section` directive and I think data is the default.
>
> Then maybe you can avoid the StringSwitch change too.
So now that you don't need to store `Type` can you avoid adding WASM_SYMBOL_TYPE_INVALID and just do something like.
```
if ("function")
setType(FUNCTION)
else ("global')
setType(GLOBAL)
else
error
```
================
Comment at: lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp:363
+ return Error("Cannot parse .size expression: ", Lexer.getTok());
+ WasmSym->setSize(Exp);
+ } else if (DirectiveID.getString() == ".globaltype") {
----------------
What isn't `ELFAsmParser::ParseDirectiveSize` which then calls `getStreamer().emitELFSize` doing this already?
Repository:
rL LLVM
https://reviews.llvm.org/D53842
More information about the llvm-commits
mailing list