[PATCH] D42495: [WebAssembly] Add symbol table to LLVM, 2/2

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 02:36:39 PST 2018


ncw marked 8 inline comments as done.
ncw added inline comments.


================
Comment at: include/llvm/BinaryFormat/Wasm.h:233
+  WASM_SYMTAB_DATA     = 0x1,
+  WASM_SYMTAB_GLOBAL   = 0x2,
+};
----------------
ncw wrote:
> sbc100 wrote:
> > [Not really part of this change but...]  Should we add a separate type of BSS here?  Or can BSS symbols be expresses as DATA with no segment?
> > 
> > Should these be WASM_SYMTYPE_XXX or WASM_SYMBOL_XXX or maybe just WASM_SYM_XXX ?  
> Renamed to `WASM_SYMBOL_TYPE_XXX` - a bit verbose but matches conventions for the other enums.
> 
> Regarding BSS: I've been thinking/planning how to handle that; I can work on it after these patches if you want. What I had in mind was that the segment-metadata would gain the ability to describe BSS segments via a flag (currently no segment flags are defined), and for BSS segments there would be no corresponding Wasm segment. Currently we have Wasm segments mapping 1-to-1 to segment metadata; in the new scheme we'd have possibly more segment metadata than Wasm segments, and BSS segment metadata wouldn't have a corresponding Wasm segment.
I've had a better plan for BSS: we should keep the one-to-one correspondence Wasm segments and linking segments. Instead, we should tweak the "segment metadata" to include a Size, and there should be a WASM_SEGMENT_BSS flag. For BSS segments, the Wasm elem will just be empty (rather than contain the zeros explicitly), and the segment's size in LLD shall be taken from the metadata Size; for non-BSS segments the metadata's Size much match the size of the Wasm elem. Thus we can skip long runs of zeros - but //without// needing yet another concept of "index".


Repository:
  rL LLVM

https://reviews.llvm.org/D42495





More information about the llvm-commits mailing list