summaryrefslogtreecommitdiff
path: root/test/MC/ELF
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-26 22:03:50 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-26 22:03:50 +0000
commitd0e4e96dc17a6c1c6de3340842c80f0e187ba349 (patch)
treeddf53b8bd9235bcb0b8aae16c5e22310dcdad665 /test/MC/ELF
parentcf099d11218cb6f6c5cce947d6738e347f07fb12 (diff)
Notes
Diffstat (limited to 'test/MC/ELF')
-rw-r--r--test/MC/ELF/bracket-exprs.s15
-rw-r--r--test/MC/ELF/bracket.s8
-rw-r--r--test/MC/ELF/org.s13
-rw-r--r--test/MC/ELF/pr9292.s26
-rw-r--r--test/MC/ELF/relocation-pc.s33
5 files changed, 95 insertions, 0 deletions
diff --git a/test/MC/ELF/bracket-exprs.s b/test/MC/ELF/bracket-exprs.s
new file mode 100644
index 0000000000000..96f9f9aa450aa
--- /dev/null
+++ b/test/MC/ELF/bracket-exprs.s
@@ -0,0 +1,15 @@
+// RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s
+
+// CHECK: .byte 1
+.if [~0 >> 1] == -1
+.byte 1
+.else
+.byte 2
+.endif
+
+// CHECK: .byte 3
+.if 4 * [4 + (3 + [2 * 2] + 1)] == 48
+.byte 3
+.else
+.byte 4
+.endif
diff --git a/test/MC/ELF/bracket.s b/test/MC/ELF/bracket.s
new file mode 100644
index 0000000000000..702e309ddeeb3
--- /dev/null
+++ b/test/MC/ELF/bracket.s
@@ -0,0 +1,8 @@
+// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t1 > %t2
+// RUN: FileCheck < %t1 %s
+
+// CHECK: error: expected ']' in brackets expression
+.size x, [.-x)
+
+// CHECK: error: expected ')' in parentheses expression
+.size y, (.-y]
diff --git a/test/MC/ELF/org.s b/test/MC/ELF/org.s
new file mode 100644
index 0000000000000..c073fa5d808e2
--- /dev/null
+++ b/test/MC/ELF/org.s
@@ -0,0 +1,13 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+ .zero 4
+foo:
+ .zero 4
+ .org foo+16
+
+// CHECK: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type',
+// CHECK-NEXT: ('sh_flags',
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset'
+// CHECK-NEXT: ('sh_size', 0x00000014)
diff --git a/test/MC/ELF/pr9292.s b/test/MC/ELF/pr9292.s
new file mode 100644
index 0000000000000..a198fed87949d
--- /dev/null
+++ b/test/MC/ELF/pr9292.s
@@ -0,0 +1,26 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that both foo and bar are undefined.
+
+.globl foo
+.globl bar
+mov %eax,bar
+
+
+// CHECK: (('st_name', 0x00000005) # 'bar'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/relocation-pc.s b/test/MC/ELF/relocation-pc.s
new file mode 100644
index 0000000000000..58c5f410b5174
--- /dev/null
+++ b/test/MC/ELF/relocation-pc.s
@@ -0,0 +1,33 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that we produce the correct relocation.
+
+ loope 0 # R_X86_64_PC8
+ jmp -256 # R_X86_64_PC32
+
+// CHECK: # Section 0x00000007
+// CHECK-NEXT: (('sh_name', 0x0000002c) # '.rela.text'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x000000e8)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000005)
+// CHECK-NEXT: ('sh_info', 0x00000001)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000001)
+// CHECK-NEXT: ('r_sym', 0x00000000)
+// CHECK-NEXT: ('r_type', 0x0000000f)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000003)
+// CHECK-NEXT: ('r_sym', 0x00000000)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),