[PATCH] D46763: [WebAssembly] Provide WasmFunction content offset informatin.

Wouter van Oortmerssen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 12:01:02 PDT 2018


aardappel added inline comments.


================
Comment at: lib/Object/WasmObjectFile.cpp:878
 
+    Function.CodeOffset = Ptr - FunctionStart;
     Function.Index = NumImportedFunctions + Functions.size();
----------------
sbc100 wrote:
> As an alternative, perhaps we could just move the `const uint8_t *FunctionStart = Ptr;` down a couple of lines so that the function body no longer includes its size?
> 
> The downside would be that the linker would need to re-encode the size for each function.
> 
> @aardappel was recently looking making `objdump -d` work and he ran into issues relating to pointer the actual start of the instructions.
> 
> Having said all that, this seems like a perfectly reasonable interim fix.
I could already fix objdump to give correct output for wasm disassembly, but that would require a some wasm-specific parsing in objdump. Question is, can we do this more generically such that objdump does things correctly automatically?
Some wasm specific code may be unavoidable, if we'd also like to interleave a disassembly with local/arg annotations etc.


Repository:
  rL LLVM

https://reviews.llvm.org/D46763





More information about the llvm-commits mailing list