aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetLoweringObjectFile.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-13 21:29:21 +0000
committerChris Lattner <sabre@nondot.org>2010-01-13 21:29:21 +0000
commitccbeed2af4a22b8b3e24ef50e81dd245dc8c0530 (patch)
treed5b0fd3df2063a92a0d85af0db2e4c84dc516545 /llvm/lib/Target/TargetLoweringObjectFile.cpp
parent9c203e362aa9505f8667a218f0c2a51ce17fa178 (diff)
downloadllvm-ccbeed2af4a22b8b3e24ef50e81dd245dc8c0530.zip
llvm-ccbeed2af4a22b8b3e24ef50e81dd245dc8c0530.tar.gz
llvm-ccbeed2af4a22b8b3e24ef50e81dd245dc8c0530.tar.bz2
fix ELF section mangling stuff for weak symbols to not use
obsolete Mangler interfaces. llvm-svn: 93356
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 14f510c..70e8008 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -21,11 +21,13 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionELF.h"
+#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mangler.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
using namespace llvm;
@@ -576,16 +578,16 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
// into a 'uniqued' section name, create and return the section now.
if (GV->isWeakForLinker()) {
const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
- SmallString<128> Name;
+ SmallString<128> Name, MangledName;
Name.append(Prefix, Prefix+strlen(Prefix));
- // FIXME: This will fail for weak globals with no names, this also depends
- // on the mangling behavior of makeNameProper to mangle the section name
- // before construction. Instead, this should use getNameWithPrefix on the
- // global variable and the MCSection printing code should do the mangling.
- Mang->makeNameProper(Name, GV->getName());
-
- return getELFSection(Name.str(),
- getELFSectionType(Name.str(), Kind),
+ Mang->getNameWithPrefix(Name, GV, false);
+
+ raw_svector_ostream OS(MangledName);
+ MCSymbol::printMangledName(Name, OS, 0);
+ OS.flush();
+
+ return getELFSection(MangledName.str(),
+ getELFSectionType(MangledName.str(), Kind),
getELFSectionFlags(Kind),
Kind);
}