--- Reverse-merging r195823 into '.':

U    lib/MC/MCSectionCOFF.cpp
U    lib/CodeGen/TargetLoweringObjectFileImpl.cpp
U    test/MC/COFF/weak-symbol.ll
U    test/MC/COFF/tricky-names.ll
 G   .
--- Recording mergeinfo for reverse merge of r195823 into '.':
 G   .



git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2013-12-01 04:40:32 +00:00
parent 11e571c954
commit d0cf77ad59
4 changed files with 44 additions and 41 deletions
+21 -17
View File
@@ -723,31 +723,33 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const {
int Selection = 0;
unsigned Characteristics = getCOFFSectionFlags(Kind);
StringRef Name = GV->getSection();
StringRef COMDATSymName = "";
SmallString<128> Name(GV->getSection().c_str());
if (GV->isWeakForLinker()) {
Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
MCSymbol *Sym = getSymbol(*Mang, GV);
COMDATSymName = Sym->getName();
Name.append("$");
Mang->getNameWithPrefix(Name, GV, false, false);
}
return getContext().getCOFFSection(Name,
Characteristics,
Kind,
COMDATSymName,
"",
Selection);
}
static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
if (Kind.isText())
return ".text";
return ".text$";
if (Kind.isBSS ())
return ".bss";
if (Kind.isThreadLocal())
return ".tls";
return ".bss$";
if (Kind.isThreadLocal()) {
// 'LLVM' is just an arbitary string to ensure that the section name gets
// sorted in between '.tls$AAA' and '.tls$ZZZ' by the linker.
return ".tls$LLVM";
}
if (Kind.isWriteable())
return ".data";
return ".rdata";
return ".data$";
return ".rdata$";
}
@@ -758,14 +760,16 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
// If this global is linkonce/weak and the target handles this by emitting it
// into a 'uniqued' section name, create and return the section now.
if (GV->isWeakForLinker()) {
const char *Name = getCOFFSectionNameForUniqueGlobal(Kind);
const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
Mang->getNameWithPrefix(Name, GV, false, false);
unsigned Characteristics = getCOFFSectionFlags(Kind);
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
MCSymbol *Sym = getSymbol(*Mang, GV);
return getContext().getCOFFSection(Name, Characteristics,
Kind, Sym->getName(),
COFF::IMAGE_COMDAT_SELECT_ANY);
return getContext().getCOFFSection(Name.str(), Characteristics,
Kind, "", COFF::IMAGE_COMDAT_SELECT_ANY);
}
if (Kind.isText())