This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix crash with LTO + relocatable + undefined symbols
ClosedPublic

Authored by sbc100 on Jan 18 2019, 4:44 PM.

Details

Summary

Change the way we create the symbol table to be closer to how its down on ELF.
Now the output symbol table matches the internal symtab data structure more closely
and includes local and undefined symbols.

Fixes PR40204

Diff Detail

Repository
rL LLVM

Event Timeline

sbc100 created this revision.Jan 18 2019, 4:44 PM
sbc100 edited the summary of this revision. (Show Details)Jan 18 2019, 4:44 PM
sbc100 added reviewers: kripken, ruiu.
sbc100 updated this revision to Diff 182643.Jan 18 2019, 4:45 PM

Revert debugging

Harbormaster completed remote builds in B27085: Diff 182643.
ruiu added a reviewer: pcc.Jan 22 2019, 2:23 PM
pcc added inline comments.Jan 22 2019, 2:50 PM
wasm/Writer.cpp
906 ↗(On Diff #182643)

Maybe this would be better as

for (Symbol *Sym : Symtab->getSymbols()) {
  // handle global symbols
}

for (ObjFile *File : Symtab->ObjectFiles) {
  for (Symbol *Sym : File->getSymbols()) {
    if (!Sym->isLocal())
      continue;
    // handle local/section symbols
  }
}

? I believe that's how we handle .symtab in ELF for example.

sbc100 updated this revision to Diff 184321.Jan 30 2019, 10:07 AM
sbc100 marked 2 inline comments as done.
  • refactor symtab creation
sbc100 edited the summary of this revision. (Show Details)Jan 30 2019, 10:09 AM
ruiu accepted this revision.Jan 30 2019, 10:46 AM

LGTM

wasm/Writer.cpp
907 ↗(On Diff #184321)

Symbol* -> Symbol *

This revision is now accepted and ready to land.Jan 30 2019, 10:46 AM
This revision was automatically updated to reflect the committed changes.