fix ELF section mangling stuff for weak symbols to not use

obsolete Mangler interfaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-13 21:29:21 +00:00
parent 2cd4244815
commit 8da8d4b12a

View File

@ -21,11 +21,13 @@
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mangler.h" #include "llvm/Support/Mangler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringExtras.h"
using namespace llvm; using namespace llvm;
@ -576,16 +578,16 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
// into a 'uniqued' section name, create and return the section now. // into a 'uniqued' section name, create and return the section now.
if (GV->isWeakForLinker()) { if (GV->isWeakForLinker()) {
const char *Prefix = getSectionPrefixForUniqueGlobal(Kind); const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
SmallString<128> Name; SmallString<128> Name, MangledName;
Name.append(Prefix, Prefix+strlen(Prefix)); Name.append(Prefix, Prefix+strlen(Prefix));
// FIXME: This will fail for weak globals with no names, this also depends Mang->getNameWithPrefix(Name, GV, false);
// 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(), raw_svector_ostream OS(MangledName);
getELFSectionType(Name.str(), Kind), MCSymbol::printMangledName(Name, OS, 0);
OS.flush();
return getELFSection(MangledName.str(),
getELFSectionType(MangledName.str(), Kind),
getELFSectionFlags(Kind), getELFSectionFlags(Kind),
Kind); Kind);
} }