From e640c6f765c82c0fefd3b231e0e7022d33cc82c9 Mon Sep 17 00:00:00 2001 From: Prakhar Bahuguna Date: Thu, 15 Dec 2016 07:59:15 +0000 Subject: Allow ELF section flags to be specified numerically Summary: GAS already allows flags for sections to be specified directly as a numeric value. This functionality is particularly useful for setting processor or application-specific values that may not be directly supported or understood by LLVM. This patch allows LLVM to use numeric section flag values verbatim if specified by the assembly file. Reviewers: grosbach, rafael, t.p.northover, rengolin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27451 llvm-svn: 289785 --- llvm/lib/MC/MCParser/ELFAsmParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/MC/MCParser/ELFAsmParser.cpp') diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp index 8bfb475635c..8d7ba0d0336 100644 --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp @@ -264,6 +264,10 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) { static unsigned parseSectionFlags(StringRef flagsStr, bool *UseLastGroup) { unsigned flags = 0; + // If a valid numerical value is set for the section flag, use it verbatim + if (!flagsStr.getAsInteger(0, flags)) + return flags; + for (char i : flagsStr) { switch (i) { case 'a': -- cgit v1.2.3