diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-07 16:21:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-02-07 16:21:30 +0000 |
commit | 61acf5d9b0f7e7c7c0db19f84ac91b023945f508 (patch) | |
tree | 4e62419c9105001f8e780fe76c15093969cef692 /llvm/lib | |
parent | a005342db304e7a7bdb5ebe5d1d4dcffe53e37c2 (diff) | |
download | bcm5719-llvm-61acf5d9b0f7e7c7c0db19f84ac91b023945f508.tar.gz bcm5719-llvm-61acf5d9b0f7e7c7c0db19f84ac91b023945f508.zip |
Fix a bug with .weak_def_can_be_hidden: Mutable variables cannot use it.
Thanks to John McCall for noticing it.
llvm-svn: 200977
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 141a6686304..89da65eb3fb 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -245,6 +245,18 @@ static bool canBeHidden(const GlobalValue *GV, const MCAsmInfo &MAI) { if (GV->hasUnnamedAddr()) return true; + // This is only used for MachO, so right now it doesn't really matter how + // we handle alias. Revisit this once the MachO linker implements aliases. + if (isa<GlobalAlias>(GV)) + return false; + + // 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) && !GS.IsCompared) return true; |