[PATCH] D14516: Ensure ModuleLinker materializes complete comdat groups

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 14:31:08 PST 2015


tejohnson created this revision.
tejohnson added a reviewer: rafael.
tejohnson added subscribers: llvm-commits, davidxl, dexonsmith.

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.

http://reviews.llvm.org/D14516

Files:
  lib/Linker/LinkModules.cpp
  test/Linker/Inputs/only-needed-named-metadata.ll
  test/Linker/comdat_group.ll
  test/Linker/only-needed-named-metadata.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14516.39754.patch
Type: text/x-patch
Size: 4017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151109/73b88d57/attachment.bin>


More information about the llvm-commits mailing list