summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ELFTargetAsmInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-25 18:57:34 +0000
committerChris Lattner <sabre@nondot.org>2009-07-25 18:57:34 +0000
commit60f3b73e1119d985732c70df930deac9c45b205c (patch)
treee6191cc68c542eec8c8879ee599ee53c22f022c1 /llvm/lib/Target/ELFTargetAsmInfo.cpp
parent7b5e51091e02ae1a754bb787cb3f346981950a53 (diff)
downloadbcm5719-llvm-60f3b73e1119d985732c70df930deac9c45b205c.tar.gz
bcm5719-llvm-60f3b73e1119d985732c70df930deac9c45b205c.zip
this is (unfortunately) several changes mixed together:
1. Spell SectionFlags::Writeable as "Writable". 2. Add predicates for deriving SectionFlags from SectionKinds. 3. Sink ELF-specific getSectionPrefixForUniqueGlobal impl into ELFTargetAsmInfo. 4. Fix SectionFlagsForGlobal to know that BSS/ThreadBSS has the BSS bit set (the real fix for PR4619). 5. Fix isSuitableForBSS to not put globals with explicit sections set in BSS (which was the reason #4 wasn't fixed earlier). 6. Remove my previous hack for PR4619. llvm-svn: 77085
Diffstat (limited to 'llvm/lib/Target/ELFTargetAsmInfo.cpp')
-rw-r--r--llvm/lib/Target/ELFTargetAsmInfo.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/llvm/lib/Target/ELFTargetAsmInfo.cpp b/llvm/lib/Target/ELFTargetAsmInfo.cpp
index 9dd339ed0a2..ea078362116 100644
--- a/llvm/lib/Target/ELFTargetAsmInfo.cpp
+++ b/llvm/lib/Target/ELFTargetAsmInfo.cpp
@@ -29,20 +29,20 @@ ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM)
: TargetAsmInfo(TM) {
BSSSection_ = getUnnamedSection("\t.bss",
- SectionFlags::Writeable | SectionFlags::BSS);
+ SectionFlags::Writable | SectionFlags::BSS);
ReadOnlySection = getNamedSection("\t.rodata", SectionFlags::None);
TLSDataSection = getNamedSection("\t.tdata",
- SectionFlags::Writeable | SectionFlags::TLS);
+ SectionFlags::Writable | SectionFlags::TLS);
TLSBSSSection = getNamedSection("\t.tbss",
- SectionFlags::Writeable | SectionFlags::TLS | SectionFlags::BSS);
+ SectionFlags::Writable | SectionFlags::TLS | SectionFlags::BSS);
- DataRelSection = getNamedSection("\t.data.rel", SectionFlags::Writeable);
+ DataRelSection = getNamedSection("\t.data.rel", SectionFlags::Writable);
DataRelLocalSection = getNamedSection("\t.data.rel.local",
- SectionFlags::Writeable);
+ SectionFlags::Writable);
DataRelROSection = getNamedSection("\t.data.rel.ro",
- SectionFlags::Writeable);
+ SectionFlags::Writable);
DataRelROLocalSection = getNamedSection("\t.data.rel.ro.local",
- SectionFlags::Writeable);
+ SectionFlags::Writable);
}
@@ -145,6 +145,28 @@ unsigned ELFTargetAsmInfo::getFlagsForNamedSection(const char *Name) const {
}
+
+const char *
+ELFTargetAsmInfo::getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const{
+ switch (Kind) {
+ 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.";
+ case SectionKind::ThreadData: return ".gnu.linkonce.td.";
+ case SectionKind::ThreadBSS: return ".gnu.linkonce.tb.";
+ }
+}
+
+
+
const Section*
ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {
const TargetData *TD = TM.getTargetData();
@@ -177,7 +199,7 @@ std::string ELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
Flags += 'a';
if (flags & SectionFlags::Code)
Flags += 'x';
- if (flags & SectionFlags::Writeable)
+ if (flags & SectionFlags::Writable)
Flags += 'w';
if (flags & SectionFlags::Mergeable)
Flags += 'M';
OpenPOWER on IntegriCloud