This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Symbol changes #2: Table relocs, LLD
AbandonedPublic

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

Details

Reviewers
sbc100
Summary

Second chunk split out of D41955.

Must be committed simultaneously with LLVM change, D42080.

Changes:

  • LLD updated to handle new table reloc data (see D42080)
  • Now, we build the output table by iterating over all the non-Discarded Functions and Segments, rather than iterating over all the Symbols. This means that when we implement GC, the function table will actually be pruned properly.
  • A small block of code in InputChunks::calcRelocations has been factored out into ObjFile::calcNewValue to match ObjFile::calcNewIndex.
  • Relocatable output has been updated in the same way as for D42080, so the change to that test is correct

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

ncw created this revision.Jan 15 2018, 10:54 AM
sbc100 added inline comments.Jan 16 2018, 11:30 AM
wasm/InputFiles.cpp
70

Can this function now be removed?

wasm/InputFiles.h
111

perhaps call this relocateAddress, relocateVirtualAddress or relocateMemoryLocation or something similar to match the functions below?

wasm/Writer.cpp
756–757

If the lamda takes and InputChunk* then can this condition move there and we can just have:

for (InputFunction* Func : File->Functions)
  HandleRelocs(Func);
for (InputSegment* Seg : File->Segments)
  HandleRelocs(Seg);
756–757

Maybe call this handleTableRelocs?

ncw updated this revision to Diff 130106.Jan 17 2018, 1:35 AM
ncw marked 3 inline comments as done.

Updated:

  • Responded to comments (formatting/tidying changes)
wasm/InputFiles.cpp
70

I don't think it can be removed. Function indexes are definitely different to table indexes: relocateTableIndex calls getTableIndex which is necessary for performing the actual relocation.

ncw updated this revision to Diff 130647.Jan 19 2018, 10:12 AM
ncw edited the summary of this revision. (Show Details)

Updated:

  • Straightforward rebase
ncw updated this revision to Diff 130718.Jan 19 2018, 4:36 PM

Updated:

  • Another rebase after #4c and #4d landed
ncw abandoned this revision.Jan 23 2018, 6:45 AM

The LLVM change was merged in rL323165, and the LLD change was merged in rLLD323168.

However, the LLD commit did not reference this review in the commit message, so a think the only way to close the review is to abandon it.