llvm.org GIT mirror llvm / 8da8d4b
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 Chris Lattner 10 years ago
1 changed file(s) with 11 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2020 #include "llvm/MC/MCExpr.h"
2121 #include "llvm/MC/MCSectionMachO.h"
2222 #include "llvm/MC/MCSectionELF.h"
23 #include "llvm/MC/MCSymbol.h"
2324 #include "llvm/Target/TargetData.h"
2425 #include "llvm/Target/TargetMachine.h"
2526 #include "llvm/Target/TargetOptions.h"
2627 #include "llvm/Support/ErrorHandling.h"
2728 #include "llvm/Support/Mangler.h"
29 #include "llvm/Support/raw_ostream.h"
2830 #include "llvm/ADT/SmallString.h"
2931 #include "llvm/ADT/StringExtras.h"
3032 using namespace llvm;
575577 // into a 'uniqued' section name, create and return the section now.
576578 if (GV->isWeakForLinker()) {
577579 const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
578 SmallString<128> Name;
580 SmallString<128> Name, MangledName;
579581 Name.append(Prefix, Prefix+strlen(Prefix));
580 // FIXME: This will fail for weak globals with no names, this also depends
581 // on the mangling behavior of makeNameProper to mangle the section name
582 // before construction. Instead, this should use getNameWithPrefix on the
583 // global variable and the MCSection printing code should do the mangling.
584 Mang->makeNameProper(Name, GV->getName());
585
586 return getELFSection(Name.str(),
587 getELFSectionType(Name.str(), Kind),
582 Mang->getNameWithPrefix(Name, GV, false);
583
584 raw_svector_ostream OS(MangledName);
585 MCSymbol::printMangledName(Name, OS, 0);
586 OS.flush();
587
588 return getELFSection(MangledName.str(),
589 getELFSectionType(MangledName.str(), Kind),
588590 getELFSectionFlags(Kind),
589591 Kind);
590592 }