diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-28 19:14:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-28 19:14:08 +0000 |
commit | a53735bcf1fae56a81f1a83f6988ff4eb6577c5c (patch) | |
tree | b62f6c526f7dc6501b01cbe35fd5ea4a02349239 /lib/MC/MCParser | |
parent | be560a3fb7f5d1901583d84e22b10aadb502b4af (diff) | |
download | llvm-a53735bcf1fae56a81f1a83f6988ff4eb6577c5c.tar.gz llvm-a53735bcf1fae56a81f1a83f6988ff4eb6577c5c.tar.bz2 llvm-a53735bcf1fae56a81f1a83f6988ff4eb6577c5c.tar.xz |
Map ELf flags back to more specific section kinds.
With that, convert another llc -filetype=obj test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser')
-rw-r--r-- | lib/MC/MCParser/ELFAsmParser.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp index dae9697e4e..d79dd670bb 100644 --- a/lib/MC/MCParser/ELFAsmParser.cpp +++ b/lib/MC/MCParser/ELFAsmParser.cpp @@ -269,11 +269,37 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) { return false; } -static SectionKind computeSectionKind(unsigned Flags) { +static SectionKind computeSectionKind(unsigned Flags, unsigned ElemSize) { if (Flags & ELF::SHF_EXECINSTR) return SectionKind::getText(); if (Flags & ELF::SHF_TLS) return SectionKind::getThreadData(); + if (Flags & ELF::SHF_MERGE) { + if (Flags & ELF::SHF_STRINGS) { + switch (ElemSize) { + default: + break; + case 1: + return SectionKind::getMergeable1ByteCString(); + case 2: + return SectionKind::getMergeable2ByteCString(); + case 4: + return SectionKind::getMergeable4ByteCString(); + } + } else { + switch (ElemSize) { + default: + break; + case 4: + return SectionKind::getMergeableConst4(); + case 8: + return SectionKind::getMergeableConst8(); + case 16: + return SectionKind::getMergeableConst16(); + } + } + } + return SectionKind::getDataRel(); } @@ -518,7 +544,7 @@ EndStmt: } } - SectionKind Kind = computeSectionKind(Flags); + SectionKind Kind = computeSectionKind(Flags, Size); getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type, Flags, Kind, Size, GroupName), |