diff --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp b/llvm/lib/MC/MCParser/COFFAsmParser.cpp index 649023b59bbbe..dec004eb6f953 100644 --- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp @@ -321,7 +321,7 @@ bool COFFAsmParser::ParseSectionSwitch(StringRef Section, } bool COFFAsmParser::ParseSectionName(StringRef &SectionName) { - if (!getLexer().is(AsmToken::Identifier)) + if (!getLexer().is(AsmToken::Identifier) && !getLexer().is(AsmToken::String)) return true; SectionName = getTok().getIdentifier(); diff --git a/llvm/test/MC/COFF/section.s b/llvm/test/MC/COFF/section.s index b7b5422babdb4..5116d179f16d9 100644 --- a/llvm/test/MC/COFF/section.s +++ b/llvm/test/MC/COFF/section.s @@ -190,5 +190,11 @@ // CHECK-NEXT: ] // CHECK: } +/// The section name can be quoted. +.section "@#$-{","n" +// CHECK: Section { +// CHECK-NEXT: Number: +// CHECK-NEXT: Name: @#$-{ +// CHECK-NOT: Section { // CHECK: ]