[PATCH] D12459: Implement selective bitcode linking and internalization of linked symbols

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 16:45:29 PDT 2015


tra created this revision.
tra added reviewers: echristo, dexonsmith, pcc.
tra added a subscriber: llvm-commits.
Herald added a subscriber: jholewinski.

In order to support CUDA we need a way to link in subset of functions from bitcode library.

Current way to do that suggested in NVPTX guide (http://llvm.org/docs/NVPTXUsage.html) requires linking in complete library, internalizing all symbols except those that were originally present in TU before linking and running GDCE pass to eliminate bitcode we don't need.

Considering that we only need fairly small subset of functions from the library, better way to do that would be to directly link in only the symbols needed by the destination module and internalize them in process, if required.

This patch adds two new linker flags to do exactly that.

  - -only-needed  -- links in only symbols needed by destination module
  - -internalize -- internalize linked symbols.



http://reviews.llvm.org/D12459

Files:
  include/llvm/Linker/Linker.h
  lib/Linker/LinkModules.cpp
  lib/Target/NVPTX/NVPTXTargetMachine.cpp
  test/CodeGen/NVPTX/nvptx-enable-reflect.ll
  test/Linker/Inputs/linkage.c.ll
  test/Linker/link-flags.ll
  tools/llvm-link/llvm-link.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12459.33254.patch
Type: text/x-patch
Size: 10995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150828/6d6cc63c/attachment.bin>


More information about the llvm-commits mailing list