diff options
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 4fffa55..c3bcbcf 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -1260,6 +1260,13 @@ bool ModuleLinker::run() { // Skip if not linking from source. if (DoNotLinkFromSource.count(SF)) continue; + Function *DF = cast<Function>(ValueMap[SF]); + if (SF->hasPrefixData()) { + // Link in the prefix data. + DF->setPrefixData(MapValue( + SF->getPrefixData(), ValueMap, RF_None, &TypeMap, &ValMaterializer)); + } + // Skip if no body (function is external) or materialize. if (SF->isDeclaration()) { if (!SF->isMaterializable()) @@ -1268,7 +1275,7 @@ bool ModuleLinker::run() { return true; } - linkFunctionBody(cast<Function>(ValueMap[SF]), SF); + linkFunctionBody(DF, SF); SF->Dematerialize(); } @@ -1296,6 +1303,14 @@ bool ModuleLinker::run() { continue; Function *DF = cast<Function>(ValueMap[SF]); + if (SF->hasPrefixData()) { + // Link in the prefix data. + DF->setPrefixData(MapValue(SF->getPrefixData(), + ValueMap, + RF_None, + &TypeMap, + &ValMaterializer)); + } // Materialize if necessary. if (SF->isDeclaration()) { |