Support for ThinLTO function importing and symbol linking.

Summary:
Support for necessary linkage changes and symbol renaming during
ThinLTO function importing.

Also includes llvm-link support for manually importing functions
and associated llvm-link based tests.

Note that this does not include support for intelligently importing
metadata, which is currently imported duplicate times. That support will
be in the follow-on patch, and currently is ignored by the tests.

Reviewers: dexonsmith, joker.eph, davidxl

Subscribers: tobiasvk, tejohnson, llvm-commits

Differential Revision: http://reviews.llvm.org/D13515

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251837 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Teresa Johnson
2015-11-02 21:39:10 +00:00
parent 819908e85d
commit 5aa157fab6
13 changed files with 760 additions and 49 deletions

View File

@@ -5813,12 +5813,12 @@ llvm::getBitcodeTargetTriple(MemoryBufferRef Buffer, LLVMContext &Context,
ErrorOr<std::unique_ptr<FunctionInfoIndex>>
llvm::getFunctionInfoIndex(MemoryBufferRef Buffer, LLVMContext &Context,
DiagnosticHandlerFunction DiagnosticHandler,
bool IsLazy) {
const Module *ExportingModule, bool IsLazy) {
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);
FunctionIndexBitcodeReader R(Buf.get(), Context, DiagnosticHandler, IsLazy);
std::unique_ptr<FunctionInfoIndex> Index =
llvm::make_unique<FunctionInfoIndex>();
llvm::make_unique<FunctionInfoIndex>(ExportingModule);
auto cleanupOnError = [&](std::error_code EC) {
R.releaseBuffer(); // Never take ownership on error.