diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-07 19:04:43 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-07 19:04:43 +0000 |
commit | 1e75dec97a628422ab09f46a2d61f1893144641a (patch) | |
tree | e5f76eb5e339169b2a0e0560d463d5496f616675 /lib/LTO | |
parent | 11b8b431964b870e3021a8eca8bf1d870a58f474 (diff) | |
download | llvm-1e75dec97a628422ab09f46a2d61f1893144641a.tar.gz llvm-1e75dec97a628422ab09f46a2d61f1893144641a.tar.bz2 llvm-1e75dec97a628422ab09f46a2d61f1893144641a.tar.xz |
Don't internalize linkonce_odr non constant variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO')
-rw-r--r-- | lib/LTO/LTOModule.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp index 669ccbbaab..68b7313be7 100644 --- a/lib/LTO/LTOModule.cpp +++ b/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; |