This is an archive of the discontinued LLVM Phabricator instance.

Allow linking multiple bitcode files.
ClosedPublic

Authored by tra on Oct 20 2015, 2:24 PM.

Details

Summary

This will be used for CUDA where we need to link with vendor-supplied bitcode library and with a bitcode library pretending to be libm for GPUs.

Linking options for particular file depend on the option that specifies the file.
Currently there are two:

  • -mlink-bitcode-file links in complete content of the specified file.
  • -mlink-cuda-bitcode links in only the symbols needed by current TU. Linked symbols are internalized. This bitcode linking mode is used to link device-specific bitcode provided by CUDA.

Files are linked in order they are specified on command line.

-mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag.

Diff Detail

Event Timeline

tra updated this revision to Diff 37917.Oct 20 2015, 2:24 PM
tra retitled this revision from to Allow linking multiple bitcode files..
tra updated this object.
tra added reviewers: echristo, pcc.
tra added a subscriber: cfe-commits.
echristo accepted this revision.Oct 21 2015, 12:45 PM
echristo edited edge metadata.

One inline comment, otherwise LGTM.

-eric

include/clang/CodeGen/CodeGenAction.h
28

Can we either make the pair a typedef or add some comments about the flags?

This revision is now accepted and ready to land.Oct 21 2015, 12:45 PM
tra updated this revision to Diff 38046.Oct 21 2015, 1:45 PM
tra edited edge metadata.

Added a comment about format of LinkModules vector.
Added/cleaned up few comments in test files.

tra marked an inline comment as done.Oct 21 2015, 1:45 PM
This revision was automatically updated to reflect the committed changes.