This is an archive of the discontinued LLVM Phabricator instance.

COFF: Numerous fixes for interaction between LTO and weak externals.
ClosedPublic

Authored by pcc on Jul 3 2015, 8:43 PM.

Details

Summary

We were previously hitting assertion failures in the writer in cases where
a regular object file defined a weak external symbol that was defined by
a bitcode file. Because /export and /entry name mangling were implemented
using weak externals, the same problem affected mangled symbol names in
bitcode files.

The underlying cause of the problem was that weak external symbols were
being resolved before doing LTO, so the symbol table may have contained stale
references to bitcode symbols. The fix here is to defer weak external symbol
resolution until after LTO.

Also implement support for weak external symbols in bitcode files
by modelling them as replaceable DefinedBitcode symbols.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 29042.Jul 3 2015, 8:43 PM
pcc retitled this revision from to COFF: Numerous fixes for interaction between LTO and weak externals..
pcc updated this object.
pcc added a reviewer: ruiu.
pcc added a subscriber: llvm-commits.
ruiu accepted this revision.Jul 3 2015, 8:56 PM
ruiu edited edge metadata.

LGTM

COFF/SymbolTable.cpp
130–133 ↗(On Diff #29042)

Ah, this looks better than before.

COFF/Symbols.cpp
239 ↗(On Diff #29042)

I'd name getWeakAlias.

244 ↗(On Diff #29042)

You can remove this brace.

This revision is now accepted and ready to land.Jul 3 2015, 8:56 PM
This revision was automatically updated to reflect the committed changes.
pcc marked 2 inline comments as done.
pcc added inline comments.Jul 3 2015, 10:29 PM
COFF/Symbols.cpp
239 ↗(On Diff #29042)

Done

244 ↗(On Diff #29042)

Done