summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index a5903e27a9d..b92f798c4ab 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -683,6 +683,13 @@ void llvm::thinLTOResolveWeakForLinkerModule(
// changed to enable this for aliases.
llvm_unreachable("Expected GV to be converted");
} else {
+ // If the original symbols has global unnamed addr and linkonce_odr linkage,
+ // it should be an auto hide symbol. Add hidden visibility to the symbol to
+ // preserve the property.
+ if (GV.hasLinkOnceODRLinkage() && GV.hasGlobalUnnamedAddr() &&
+ NewLinkage == GlobalValue::WeakODRLinkage)
+ GV.setVisibility(GlobalValue::HiddenVisibility);
+
DEBUG(dbgs() << "ODR fixing up linkage for `" << GV.getName() << "` from "
<< GV.getLinkage() << " to " << NewLinkage << "\n");
GV.setLinkage(NewLinkage);
OpenPOWER on IntegriCloud