This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add symbol table to LLD, 2/2
AbandonedPublic

Authored by ncw on Jan 26 2018, 10:15 AM.

Details

Reviewers
sbc100
sunfish
Summary

WebAssembly object files will now have an explicit symbol table. This commit is the second of two halves, adding the actual symbol table itself.

The main changes are adding first-class support for Globals throughout the code as a third type of symbol, alongside existing Function/Data symbols, and Data symbols now no longer use Wasm globals in the intermediate format.

The end result is a bit more boilerplate, but a surprisingly nice reduction of complexity in the core logic, which becomes quite pleasingly neater.

Must be committed simultaneously with D42495, which adds symbol-table support to Clang/LLC.

Event Timeline

ncw created this revision.Jan 26 2018, 10:15 AM
ncw updated this revision to Diff 132218.Jan 31 2018, 11:11 AM

Updated:

  • Rebased on top of GC work
  • Pulled out globals-COMDAT into another commit
  • Pulled out some other preliminary changes into D42751
ncw updated this revision to Diff 132308.Jan 31 2018, 6:09 PM

Updated: massaged text expectations for new YAML output

ncw updated this revision to Diff 132356.Feb 1 2018, 3:58 AM

Updated: rebased, fixed a failing test after "calculateTypes" change affected the test expectations

sbc100 added inline comments.Feb 6 2018, 7:46 PM
test/wasm/alias.ll
64 ↗(On Diff #132356)

As discussed on IRC lets keep these exported globals in the executable output (just like we do for functions, no need to export in the relocatable output). Should make the diff smaller too I guess?

ncw updated this revision to Diff 133232.Feb 7 2018, 9:04 AM

Rebased and addressed comments

test/wasm/alias.ll
64 ↗(On Diff #132356)

OK, I've done that.

We now export a "fake" global specifically for the heap_base and data_end symbols.

Why not for all data symbols? Because actually these are the only "fake" globals that we're currently exporting in non-relocatable output.

As a follow-up commit, we can certainly add a fake-global for all data symbols.

ncw updated this revision to Diff 133532.Feb 8 2018, 4:18 PM

Updated: no functional change, just tweak to fix build after removing Optional from BinaryFormat/Wasm.h

ncw abandoned this revision.Feb 14 2018, 5:32 AM