[PATCH] D41559: [MC] - Disallow invalid section groups declarations.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 25 01:41:56 PST 2017
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL321439: [MC] - Disallow invalid section groups declarations. (authored by grimar, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41559?vs=128100&id=128131#toc
Repository:
rL LLVM
https://reviews.llvm.org/D41559
Files:
llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
llvm/trunk/test/MC/ELF/comdat-declaration-errors.s
Index: llvm/trunk/test/MC/ELF/comdat-declaration-errors.s
===================================================================
--- llvm/trunk/test/MC/ELF/comdat-declaration-errors.s
+++ llvm/trunk/test/MC/ELF/comdat-declaration-errors.s
@@ -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", at progbits,-abc,comdat
+
+// CHECK: error: invalid linkage
+// CHECK-NEXT: .section .bar,"G", at progbits,abc,-comdat
+
+.section .foo,"G", at progbits,-abc,comdat
+.section .bar,"G", at progbits,abc,-comdat
Index: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
@@ -427,13 +427,13 @@
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'");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41559.128131.patch
Type: text/x-patch
Size: 1416 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171225/b31b8edf/attachment.bin>
More information about the llvm-commits
mailing list