aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/ELFAsmParser.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-24 21:57:39 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-24 21:57:39 +0000
commit25958730dffe0a16f9c251a1fa317799b8419a1f (patch)
treea9223e455a84f95e29c73b82f114b6d3ef344857 /lib/MC/MCParser/ELFAsmParser.cpp
parent8b4e60c276fc2e7f01a07343197d3956d3526d8d (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/ELFAsmParser.cpp')
-rw-r--r--lib/MC/MCParser/ELFAsmParser.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp
index d074ea9d78..42cd919472 100644
--- a/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/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));