This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Symbol changes #6: syminfo index, LLVM
AbandonedPublic

Authored by ncw on Jan 16 2018, 10:43 AM.

Details

Reviewers
sbc100
Summary

Sixth chunk split out of D41954.

Must be committed simultaneously with LLD change, D42118.

Fixes: https://github.com/WebAssembly/tool-conventions/issues/30

Changes:

  • Change the WASM_SYMBOL_INFO linking metadata to refer to symbols by index rather than by string name
  • This should reduce the size of the Wasm object files. Hopefully uncontroversial?

Diff Detail

Repository
rL LLVM

Event Timeline

ncw created this revision.Jan 16 2018, 10:43 AM
ncw edited the summary of this revision. (Show Details)Jan 17 2018, 2:50 AM

I'd like to land this stand-alone if possible? i.e. not as part of this chain of commits, but directly on HEAD as it stands today. It seems like it might require a bit of rebase work to make it happen which I'm happy to do if you like?

I refactored this to sit on top of current HEAD so we can land before the other patchsets: D42279. I removed the stable_sort call since it didn't seem to be needed, or at least it didn't seem to effect the test output (Maybe the yaml dump is destroying the order?)

And the LLD-side change re-based very cleanly: D42282.

ncw added a comment.Jan 19 2018, 2:41 AM

(On a side-note: yes, the sort doesn't do much, but I think it might make a difference if you have a lot of globals and functions? It should make it less likely that the tests will need to be updated in future due to reordering of the output.)

ncw updated this revision to Diff 130655.Jan 19 2018, 10:28 AM

Updates:

  • Rebased
  • Removed std::sort() of the symbol flags, that wasn't actually doing anything useful since obj2yaml reorders them anyway
In D42117#982103, @ncw wrote:

Updates:

  • Rebased
  • Removed std::sort() of the symbol flags, that wasn't actually doing anything useful since obj2yaml reorders them anyway

Hmm.. obj2yaml is sorting stuff ? I don't think it should since its supposed to mirror the binary directly.

ncw added a comment.Jan 19 2018, 11:01 AM
In D42117#982103, @ncw wrote:

Updates:

  • Rebased
  • Removed std::sort() of the symbol flags, that wasn't actually doing anything useful since obj2yaml reorders them anyway

Hmm.. obj2yaml is sorting stuff ? I don't think it should since its supposed to mirror the binary directly.

Not exactly - obj2yaml is using the canonical order from the Wasm file, but it's using the order the symbol are declared in (via imports/exports) rather than the order the symbol flags happen to be stored in. It's basically normalising the order of the flags section, which isn't a disaster.

ncw abandoned this revision.Jan 22 2018, 10:28 AM

Abandoning - symtab changes take precedence.

I reckon the symtab work is something I can work on towards the end of the week (maybe) and something done towards the start of next week.

#2 and #3 are OK to merge now. #5 will be modified a bit in the symtab work, and I'll create a new changeset on top of the (updated) #5 that does the actual modifications to the symtab format on disk.