summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2010-05-18 17:51:35 +0000
committerKevin Enderby <enderby@apple.com>2010-05-18 17:51:35 +0000
commitd8ba292c9bc4e0927ea21304d735e27a43d296a6 (patch)
tree85e558f4392ced53425d550050c14c47928d495e
parent6a8d2c6119aeb32ac914c3dd9b1263ebd0baa51f (diff)
downloadllvm-d8ba292c9bc4e0927ea21304d735e27a43d296a6.tar.gz
llvm-d8ba292c9bc4e0927ea21304d735e27a43d296a6.tar.bz2
llvm-d8ba292c9bc4e0927ea21304d735e27a43d296a6.tar.xz
Fixed the problem with a branch to "0b" that was not parsed by llvm-mc
correctly. The Lexer was incorrectly eating the newline casusing it to branch to address 0. Updated the test case to use a "0:" label and a branch to "0b". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104038 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/MC/MCParser/AsmLexer.cpp1
-rw-r--r--test/MC/MachO/direction_labels.s27
2 files changed, 15 insertions, 13 deletions
diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp
index e74eac5f62..32b446fce7 100644
--- a/lib/MC/MCParser/AsmLexer.cpp
+++ b/lib/MC/MCParser/AsmLexer.cpp
@@ -157,7 +157,6 @@ AsmToken AsmLexer::LexDigit() {
if (CurPtr[0] == '\n') {
--CurPtr;
StringRef Result(TokStart, CurPtr - TokStart);
- ++CurPtr;
return AsmToken(AsmToken::Integer, Result, 0);
}
const char *NumStart = CurPtr;
diff --git a/test/MC/MachO/direction_labels.s b/test/MC/MachO/direction_labels.s
index c3d4869f58..5a68f7f51d 100644
--- a/test/MC/MachO/direction_labels.s
+++ b/test/MC/MachO/direction_labels.s
@@ -1,12 +1,15 @@
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s
direction_labels:
-10: nop
- jmp 10b
- nop
- jmp 11f
-11: nop
- ret
+10: nop
+ jmp 10b
+ nop
+ jne 0f
+0: nop
+ jne 0b
+ jmp 11f
+11: nop
+ ret
// CHECK: ('cputype', 7)
// CHECK: ('cpusubtype', 3)
@@ -20,9 +23,9 @@ direction_labels:
// CHECK: ('size', 124)
// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK: ('vm_addr', 0)
-// CHECK: ('vm_size', 8)
+// CHECK: ('vm_size', 13)
// CHECK: ('file_offset', 256)
-// CHECK: ('file_size', 8)
+// CHECK: ('file_size', 13)
// CHECK: ('maxprot', 7)
// CHECK: ('initprot', 7)
// CHECK: ('num_sections', 1)
@@ -32,7 +35,7 @@ direction_labels:
// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK: ('address', 0)
-// CHECK: ('size', 8)
+// CHECK: ('size', 13)
// CHECK: ('offset', 256)
// CHECK: ('alignment', 0)
// CHECK: ('reloc_offset', 0)
@@ -43,15 +46,15 @@ direction_labels:
// CHECK: ),
// CHECK: ('_relocations', [
// CHECK: ])
-// CHECK: ('_section_data', '\x90\xeb\xfd\x90\xeb\x00\x90\xc3')
+// CHECK: ('_section_data', '\x90\xeb\xfd\x90u\x00\x90u\xfd\xeb\x00\x90\xc3')
// CHECK: ])
// CHECK: ),
// CHECK: # Load Command 1
// CHECK: (('command', 2)
// CHECK: ('size', 24)
-// CHECK: ('symoff', 264)
+// CHECK: ('symoff', 272)
// CHECK: ('nsyms', 1)
-// CHECK: ('stroff', 276)
+// CHECK: ('stroff', 284)
// CHECK: ('strsize', 20)
// CHECK: ('_string_data', '\x00direction_labels\x00\x00\x00')
// CHECK: ('_symbols', [