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

Yury Delendik via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 11:05:08 PDT 2018


yurydelendik added inline comments.


================
Comment at: lib/Object/WasmObjectFile.cpp:878
 
+    Function.CodeOffset = Ptr - FunctionStart;
     Function.Index = NumImportedFunctions + Functions.size();
----------------
aardappel wrote:
> 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.
It looks like it is possible to exclude function size from data and use CodeSectionOffset as a start of the function. (LLD's CodeSection needs to be changed to generate function size/header) Would you like to do that instead? 


Repository:
  rL LLVM

https://reviews.llvm.org/D46763





More information about the llvm-commits mailing list