Global label not handled correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31883 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index 9454fe5..c2f5d73 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -334,9 +334,17 @@
/// generate the appropriate value.
const std::string AsmPrinter::getGlobalLinkName(const GlobalVariable *GV) const{
std::string LinkName;
- // Default action is to use a global symbol.
- LinkName = TAI->getGlobalPrefix();
- LinkName += GV->getName();
+
+ if (isa<Function>(GV)) {
+ LinkName += TAI->getFunctionAddrPrefix();
+ LinkName += Mang->getValueName(GV);
+ LinkName += TAI->getFunctionAddrSuffix();
+ } else {
+ LinkName += TAI->getGlobalVarAddrPrefix();
+ LinkName += Mang->getValueName(GV);
+ LinkName += TAI->getGlobalVarAddrSuffix();
+ }
+
return LinkName;
}