summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorVlad Tsyrklevich <vlad@tsyrklevich.net>2018-05-30 22:39:52 +0000
committerVlad Tsyrklevich <vlad@tsyrklevich.net>2018-05-30 22:39:52 +0000
commit178fdb1a3b04d6857f754a2927d8faf0472e6d1e (patch)
treedb76516cf26eb0d45eda945e18ccc2433313c868 /llvm/lib/Transforms
parent73d1d403e26ab8b5fc936d0f1ced9849bc273ca0 (diff)
downloadbcm5719-llvm-178fdb1a3b04d6857f754a2927d8faf0472e6d1e.tar.gz
bcm5719-llvm-178fdb1a3b04d6857f754a2927d8faf0472e6d1e.zip
[LowerTypeTests] Discard extern_weak linkage for definitions
Summary: Fix PR37625. It's possible for an extern_weak declaration to be emitted to the merged module when a definition exists in the ThinLTO portion of the build; discard the linkage on the declaration in that case. (otherwise we copy the linkage to the alias to the jumptable and fail) Reviewers: pcc Reviewed By: pcc Subscribers: mehdi_amini, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D47494 llvm-svn: 333604
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/LowerTypeTests.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index d2545af8502..1e4d3d37aae 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1716,6 +1716,11 @@ bool LowerTypeTestsModule::lower() {
F->clearMetadata();
}
+ // Update the linkage for extern_weak declarations when a definition
+ // exists.
+ if (Linkage == CFL_Definition && F->hasExternalWeakLinkage())
+ F->setLinkage(GlobalValue::ExternalLinkage);
+
// If the function in the full LTO module is a declaration, replace its
// type metadata with the type metadata we found in cfi.functions. That
// metadata is presumed to be more accurate than the metadata attached
OpenPOWER on IntegriCloud