summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-05-26 14:16:52 +0000
committerTeresa Johnson <tejohnson@google.com>2016-05-26 14:16:52 +0000
commit28c03b56ecaf5918ca738113334767a491df5788 (patch)
tree801efa2a1c2521d80c54621ebf6a79c750da31e7 /llvm/lib/LTO/LTO.cpp
parentc24501dd13f7e8f4d2fc66bc8ca59dd6046812bf (diff)
downloadbcm5719-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.cpp21
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()) &&
OpenPOWER on IntegriCloud