[llvm-commits] [llvm] r93356 - /llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 13 13:29:21 PST 2010
Author: lattner
Date: Wed Jan 13 15:29:21 2010
New Revision: 93356
URL: http://llvm.org/viewvc/llvm-project?rev=93356&view=rev
Log:
fix ELF section mangling stuff for weak symbols to not use
obsolete Mangler interfaces.
Modified:
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=93356&r1=93355&r2=93356&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Wed Jan 13 15:29:21 2010
@@ -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 @@
// 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);
}
More information about the llvm-commits
mailing list