diff options
author | Marina Yatsina <marina.yatsina@intel.com> | 2016-03-22 11:23:15 +0000 |
---|---|---|
committer | Marina Yatsina <marina.yatsina@intel.com> | 2016-03-22 11:23:15 +0000 |
commit | 33ef7dad18c9fc3d5cc3c9ee3f3528e825f10e24 (patch) | |
tree | b7b1bc1154b33ad21aab345a8ab85ca62e21c9b6 /llvm/lib/MC/MCParser/ELFAsmParser.cpp | |
parent | 976921d4b4911394fe0e88b047a01dad5e85c701 (diff) | |
download | bcm5719-llvm-33ef7dad18c9fc3d5cc3c9ee3f3528e825f10e24.tar.gz bcm5719-llvm-33ef7dad18c9fc3d5cc3c9ee3f3528e825f10e24.zip |
[ELF][gcc compatibility]: support section names with special characters (e.g. "/")
Adding support for section names with special characters in them (e.g. "/").
GCC successfully compiles such section names.
This also fixes PR24520.
Differential Revision: http://reviews.llvm.org/D15678
llvm-svn: 264038
Diffstat (limited to 'llvm/lib/MC/MCParser/ELFAsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/ELFAsmParser.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp index 6cbcdec5e27..1e02f05abc4 100644 --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp @@ -229,22 +229,23 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) { } for (;;) { - unsigned CurSize; - + SMLoc PrevLoc = getLexer().getLoc(); - if (getLexer().is(AsmToken::Minus)) { - CurSize = 1; - Lex(); // Consume the "-". - } else if (getLexer().is(AsmToken::String)) { + if (getLexer().is(AsmToken::Comma) || + getLexer().is(AsmToken::EndOfStatement)) + break; + + unsigned CurSize; + if (getLexer().is(AsmToken::String)) { CurSize = getTok().getIdentifier().size() + 2; Lex(); } else if (getLexer().is(AsmToken::Identifier)) { CurSize = getTok().getIdentifier().size(); Lex(); } else { - break; + CurSize = getTok().getString().size(); + Lex(); } - Size += CurSize; SectionName = StringRef(FirstLoc.getPointer(), Size); |