diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/MC/MCParser/ELFAsmParser.cpp | 17 | ||||
-rw-r--r-- | llvm/test/MC/ELF/section.s | 4 |
2 files changed, 13 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); diff --git a/llvm/test/MC/ELF/section.s b/llvm/test/MC/ELF/section.s index 008c4605552..0277be52236 100644 --- a/llvm/test/MC/ELF/section.s +++ b/llvm/test/MC/ELF/section.s @@ -6,11 +6,15 @@ .section .note.GNU-stack2,"",%progbits .section .note.GNU-,"",@progbits .section -.note.GNU,"","progbits" +.section src/stack.c,"",@progbits +.section ~!@$%^&*()_-+={[}]|\\:<>,"",@progbits // CHECK: Name: .note.GNU-stack // CHECK: Name: .note.GNU-stack2 // CHECK: Name: .note.GNU- // CHECK: Name: -.note.GNU +// CHECK: Name: src/stack.c +// CHECK: Name: ~!@$%^&*()_-+={[}]|\\:<> // Test that the defaults are used |