diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/Mangler.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Target/TargetLoweringObjectFile.cpp | 11 |
2 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/Target/Mangler.cpp b/llvm/lib/Target/Mangler.cpp index 3eab58cc36d..c630062bdfa 100644 --- a/llvm/lib/Target/Mangler.cpp +++ b/llvm/lib/Target/Mangler.cpp @@ -179,3 +179,16 @@ std::string Mangler::getNameWithPrefix(const GlobalValue *GV, getNameWithPrefix(Buf, GV, isImplicitlyPrivate); return std::string(Buf.begin(), Buf.end()); } + +/// getSymbol - Return the MCSymbol for the specified global value. This +/// symbol is the main label that is the address of the global. +MCSymbol *Mangler::getSymbol(const GlobalValue *GV) { + SmallString<60> NameStr; + getNameWithPrefix(NameStr, GV, false); + if (!GV->hasPrivateLinkage()) + return Context.GetOrCreateSymbol(NameStr.str()); + + return Context.GetOrCreateTemporarySymbol(NameStr.str()); +} + + diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index 5a960d80852..a093e2db8b2 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -298,16 +298,7 @@ const MCExpr *TargetLoweringObjectFile:: getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const { - // FIXME: Use GetGlobalValueSymbol. - SmallString<128> Name; - Mang->getNameWithPrefix(Name, GV, false); - const MCSymbol *Sym; - - if (GV->hasPrivateLinkage()) - Sym = getContext().GetOrCreateTemporarySymbol(Name.str()); - else - Sym = getContext().GetOrCreateSymbol(Name.str()); - + const MCSymbol *Sym = Mang->getSymbol(GV); return getExprForDwarfReference(Sym, Mang, MMI, Encoding, Streamer); } |