Page MenuHomePhabricator

[WebAssemlby] Set IsUsedInRegularObj correctly for undefined data symbols
ClosedPublic

Authored by sbc100 on Jul 9 2018, 5:44 PM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sbc100 created this revision.Jul 9 2018, 5:44 PM
sbc100 added a reviewer: ruiu.Jul 9 2018, 5:45 PM
ruiu added a comment.Jul 9 2018, 5:48 PM

Is this correct? I thought that if no one is referencing an undefined symbol from an object file, that symbol shouldn't be marked as "used".

Yes, its correct, I believe. We were already doing it for undefined functions, just not data symbols. In the ELF loader we do it for all symbols in the ::insert function. I think I will do a followup to do it the same way here.

The example I have the I think shows it to be correct:

  1. Regular obj inserted undefined symbol.
  2. bitcode obj defines the symbols and replaces it.
  3. LTO happens, at which point symbol can be discarded if !IsUsedInRegularObj

So (1) needs to set IsUsedInRegularObj otherwise the symbol can be discarded in (3) and the result will be an undefined symbol.

Adding @jgravelle-google. Maybe @ruiu is OOO. This change I pretty small an non-controversial I think, not that I've explained it. These two lines should have been in the original LTO change.

This revision is now accepted and ready to land.Jul 17 2018, 12:01 PM
This revision was automatically updated to reflect the committed changes.