diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-15 19:53:20 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-15 19:53:20 +0000 |
commit | 766f25306af343fb2784350cb4d8cd9ca180f0d3 (patch) | |
tree | c51638c97cb5a38503e0e178931d11ba13fc85d9 /lib/MC | |
parent | bcd9b3b6b119420edffd259e5e05c5e0cf5fbc6c (diff) | |
download | external_llvm-766f25306af343fb2784350cb4d8cd9ca180f0d3.zip external_llvm-766f25306af343fb2784350cb4d8cd9ca180f0d3.tar.gz external_llvm-766f25306af343fb2784350cb4d8cd9ca180f0d3.tar.bz2 |
ELF: Add support for the exclude section bit for gas compat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCParser/ELFAsmParser.cpp | 13 | ||||
-rw-r--r-- | lib/MC/MCSectionELF.cpp | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp index 67b0e5d..7b8a2d0 100644 --- a/lib/MC/MCParser/ELFAsmParser.cpp +++ b/lib/MC/MCParser/ELFAsmParser.cpp @@ -279,14 +279,17 @@ static SectionKind computeSectionKind(unsigned Flags) { return SectionKind::getDataRel(); } -static int parseSectionFlags(StringRef flagsStr, bool *UseLastGroup) { - int flags = 0; +static unsigned parseSectionFlags(StringRef flagsStr, bool *UseLastGroup) { + unsigned flags = 0; for (unsigned i = 0; i < flagsStr.size(); i++) { switch (flagsStr[i]) { case 'a': flags |= ELF::SHF_ALLOC; break; + case 'e': + flags |= ELF::SHF_EXCLUDE; + break; case 'x': flags |= ELF::SHF_EXECINSTR; break; @@ -315,7 +318,7 @@ static int parseSectionFlags(StringRef flagsStr, bool *UseLastGroup) { *UseLastGroup = true; break; default: - return -1; + return -1U; } } @@ -381,8 +384,8 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush) { StringRef FlagsStr = getTok().getStringContents(); Lex(); - int extraFlags = parseSectionFlags(FlagsStr, &UseLastGroup); - if (extraFlags < 0) + unsigned extraFlags = parseSectionFlags(FlagsStr, &UseLastGroup); + if (extraFlags == -1U) return TokError("unknown flag"); Flags |= extraFlags; diff --git a/lib/MC/MCSectionELF.cpp b/lib/MC/MCSectionELF.cpp index bf1a984..ff9c4d3 100644 --- a/lib/MC/MCSectionELF.cpp +++ b/lib/MC/MCSectionELF.cpp @@ -75,6 +75,8 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, OS << ",#execinstr"; if (Flags & ELF::SHF_WRITE) OS << ",#write"; + if (Flags & ELF::SHF_EXCLUDE) + OS << ",#exclude"; if (Flags & ELF::SHF_TLS) OS << ",#tls"; OS << '\n'; @@ -84,6 +86,8 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, OS << ",\""; if (Flags & ELF::SHF_ALLOC) OS << 'a'; + if (Flags & ELF::SHF_EXCLUDE) + OS << 'e'; if (Flags & ELF::SHF_EXECINSTR) OS << 'x'; if (Flags & ELF::SHF_GROUP) |