summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2015-11-04 16:01:16 +0000
committerTeresa Johnson <tejohnson@google.com>2015-11-04 16:01:16 +0000
commitf1b0a6e37c4d25c321fb7a30917e571f6eb777c8 (patch)
treecfc7cb8821272827aaa8a9f4879b9368501a0608 /llvm/lib/Linker/LinkModules.cpp
parentef731a9edc556f26544d3873fe28b58e4e33e61c (diff)
downloadbcm5719-llvm-f1b0a6e37c4d25c321fb7a30917e571f6eb777c8.tar.gz
bcm5719-llvm-f1b0a6e37c4d25c321fb7a30917e571f6eb777c8.zip
[ThinLTO] Always set linkage type to external when converting alias
When converting an alias to a non-alias when the aliasee is not imported, ensure that the linkage type is set to external so that it is a valid linkage type. Added a test case that exposed this issue. llvm-svn: 252054
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index b7aab9e9644..a855ec06d17 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -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;
OpenPOWER on IntegriCloud