diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-05-26 14:16:52 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-05-26 14:16:52 +0000 |
commit | 28c03b56ecaf5918ca738113334767a491df5788 (patch) | |
tree | 801efa2a1c2521d80c54621ebf6a79c750da31e7 /llvm/lib/LTO/LTO.cpp | |
parent | c24501dd13f7e8f4d2fc66bc8ca59dd6046812bf (diff) | |
download | bcm5719-llvm-28c03b56ecaf5918ca738113334767a491df5788.tar.gz bcm5719-llvm-28c03b56ecaf5918ca738113334767a491df5788.zip |
[ThinLTO] Resolve LinkOnceAny
Summary:
Ensure we keep prevailing copy of LinkOnceAny by converting it to
WeakAny.
Rename odr_resolution test to the now more appropriate weak_resolution
(weak in the linker sense includes linkonce).
Reviewers: joker.eph
Subscribers: llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D20634
llvm-svn: 270850
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index fa875c29e29..11ffb59f604 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -60,23 +60,14 @@ static void thinLTOResolveWeakForLinkerGUID( // but turned into a weak, while the others will drop it when possible. if (!HasMultipleCopies) { // Exported Linkonce needs to be promoted to not be discarded. - // FIXME: This should handle LinkOnceAny as well, but that should be a - // follow-on to the NFC restructuring: - // if (GlobalValue::isLinkOnceLinkage(OriginalLinkage) && - // isExported(S->modulePath(), GUID)) - // S->setLinkage(GlobalValue::getWeakLinkage( - // GlobalValue::isLinkOnceODRLinkage(OriginalLinkage))); - if (GlobalValue::isLinkOnceODRLinkage(OriginalLinkage) && + if (GlobalValue::isLinkOnceLinkage(OriginalLinkage) && isExported(S->modulePath(), GUID)) - S->setLinkage(GlobalValue::WeakODRLinkage); + S->setLinkage(GlobalValue::getWeakLinkage( + GlobalValue::isLinkOnceODRLinkage(OriginalLinkage))); } else if (isPrevailing(GUID, S.get())) { - // FIXME: This should handle LinkOnceAny as well, but that should be a - // follow-on to the NFC restructuring: - // if (GlobalValue::isLinkOnceLinkage(OriginalLinkage)) - // S->setLinkage(GlobalValue::getWeakLinkage( - // GlobalValue::isLinkOnceODRLinkage(OriginalLinkage))); - if (GlobalValue::isLinkOnceODRLinkage(OriginalLinkage)) - S->setLinkage(GlobalValue::WeakODRLinkage); + if (GlobalValue::isLinkOnceLinkage(OriginalLinkage)) + S->setLinkage(GlobalValue::getWeakLinkage( + GlobalValue::isLinkOnceODRLinkage(OriginalLinkage))); } // Alias can't be turned into available_externally. else if (!isa<AliasSummary>(S.get()) && |