fix a fixme: don't create an explicit "CStringSection" for ELF,

it is just being used as a prefix, so forward substitute it directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78067 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-08-04 16:19:50 +00:00
parent 1850e5add1
commit 7e88a50428
2 changed files with 4 additions and 11 deletions

View File

@@ -187,8 +187,6 @@ protected:
/// ///
const MCSection *TLSBSSSection; // Defaults to ".tbss". const MCSection *TLSBSSSection; // Defaults to ".tbss".
const MCSection *CStringSection;
const MCSection *DataRelSection; const MCSection *DataRelSection;
const MCSection *DataRelLocalSection; const MCSection *DataRelLocalSection;
const MCSection *DataRelROSection; const MCSection *DataRelROSection;

View File

@@ -320,10 +320,6 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
TLSDataSection = TLSDataSection =
getOrCreateSection("\t.tdata", false, SectionKind::getThreadData()); getOrCreateSection("\t.tdata", false, SectionKind::getThreadData());
// FIXME: No reason to make this.
CStringSection = getOrCreateSection("\t.rodata.str", true,
SectionKind::getMergeable1ByteCString());
TLSBSSSection = getOrCreateSection("\t.tbss", false, TLSBSSSection = getOrCreateSection("\t.tbss", false,
SectionKind::getThreadBSS()); SectionKind::getThreadBSS());
@@ -511,7 +507,6 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
if (Kind.isMergeable1ByteCString() || if (Kind.isMergeable1ByteCString() ||
Kind.isMergeable2ByteCString() || Kind.isMergeable2ByteCString() ||
Kind.isMergeable4ByteCString()) { Kind.isMergeable4ByteCString()) {
assert(CStringSection && "Should have string section prefix");
// We also need alignment here. // We also need alignment here.
// FIXME: this is getting the alignment of the character, not the // FIXME: this is getting the alignment of the character, not the
@@ -519,16 +514,16 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
unsigned Align = unsigned Align =
TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV)); TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
const char *SizeSpec = "1."; const char *SizeSpec = ".rodata.str1.";
if (Kind.isMergeable2ByteCString()) if (Kind.isMergeable2ByteCString())
SizeSpec = "2."; SizeSpec = ".rodata.str2.";
else if (Kind.isMergeable4ByteCString()) else if (Kind.isMergeable4ByteCString())
SizeSpec = "4."; SizeSpec = ".rodata.str4.";
else else
assert(Kind.isMergeable1ByteCString() && "unknown string width"); assert(Kind.isMergeable1ByteCString() && "unknown string width");
std::string Name = CStringSection->getName() + SizeSpec + utostr(Align); std::string Name = SizeSpec + utostr(Align);
return getOrCreateSection(Name.c_str(), false, Kind); return getOrCreateSection(Name.c_str(), false, Kind);
} }