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 | c44c26b4e13d5cbbc22231a73e9240c1d425b9c6 (patch) | |
| tree | 0b08b9684b801ba110907177f00dc08eda65f2f1 /llvm/lib/MC/MCParser | |
| parent | b5ecb908af568f2fa44ffcd61fb7589f2f6134b4 (diff) | |
| download | bcm5719-llvm-c44c26b4e13d5cbbc22231a73e9240c1d425b9c6.tar.gz bcm5719-llvm-c44c26b4e13d5cbbc22231a73e9240c1d425b9c6.zip | |
Map ELf flags back to more specific section kinds.
With that, convert another llc -filetype=obj test.
llvm-svn: 205031
Diffstat (limited to 'llvm/lib/MC/MCParser')
| -rw-r--r-- | llvm/lib/MC/MCParser/ELFAsmParser.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp index dae9697e4ef..d79dd670bb2 100644 --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/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), |

