diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-24 21:57:39 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-24 21:57:39 +0000 |
commit | 9f75d5df0b4412e3204946a04b0695c36dab24ee (patch) | |
tree | 2c2c31fccc63ad1755299b7da8540620b92ddd64 /llvm/lib/MC/MCParser/ELFAsmParser.cpp | |
parent | 72b1968d927bc8f13bb58914b1d7bbdc826aba67 (diff) | |
download | bcm5719-llvm-9f75d5df0b4412e3204946a04b0695c36dab24ee.tar.gz bcm5719-llvm-9f75d5df0b4412e3204946a04b0695c36dab24ee.zip |
Behave a bit more like gnu as and use the symbol (instead of the section)
for any relocation to a symbol defined in a tls section.
llvm-svn: 120121
Diffstat (limited to 'llvm/lib/MC/MCParser/ELFAsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/ELFAsmParser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp index d074ea9d781..42cd9194726 100644 --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp @@ -193,6 +193,14 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) { return false; } +static SectionKind computeSectionKind(unsigned Flags) { + if (Flags & MCSectionELF::SHF_EXECINSTR) + return SectionKind::getText(); + if (Flags & MCSectionELF::SHF_TLS) + return SectionKind::getThreadData(); + return SectionKind::getDataRel(); +} + // FIXME: This is a work in progress. bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) { StringRef SectionName; @@ -322,9 +330,7 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) { return TokError("unknown section type"); } - SectionKind Kind = (Flags & MCSectionELF::SHF_EXECINSTR) - ? SectionKind::getText() - : SectionKind::getDataRel(); + SectionKind Kind = computeSectionKind(Flags); getStreamer().SwitchSection(getContext().getELFSection(SectionName, Type, Flags, Kind, Size, GroupName)); |