summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOModule.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-02-07 19:04:43 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-02-07 19:04:43 +0000
commit66f273be345562fa0ebe275f1ef8c5c621c69f1d (patch)
tree9b7983f99944855cf0099fc2b44d7d7512a54e7e /llvm/lib/LTO/LTOModule.cpp
parent7985adf5e6a77a7468184bcbccf070c92593b59d (diff)
downloadbcm5719-llvm-66f273be345562fa0ebe275f1ef8c5c621c69f1d.tar.gz
bcm5719-llvm-66f273be345562fa0ebe275f1ef8c5c621c69f1d.zip
Don't internalize linkonce_odr non constant variables.
llvm-svn: 200983
Diffstat (limited to 'llvm/lib/LTO/LTOModule.cpp')
-rw-r--r--llvm/lib/LTO/LTOModule.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 669ccbbaab4..68b7313be72 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -349,6 +349,7 @@ void LTOModule::addDefinedFunctionSymbol(const Function *f) {
}
static bool canBeHidden(const GlobalValue *GV) {
+ // FIXME: this is duplicated with another static function in AsmPrinter.cpp
GlobalValue::LinkageTypes L = GV->getLinkage();
if (L != GlobalValue::LinkOnceODRLinkage)
@@ -357,6 +358,13 @@ static bool canBeHidden(const GlobalValue *GV) {
if (GV->hasUnnamedAddr())
return true;
+ // If it is a non constant variable, it needs to be uniqued across shared
+ // objects.
+ if (const GlobalVariable *Var = dyn_cast<GlobalVariable>(GV)) {
+ if (!Var->isConstant())
+ return false;
+ }
+
GlobalStatus GS;
if (GlobalStatus::analyzeGlobal(GV, GS))
return false;
OpenPOWER on IntegriCloud