This is an archive of the discontinued LLVM Phabricator instance.

Ensure ModuleLinker materializes complete comdat groups
ClosedPublic

Authored by tejohnson on Nov 9 2015, 2:31 PM.

Details

Summary

The module linker lazy links some "discardable if unused" global
values (e.g. linkonce), materializing and linking them only
if they are referenced in the module. If a comdat group contains a
linkonce member that is not referenced, however, it would not be
materialized and linked, leading to an incomplete comdat group.

If there are other object files not part of the same LTO link that also
define and use that comdat group, the linker may select the incomplete
group leading to link time unsats.

To solve this, whenever a global value body is linked, make sure we
materialize any other members of the same comdat group that are not yet
materialized. This ensures they are in the lazy link list and get linked
as well.

Added new test and adjusted old test to remove parts that didn't
make sense with fix.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson updated this revision to Diff 39754.Nov 9 2015, 2:31 PM
tejohnson retitled this revision from to Ensure ModuleLinker materializes complete comdat groups.
tejohnson updated this object.
tejohnson added a reviewer: rafael.
rafael accepted this revision.Nov 10 2015, 1:08 PM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Nov 10 2015, 1:08 PM
This revision was automatically updated to reflect the committed changes.