summaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorDavid Peixotto <dpeixott@codeaurora.org>2013-12-06 20:35:58 +0000
committerDavid Peixotto <dpeixott@codeaurora.org>2013-12-06 20:35:58 +0000
commitd05b93515d19f2462909676db3e32ea08a6e359f (patch)
tree2760a61fb5f77553a1012da407931d0c3085db0d /test/MC
parent3221b5bd23ed14b381b29652b1756ef7e40e7f02 (diff)
downloadllvm-d05b93515d19f2462909676db3e32ea08a6e359f.tar.gz
llvm-d05b93515d19f2462909676db3e32ea08a6e359f.tar.bz2
llvm-d05b93515d19f2462909676db3e32ea08a6e359f.tar.xz
Integrated assembler incorrectly lexes ARM-style comments
The integrated assembler fails to properly lex arm comments when they are adjacent to an identifier in the input stream. The reason is that the arm comment symbol '@' is also used as symbol variant in other assembly languages so when lexing an identifier it allows the '@' symbol as part of the identifier. Example: $ cat comment.s foo: add r0, r0@got to parse this as a comment $ llvm-mc -triple armv7 comment.s comment.s:4:18: error: unexpected token in argument list add r0, r0@got to parse this as a comment ^ This should be parsed as correctly as `add r0, r0`. This commit modifes the assembly lexer to not include the '@' symbol in identifiers when lexing for targets that use '@' for comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/ARM/comment.s24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/MC/ARM/comment.s b/test/MC/ARM/comment.s
new file mode 100644
index 0000000000..e95f313aca
--- /dev/null
+++ b/test/MC/ARM/comment.s
@@ -0,0 +1,24 @@
+@ Tests to check that '@' does not get lexed as an identifier for arm
+@ RUN: llvm-mc %s -triple=armv7-linux-gnueabi | FileCheck %s
+@ RUN: llvm-mc %s -triple=armv7-linux-gnueabi 2>&1 | FileCheck %s --check-prefix=ERROR
+
+foo:
+ bl boo@plt should be ignored
+ bl goo@plt
+ .long bar@got to parse this as a comment
+ .long baz@got
+ add r0, r0@ignore this extra junk
+
+@CHECK-LABEL: foo:
+@CHECK: bl boo
+@CHECK-NOT: @
+@CHECK: bl goo
+@CHECK-NOT: @
+@CHECK: .long bar
+@CHECK-NOT: @
+@CHECK: .long baz
+@CHECK-NOT: @
+@CHECK: add r0, r0
+@CHECK-NOT: @
+
+@ERROR-NOT: error: