mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
[MC] - Disallow invalid section groups declarations.
This fixes parseGroup() so that it always sets error condition on error. Previously it was not done, because parseIdentifier looks never do that, assuming that caller should do it if he wants to. So previously cases from test were silently accepted and produced broken output. Differential revision: https://reviews.llvm.org/D41559 llvm-svn: 321439
This commit is contained in:
parent
ee9e4fc042
commit
6481dde696
@ -427,13 +427,13 @@ bool ELFAsmParser::parseGroup(StringRef &GroupName) {
|
||||
GroupName = getTok().getString();
|
||||
Lex();
|
||||
} else if (getParser().parseIdentifier(GroupName)) {
|
||||
return true;
|
||||
return TokError("invalid group name");
|
||||
}
|
||||
if (L.is(AsmToken::Comma)) {
|
||||
Lex();
|
||||
StringRef Linkage;
|
||||
if (getParser().parseIdentifier(Linkage))
|
||||
return true;
|
||||
return TokError("invalid linkage");
|
||||
if (Linkage != "comdat")
|
||||
return TokError("Linkage must be 'comdat'");
|
||||
}
|
||||
|
14
test/MC/ELF/comdat-declaration-errors.s
Normal file
14
test/MC/ELF/comdat-declaration-errors.s
Normal file
@ -0,0 +1,14 @@
|
||||
// RUN: not llvm-mc -triple x86_64-pc-linux-gnu %s \
|
||||
// RUN: -filetype=obj -o %t.o 2>&1 | FileCheck %s
|
||||
|
||||
// Check we error out on incorrect COMDATs declarations
|
||||
// and not just silently ingnore them.
|
||||
|
||||
// CHECK: error: invalid group name
|
||||
// CHECK-NEXT: .section .foo,"G",@progbits,-abc,comdat
|
||||
|
||||
// CHECK: error: invalid linkage
|
||||
// CHECK-NEXT: .section .bar,"G",@progbits,abc,-comdat
|
||||
|
||||
.section .foo,"G",@progbits,-abc,comdat
|
||||
.section .bar,"G",@progbits,abc,-comdat
|
Loading…
Reference in New Issue
Block a user