This is an archive of the discontinued LLVM Phabricator instance.

LTO: Mark undefined module inline asm symbols as visible outside of ThinLTO.
ClosedPublic

Authored by pcc on Apr 26 2017, 10:12 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Apr 26 2017, 10:12 AM
davide added a subscriber: davide.Apr 26 2017, 10:16 AM
davide added inline comments.
llvm/lib/Object/IRSymtab.cpp
166–168 ↗(On Diff #96779)

With this patch in place, do we still need the call to collectAsmUndefined in the ThinLTO backend? (I understand we need it for LTO, still)

pcc updated this revision to Diff 96781.Apr 26 2017, 10:24 AM
  • Stop calling handleAsmUndefinedRefs
pcc added inline comments.Apr 26 2017, 10:25 AM
llvm/lib/Object/IRSymtab.cpp
166–168 ↗(On Diff #96779)

Good point. I actually think we can remove it from both because preventing internalization should be sufficient to keep the symbol alive.

davide added inline comments.Apr 26 2017, 10:31 AM
llvm/lib/Object/IRSymtab.cpp
166–168 ↗(On Diff #96779)

You probably already noticed, but there may be some test in lld that needs updating (so you can catch it before the bots start yelling).

pcc added inline comments.Apr 26 2017, 10:33 AM
llvm/lib/Object/IRSymtab.cpp
166–168 ↗(On Diff #96779)

Yes, that was lld/test/ELF/lto/asmundef.ll, which I already updated :)

davide accepted this revision.Apr 26 2017, 10:38 AM

The LTO bits look fine to me. I think this is also the correct fix for ThinLTO but Teresa should confirm

llvm/lib/Object/IRSymtab.cpp
166–168 ↗(On Diff #96779)

Oh, was looking at a stale revision.

This revision is now accepted and ready to land.Apr 26 2017, 10:38 AM

(also update the revision title before committing)

This revision was automatically updated to reflect the committed changes.

Won't this disable *linker* dead-stripping?
I don't understand the motivation for this change right now?

pcc added a comment.Apr 26 2017, 12:20 PM

Won't this disable *linker* dead-stripping?

I don't think so. LTO will only internalize a global if the linker tells it that is not a GC root. This change disables internalization for some entities that would otherwise be internalized, but linker dead stripping is not inhibited because even if the symbol had external linkage, it would still not be a GC root.

I don't understand the motivation for this change right now?

See PR32798.