diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-24 04:49:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-24 04:49:34 +0000 |
commit | 0f5ebf55091ac924756f84738e6140b0a1f4dcb1 (patch) | |
tree | ac3e320006ca55751b89c78d907f37d006cf6505 /llvm/lib/Target/TargetAsmInfo.cpp | |
parent | 3075428d16487485f39bd6d4a053da50cf83e203 (diff) | |
download | bcm5719-llvm-0f5ebf55091ac924756f84738e6140b0a1f4dcb1.tar.gz bcm5719-llvm-0f5ebf55091ac924756f84738e6140b0a1f4dcb1.zip |
Replace UniqueSectionForGlobal with getSectionPrefixForUniqueGlobal.
The later doesn't depend on any crazy LLVM IR stuff, and this
pulls the concatenation of prefix with GV name (the root problem behind
PR4584) out one level.
llvm-svn: 76948
Diffstat (limited to 'llvm/lib/Target/TargetAsmInfo.cpp')
-rw-r--r-- | llvm/lib/Target/TargetAsmInfo.cpp | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp index bf543cc4ec3..d13a3226cfa 100644 --- a/llvm/lib/Target/TargetAsmInfo.cpp +++ b/llvm/lib/Target/TargetAsmInfo.cpp @@ -305,7 +305,8 @@ TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); if (GV->isWeakForLinker()) { - std::string Name = UniqueSectionForGlobal(GV, Kind); + // FIXME: Use mangler interface (PR4584). + std::string Name = getSectionPrefixForUniqueGlobal(Kind)+GV->getName(); unsigned Flags = SectionFlagsForGlobal(GV, Name.c_str()); return getNamedSection(Name.c_str(), Flags); } else { @@ -334,34 +335,22 @@ TargetAsmInfo::getSectionForMergableConstant(uint64_t Size, -std::string -TargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV, - SectionKind::Kind Kind) const { +const char * +TargetAsmInfo::getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const { switch (Kind) { - case SectionKind::Text: - return ".gnu.linkonce.t." + GV->getNameStr(); - case SectionKind::Data: - return ".gnu.linkonce.d." + GV->getNameStr(); - case SectionKind::DataRel: - return ".gnu.linkonce.d.rel" + GV->getNameStr(); - case SectionKind::DataRelLocal: - return ".gnu.linkonce.d.rel.local" + GV->getNameStr(); - case SectionKind::DataRelRO: - return ".gnu.linkonce.d.rel.ro" + GV->getNameStr(); - case SectionKind::DataRelROLocal: - return ".gnu.linkonce.d.rel.ro.local" + GV->getNameStr(); - case SectionKind::BSS: - return ".gnu.linkonce.b." + GV->getNameStr(); + default: llvm_unreachable("Unknown section kind"); + case SectionKind::Text: return ".gnu.linkonce.t."; + case SectionKind::Data: return ".gnu.linkonce.d."; + case SectionKind::DataRel: return ".gnu.linkonce.d.rel."; + case SectionKind::DataRelLocal: return ".gnu.linkonce.d.rel.local."; + case SectionKind::DataRelRO: return ".gnu.linkonce.d.rel.ro."; + case SectionKind::DataRelROLocal: return ".gnu.linkonce.d.rel.ro.local."; + case SectionKind::BSS: return ".gnu.linkonce.b."; case SectionKind::ROData: case SectionKind::RODataMergeConst: - case SectionKind::RODataMergeStr: - return ".gnu.linkonce.r." + GV->getNameStr(); - case SectionKind::ThreadData: - return ".gnu.linkonce.td." + GV->getNameStr(); - case SectionKind::ThreadBSS: - return ".gnu.linkonce.tb." + GV->getNameStr(); - default: - llvm_unreachable("Unknown section kind"); + case SectionKind::RODataMergeStr: return ".gnu.linkonce.r."; + case SectionKind::ThreadData: return ".gnu.linkonce.td."; + case SectionKind::ThreadBSS: return ".gnu.linkonce.tb."; } return NULL; } |