[ThinLTO] Always set linkage type to external when converting alias
[oota-llvm.git] / lib / Linker / LinkModules.cpp
index b7aab9e964420cb4af2e23a26d2bbaf1dfc5207d..a855ec06d1797ea137a59d80d33bc41726d28c0b 100644 (file)
@@ -841,10 +841,12 @@ GlobalValue *ModuleLinker::copyGlobalAliasProto(TypeMapTy &TypeMap,
       assert(F);
       NewGV = copyFunctionProto(TypeMap, F);
     }
-    // Set the linkage to ExternalWeak, see also comments in
-    // ModuleLinker::getLinkage.
+    // Set the linkage to External or ExternalWeak (see comments in
+    // ModuleLinker::getLinkage for why WeakAny is converted to ExternalWeak).
     if (SGA->hasWeakAnyLinkage())
       NewGV->setLinkage(GlobalValue::ExternalWeakLinkage);
+    else
+      NewGV->setLinkage(GlobalValue::ExternalLinkage);
     // Don't attempt to link body, needs to be a declaration.
     DoNotLinkFromSource.insert(SGA);
     return NewGV;