if (std::error_code EC = Src->materialize())
return emitError(EC.message());
+ // Link in the prefix data.
+ if (Src->hasPrefixData())
+ Dst->setPrefixData(MapValue(Src->getPrefixData(), ValueMap, RF_None,
+ &TypeMap, &ValMaterializer));
+
+ // Link in the prologue data.
+ if (Src->hasPrologueData())
+ Dst->setPrologueData(MapValue(Src->getPrologueData(), ValueMap, RF_None,
+ &TypeMap, &ValMaterializer));
+
+
// Go through and convert function arguments over, remembering the mapping.
Function::arg_iterator DI = Dst->arg_begin();
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
continue;
Function *DF = cast<Function>(ValueMap[&SF]);
-
- // Link in the prefix data.
- if (SF.hasPrefixData())
- DF->setPrefixData(MapValue(SF.getPrefixData(), ValueMap, RF_None,
- &TypeMap, &ValMaterializer));
-
- // Link in the prologue data.
- if (SF.hasPrologueData())
- DF->setPrologueData(MapValue(SF.getPrologueData(), ValueMap, RF_None,
- &TypeMap, &ValMaterializer));
-
if (linkFunctionBody(DF, &SF))
return true;
}
LazilyLinkFunctions.pop_back();
Function *DF = cast<Function>(ValueMap[SF]);
- if (SF->hasPrefixData()) {
- // Link in the prefix data.
- DF->setPrefixData(MapValue(SF->getPrefixData(), ValueMap, RF_None,
- &TypeMap, &ValMaterializer));
- }
-
- // Link in function body.
if (linkFunctionBody(DF, SF))
return true;
}
-; RUN: echo > %t.ll
-; RUN: llvm-link %t.ll %s -S -o - | FileCheck %s
+; RUN: llvm-link %s -S -o - | FileCheck %s
-@i = linkonce_odr global i32 1
+@g1 = global void()* @f2
+; CHECK: @g1 = global void ()* @f2
-; CHECK: define void @f() prologue i32* @i
-define void @f() prologue i32* @i {
+@p1 = global i8 42
+; CHECK: @p1 = global i8 42
+
+@p2 = internal global i8 43
+; CHECK: @p2 = internal global i8 43
+
+define void @f1() prologue i8* @p1 {
+ ret void
+}
+; CHECK: define void @f1() prologue i8* @p1 {
+
+define internal void @f2() prologue i8* @p2 {
ret void
}
+
+; CHECK: define internal void @f2() prologue i8* @p2 {