MC: Diagnose an unexpected token in COFF .section instead of asserting

This can easily arise when trying to assemble and ELF style .section
directive for a COFF object file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215373 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner 2014-08-11 18:34:43 +00:00
parent a7f0941b83
commit b81e6cf6c5
2 changed files with 7 additions and 0 deletions

View File

@ -364,6 +364,10 @@ bool COFFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
Flags |= COFF::IMAGE_SCN_LNK_COMDAT;
if (!getLexer().is(AsmToken::Identifier))
return TokError("expected comdat type such as 'discard' or 'largest' "
"after protection bits");
if (parseCOMDATType(Type))
return true;

View File

@ -6,3 +6,6 @@
// CHECK: error: conflicting section flags 'b' and 'd'
.section s_bd,"bd"; .long 1
// CHECK: error: expected comdat type such as 'discard' or 'largest' after protection bits
.section .stack, "w", @nobits