summaryrefslogtreecommitdiffstats
path: root/test/MC/ELF
diff options
context:
space:
mode:
Diffstat (limited to 'test/MC/ELF')
-rw-r--r--test/MC/ELF/abs.s16
-rw-r--r--test/MC/ELF/alias-reloc.s52
-rw-r--r--test/MC/ELF/alias.s85
-rw-r--r--test/MC/ELF/align-bss.s17
-rw-r--r--test/MC/ELF/align-nops.s40
-rw-r--r--test/MC/ELF/align-size.s13
-rw-r--r--test/MC/ELF/align-text.s19
-rw-r--r--test/MC/ELF/align.s32
-rw-r--r--test/MC/ELF/bad-section.s9
-rw-r--r--test/MC/ELF/basic-elf-32.s78
-rw-r--r--test/MC/ELF/basic-elf-64.s82
-rw-r--r--test/MC/ELF/call-abs.s24
-rw-r--r--test/MC/ELF/cfi-advance-loc2.s45
-rw-r--r--test/MC/ELF/cfi-def-cfa-offset.s46
-rw-r--r--test/MC/ELF/cfi-def-cfa-register.s41
-rw-r--r--test/MC/ELF/cfi-def-cfa.s42
-rw-r--r--test/MC/ELF/cfi-offset.s42
-rw-r--r--test/MC/ELF/cfi-remember.s45
-rw-r--r--test/MC/ELF/cfi-zero-addr-delta.s48
-rw-r--r--test/MC/ELF/cfi.s674
-rw-r--r--test/MC/ELF/comdat.s86
-rw-r--r--test/MC/ELF/common.s88
-rw-r--r--test/MC/ELF/common2.s21
-rw-r--r--test/MC/ELF/debug-line.s22
-rw-r--r--test/MC/ELF/debug-loc.s32
-rw-r--r--test/MC/ELF/dg.exp2
-rw-r--r--test/MC/ELF/diff.s15
-rw-r--r--test/MC/ELF/diff2.s13
-rw-r--r--test/MC/ELF/elf_directive_previous.s13
-rw-r--r--test/MC/ELF/elf_directive_section.s23
-rw-r--r--test/MC/ELF/empty-dwarf-lines.s21
-rw-r--r--test/MC/ELF/empty.s70
-rw-r--r--test/MC/ELF/entsize.ll44
-rw-r--r--test/MC/ELF/entsize.s69
-rw-r--r--test/MC/ELF/file.s23
-rw-r--r--test/MC/ELF/global-offset.s18
-rw-r--r--test/MC/ELF/got.s25
-rw-r--r--test/MC/ELF/ident.s17
-rw-r--r--test/MC/ELF/invalid-symver.s7
-rw-r--r--test/MC/ELF/leb128.s19
-rw-r--r--test/MC/ELF/local-reloc.s31
-rw-r--r--test/MC/ELF/merge.s97
-rw-r--r--test/MC/ELF/n_bytes.s20
-rw-r--r--test/MC/ELF/no-fixup.s16
-rw-r--r--test/MC/ELF/noexec.s24
-rw-r--r--test/MC/ELF/norelocation.s18
-rw-r--r--test/MC/ELF/pic-diff.s29
-rw-r--r--test/MC/ELF/plt.s14
-rw-r--r--test/MC/ELF/relax-arith.s75
-rw-r--r--test/MC/ELF/relax-crash.s11
-rw-r--r--test/MC/ELF/relax.s27
-rw-r--r--test/MC/ELF/relocation-386.s226
-rw-r--r--test/MC/ELF/relocation.s114
-rw-r--r--test/MC/ELF/rename.s46
-rw-r--r--test/MC/ELF/section.s110
-rw-r--r--test/MC/ELF/set.s34
-rw-r--r--test/MC/ELF/sleb.s29
-rw-r--r--test/MC/ELF/symref.s165
-rw-r--r--test/MC/ELF/tls-i386.s64
-rw-r--r--test/MC/ELF/tls.s48
-rw-r--r--test/MC/ELF/type.s32
-rw-r--r--test/MC/ELF/uleb.s22
-rw-r--r--test/MC/ELF/undef.s46
-rw-r--r--test/MC/ELF/undef2.s10
-rw-r--r--test/MC/ELF/weak.s30
-rw-r--r--test/MC/ELF/weakref-plt.s8
-rw-r--r--test/MC/ELF/weakref-reloc.s49
-rw-r--r--test/MC/ELF/weakref.s234
-rw-r--r--test/MC/ELF/zero.s16
69 files changed, 3722 insertions, 1 deletions
diff --git a/test/MC/ELF/abs.s b/test/MC/ELF/abs.s
new file mode 100644
index 0000000..c598b11
--- /dev/null
+++ b/test/MC/ELF/abs.s
@@ -0,0 +1,16 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that zed will be an ABS symbol
+
+.Lfoo:
+.Lbar:
+ zed = .Lfoo - .Lbar
+
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000001) # 'zed'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x0000fff1)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
diff --git a/test/MC/ELF/alias-reloc.s b/test/MC/ELF/alias-reloc.s
new file mode 100644
index 0000000..c908c12
--- /dev/null
+++ b/test/MC/ELF/alias-reloc.s
@@ -0,0 +1,52 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that this produces a R_X86_64_PLT32 with bar.
+
+ .globl foo
+foo:
+bar = foo
+ .section zed, "", @progbits
+ call bar@PLT
+
+
+// Test that this produres a relocation with bar2
+
+ .weak foo2
+foo2:
+ .weak bar2
+ .set bar2,foo2
+ .quad bar2
+
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000005) # 'bar'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+
+// CHECK: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x0000000e) # 'bar2'
+// CHECK-NEXT: ('st_bind', 0x00000002)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000004)
+// CHECK-NEXT: ('st_value', 0x0000000000000005)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000001)
+// CHECK-NEXT: ('r_sym', 0x00000001)
+// CHECK-NEXT: ('r_type', 0x00000004)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),
+
+// CHECK: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000005)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/alias.s b/test/MC/ELF/alias.s
new file mode 100644
index 0000000..42d54bc
--- /dev/null
+++ b/test/MC/ELF/alias.s
@@ -0,0 +1,85 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+foo:
+bar = foo
+
+ .globl foo2
+foo2 = bar2
+
+foo3:
+ .globl bar3
+bar3 = foo3
+
+// Test that bar4 is also a function
+ .type foo4,@function
+foo4:
+bar4 = foo4
+
+ .long foo2
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000005) # 'bar'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x0000001d) # 'bar4'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000002)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000003
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x0000000e) # 'foo3'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000018) # 'foo4'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000002)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000008
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000009
+// CHECK-NEXT: (('st_name', 0x00000013) # 'bar3'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK: # Symbol 0x0000000a
+// CHECK-NEXT: (('st_name', 0x00000009) # 'bar2'
+// 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)
diff --git a/test/MC/ELF/align-bss.s b/test/MC/ELF/align-bss.s
new file mode 100644
index 0000000..4f73a29
--- /dev/null
+++ b/test/MC/ELF/align-bss.s
@@ -0,0 +1,17 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the bss section is correctly aligned
+
+ .local foo
+ .comm foo,2048,16
+
+// CHECK: ('sh_name', 0x0000000d) # '.bss'
+// CHECK-NEXT: ('sh_type', 0x00000008)
+// CHECK-NEXT: ('sh_flags', 0x00000003)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000800)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000010)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
diff --git a/test/MC/ELF/align-nops.s b/test/MC/ELF/align-nops.s
new file mode 100644
index 0000000..28d4b89
--- /dev/null
+++ b/test/MC/ELF/align-nops.s
@@ -0,0 +1,40 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that we get optimal nops in text
+ .text
+f0:
+ .long 0
+ .align 8, 0x00000090
+ .long 0
+ .align 8
+
+// But not in another section
+ .data
+ .long 0
+ .align 8, 0x00000090
+ .long 0
+ .align 8
+
+// CHECK: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000010)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '00000000 0f1f4000 00000000 0f1f4000')
+
+// CHECK: (('sh_name', 0x00000007) # '.data'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000003)
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000010)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '00000000 90909090 00000000 00000000')
diff --git a/test/MC/ELF/align-size.s b/test/MC/ELF/align-size.s
new file mode 100644
index 0000000..85331d7
--- /dev/null
+++ b/test/MC/ELF/align-size.s
@@ -0,0 +1,13 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the alignment does contribute to the size of the section.
+
+ .zero 4
+ .align 8
+
+// CHECK: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000008)
diff --git a/test/MC/ELF/align-text.s b/test/MC/ELF/align-text.s
new file mode 100644
index 0000000..1d2dacb
--- /dev/null
+++ b/test/MC/ELF/align-text.s
@@ -0,0 +1,19 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the .text directive doesn't cause alignment.
+
+ .zero 1
+ .text
+ .zero 1
+
+// CHECK: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000002)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/align.s b/test/MC/ELF/align.s
new file mode 100644
index 0000000..c3912a7
--- /dev/null
+++ b/test/MC/ELF/align.s
@@ -0,0 +1,32 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the alignment of rodata doesn't force a alignment of the
+// previous section (.bss)
+
+ nop
+ .section .rodata,"a",@progbits
+ .align 8
+
+// CHECK: # Section 0x00000003
+// CHECK-NEXT: (('sh_name', 0x0000000d) # '.bss'
+// CHECK-NEXT: ('sh_type', 0x00000008)
+// CHECK-NEXT: ('sh_flags', 0x00000003)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000044)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.rodata'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000048)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
diff --git a/test/MC/ELF/bad-section.s b/test/MC/ELF/bad-section.s
new file mode 100644
index 0000000..73d89ce
--- /dev/null
+++ b/test/MC/ELF/bad-section.s
@@ -0,0 +1,9 @@
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o /dev/null 2>%t
+// RUN: FileCheck --input-file=%t %s
+
+// CHECK: error: unexpected token in directive
+// CHECK: .section "foo"-bar
+
+// test that we don't accept this, as gas doesn't.
+
+.section "foo"-bar
diff --git a/test/MC/ELF/basic-elf-32.s b/test/MC/ELF/basic-elf-32.s
new file mode 100644
index 0000000..fa97da4
--- /dev/null
+++ b/test/MC/ELF/basic-elf-32.s
@@ -0,0 +1,78 @@
+// RUN: llvm-mc -filetype=obj -triple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+ .text
+ .globl main
+ .align 16, 0x90
+ .type main,@function
+main: # @main
+# BB#0:
+ subl $4, %esp
+ movl $.L.str1, (%esp)
+ calll puts
+ movl $.L.str2, (%esp)
+ calll puts
+ xorl %eax, %eax
+ addl $4, %esp
+ ret
+.Ltmp0:
+ .size main, .Ltmp0-main
+
+ .type .L.str1,@object # @.str1
+ .section .rodata.str1.1,"aMS",@progbits,1
+.L.str1:
+ .asciz "Hello"
+ .size .L.str1, 6
+
+ .type .L.str2,@object # @.str2
+.L.str2:
+ .asciz "World!"
+ .size .L.str2, 7
+
+ .section .note.GNU-stack,"",@progbits
+
+// CHECK: ('e_indent[EI_CLASS]', 0x00000001)
+// CHECK: ('e_indent[EI_DATA]', 0x00000001)
+// CHECK: ('e_indent[EI_VERSION]', 0x00000001)
+// CHECK: ('_sections', [
+// CHECK: # Section 0
+// CHECK: (('sh_name', 0x00000000) # ''
+
+// CHECK: # '.text'
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: # 'main'
+// CHECK: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000002)
+
+// CHECK: # 'puts'
+// CHECK: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+
+// CHECK: # '.rel.text'
+
+// CHECK: ('_relocations', [
+// CHECK: # Relocation 0x00000000
+// CHECK: (('r_offset', 0x00000006)
+// CHECK: ('r_type', 0x00000001)
+// CHECK: ),
+// CHECK: # Relocation 0x00000001
+// CHECK: (('r_offset', 0x0000000b)
+// CHECK: ('r_type', 0x00000002)
+// CHECK: ),
+// CHECK: # Relocation 0x00000002
+// CHECK: (('r_offset', 0x00000012)
+// CHECK: ('r_type', 0x00000001)
+// CHECK: ),
+// CHECK: # Relocation 0x00000003
+// CHECK: (('r_offset', 0x00000017)
+// CHECK: ('r_type', 0x00000002)
+// CHECK: ),
+// CHECK: ])
diff --git a/test/MC/ELF/basic-elf-64.s b/test/MC/ELF/basic-elf-64.s
new file mode 100644
index 0000000..7fc40b7
--- /dev/null
+++ b/test/MC/ELF/basic-elf-64.s
@@ -0,0 +1,82 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+ .text
+ .globl main
+ .align 16, 0x90
+ .type main,@function
+main: # @main
+# BB#0:
+ subq $8, %rsp
+ movl $.L.str1, %edi
+ callq puts
+ movl $.L.str2, %edi
+ callq puts
+ xorl %eax, %eax
+ addq $8, %rsp
+ ret
+.Ltmp0:
+ .size main, .Ltmp0-main
+
+ .type .L.str1,@object # @.str1
+ .section .rodata.str1.1,"aMS",@progbits,1
+.L.str1:
+ .asciz "Hello"
+ .size .L.str1, 6
+
+ .type .L.str2,@object # @.str2
+.L.str2:
+ .asciz "World!"
+ .size .L.str2, 7
+
+ .section .note.GNU-stack,"",@progbits
+
+// CHECK: ('e_indent[EI_CLASS]', 0x00000002)
+// CHECK: ('e_indent[EI_DATA]', 0x00000001)
+// CHECK: ('e_indent[EI_VERSION]', 0x00000001)
+// CHECK: ('_sections', [
+// CHECK: # Section 0
+// CHECK: (('sh_name', 0x00000000) # ''
+
+// CHECK: # '.text'
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+
+// CHECK: # 'main'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000002)
+
+// CHECK: # 'puts'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+
+// CHECK: # '.rela.text'
+
+// CHECK: ('_relocations', [
+// CHECK: # Relocation 0x00000000
+// CHECK: (('r_offset', 0x00000005)
+// CHECK: ('r_type', 0x0000000a)
+// CHECK: ('r_addend', 0x00000000)
+// CHECK: ),
+// CHECK: # Relocation 0x00000001
+// CHECK: (('r_offset', 0x0000000a)
+// CHECK: ('r_type', 0x00000002)
+// CHECK: ('r_addend', 0xfffffffc)
+// CHECK: ),
+// CHECK: # Relocation 0x00000002
+// CHECK: (('r_offset', 0x0000000f)
+// CHECK: ('r_type', 0x0000000a)
+// CHECK: ('r_addend', 0x00000006)
+// CHECK: ),
+// CHECK: # Relocation 0x00000003
+// CHECK: (('r_offset', 0x00000014)
+// CHECK: ('r_type', 0x00000002)
+// CHECK: ('r_addend', 0xfffffffc)
+// CHECK: ),
+// CHECK: ])
diff --git a/test/MC/ELF/call-abs.s b/test/MC/ELF/call-abs.s
new file mode 100644
index 0000000..885c2d1
--- /dev/null
+++ b/test/MC/ELF/call-abs.s
@@ -0,0 +1,24 @@
+// RUN: llvm-mc -filetype=obj -triple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+ .text
+ .globl f
+ .type f,@function
+f: # @f
+# BB#0: # %entry
+ subl $4, %esp
+ calll 42
+ incl %eax
+ addl $4, %esp
+ ret
+.Ltmp0:
+ .size f, .Ltmp0-f
+
+ .section .note.GNU-stack,"",@progbits
+
+// CHECK: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000004)
+// CHECK-NEXT: ('r_sym', 0x00000000)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
diff --git a/test/MC/ELF/cfi-advance-loc2.s b/test/MC/ELF/cfi-advance-loc2.s
new file mode 100644
index 0000000..3ffdd6c
--- /dev/null
+++ b/test/MC/ELF/cfi-advance-loc2.s
@@ -0,0 +1,45 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// test that this produces a correctly encoded cfi_advance_loc2
+
+f:
+ .cfi_startproc
+ nop
+ .zero 255, 0x90
+ .cfi_def_cfa_offset 8
+ nop
+ .cfi_endproc
+
+// CHECK: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000148)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 01010000 00030001 0e080000')
+// CHECK-NEXT: ),
+
+
+// CHECK: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000258)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi-def-cfa-offset.s b/test/MC/ELF/cfi-def-cfa-offset.s
new file mode 100644
index 0000000..efefb87
--- /dev/null
+++ b/test/MC/ELF/cfi-def-cfa-offset.s
@@ -0,0 +1,46 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+f:
+ .cfi_startproc
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ nop
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 0a000000 00440e10 450e0800')
+// CHECK-NEXT: ),
+
+// CHECK: # Section 0x00000008
+// CHECK-NEXT: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000160)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi-def-cfa-register.s b/test/MC/ELF/cfi-def-cfa-register.s
new file mode 100644
index 0000000..3df2021
--- /dev/null
+++ b/test/MC/ELF/cfi-def-cfa-register.s
@@ -0,0 +1,41 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+f:
+ .cfi_startproc
+ nop
+ .cfi_def_cfa_register 6
+ nop
+ .cfi_endproc
+
+// CHECK: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000048)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 02000000 00410d06 00000000')
+// CHECK-NEXT: ),
+
+// CHECK: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000158)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi-def-cfa.s b/test/MC/ELF/cfi-def-cfa.s
new file mode 100644
index 0000000..1ad427b
--- /dev/null
+++ b/test/MC/ELF/cfi-def-cfa.s
@@ -0,0 +1,42 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+f:
+ .cfi_startproc
+ nop
+ .cfi_def_cfa 7, 8
+ nop
+ .cfi_endproc
+
+// CHECK: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000048)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 02000000 00410c07 08000000')
+// CHECK-NEXT: ),
+
+
+// CHECK: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000158)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi-offset.s b/test/MC/ELF/cfi-offset.s
new file mode 100644
index 0000000..2f7e797
--- /dev/null
+++ b/test/MC/ELF/cfi-offset.s
@@ -0,0 +1,42 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+f:
+ .cfi_startproc
+ nop
+ .cfi_offset %ebp, -16
+ nop
+ .cfi_endproc
+
+// CHECK: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000048)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 02000000 00418602 00000000')
+// CHECK-NEXT: ),
+
+
+// CHECK: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000158)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi-remember.s b/test/MC/ELF/cfi-remember.s
new file mode 100644
index 0000000..b5b3803
--- /dev/null
+++ b/test/MC/ELF/cfi-remember.s
@@ -0,0 +1,45 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+f:
+ .cfi_startproc
+ nop
+ .cfi_remember_state
+ nop
+ .cfi_restore_state
+ nop
+ .cfi_endproc
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000048)
+// CHECK-NEXT: ('sh_size', 0x00000030)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 14000000 1c000000 00000000 03000000 00410a41 0b000000')
+// CHECK-NEXT: ),
+
+// CHECK: # Section 0x00000008
+// CHECK-NEXT: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000158)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi-zero-addr-delta.s b/test/MC/ELF/cfi-zero-addr-delta.s
new file mode 100644
index 0000000..5585e29
--- /dev/null
+++ b/test/MC/ELF/cfi-zero-addr-delta.s
@@ -0,0 +1,48 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that we don't produce a DW_CFA_advance_loc 0
+
+f:
+ .cfi_startproc
+ nop
+ .cfi_def_cfa_offset 16
+ nop
+ .cfi_remember_state
+ .cfi_def_cfa_offset 8
+ nop
+ .cfi_restore_state
+ nop
+ .cfi_endproc
+
+// CHECK: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000048)
+// CHECK-NEXT: ('sh_size', 0x00000038)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a5200 01781001 1b0c0708 90010000 1c000000 1c000000 00000000 04000000 00410e10 410a0e08 410b0000 00000000')
+// CHECK-NEXT: ),
+
+// CHECK: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000160)
+// CHECK-NEXT: ('sh_size', 0x00000018)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/cfi.s b/test/MC/ELF/cfi.s
new file mode 100644
index 0000000..93fd2e7
--- /dev/null
+++ b/test/MC/ELF/cfi.s
@@ -0,0 +1,674 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+f1:
+ .cfi_startproc
+ .cfi_lsda 0x3, bar
+ nop
+ .cfi_endproc
+
+f2:
+ .cfi_startproc
+ .cfi_personality 0x00, foo
+ .cfi_lsda 0x3, bar
+ nop
+ .cfi_endproc
+
+f3:
+ .cfi_startproc
+ .cfi_lsda 0x3, bar
+ nop
+ .cfi_endproc
+
+f4:
+ .cfi_startproc
+ .cfi_personality 0x00, foo
+ .cfi_lsda 0x2, bar
+ nop
+ .cfi_endproc
+
+f5:
+ .cfi_startproc
+ .cfi_personality 0x02, foo
+ nop
+ .cfi_endproc
+
+f6:
+ .cfi_startproc
+ .cfi_personality 0x03, foo
+ nop
+ .cfi_endproc
+
+f7:
+ .cfi_startproc
+ .cfi_personality 0x04, foo
+ nop
+ .cfi_endproc
+
+f8:
+ .cfi_startproc
+ .cfi_personality 0x0a, foo
+ nop
+ .cfi_endproc
+
+f9:
+ .cfi_startproc
+ .cfi_personality 0x0b, foo
+ nop
+ .cfi_endproc
+
+f10:
+ .cfi_startproc
+ .cfi_personality 0x0c, foo
+ nop
+ .cfi_endproc
+
+f11:
+ .cfi_startproc
+ .cfi_personality 0x08, foo
+ nop
+ .cfi_endproc
+
+f12:
+ .cfi_startproc
+ .cfi_personality 0x10, foo
+ nop
+ .cfi_endproc
+
+f13:
+ .cfi_startproc
+ .cfi_personality 0x12, foo
+ nop
+ .cfi_endproc
+
+f14:
+ .cfi_startproc
+ .cfi_personality 0x13, foo
+ nop
+ .cfi_endproc
+
+f15:
+ .cfi_startproc
+ .cfi_personality 0x14, foo
+ nop
+ .cfi_endproc
+
+f16:
+ .cfi_startproc
+ .cfi_personality 0x1a, foo
+ nop
+ .cfi_endproc
+
+f17:
+ .cfi_startproc
+ .cfi_personality 0x1b, foo
+ nop
+ .cfi_endproc
+
+f18:
+ .cfi_startproc
+ .cfi_personality 0x1c, foo
+ nop
+ .cfi_endproc
+
+f19:
+ .cfi_startproc
+ .cfi_personality 0x18, foo
+ nop
+ .cfi_endproc
+
+f20:
+ .cfi_startproc
+ .cfi_personality 0x80, foo
+ nop
+ .cfi_endproc
+
+f21:
+ .cfi_startproc
+ .cfi_personality 0x82, foo
+ nop
+ .cfi_endproc
+
+f22:
+ .cfi_startproc
+ .cfi_personality 0x83, foo
+ nop
+ .cfi_endproc
+
+f23:
+ .cfi_startproc
+ .cfi_personality 0x84, foo
+ nop
+ .cfi_endproc
+
+f24:
+ .cfi_startproc
+ .cfi_personality 0x8a, foo
+ nop
+ .cfi_endproc
+
+f25:
+ .cfi_startproc
+ .cfi_personality 0x8b, foo
+ nop
+ .cfi_endproc
+
+f26:
+ .cfi_startproc
+ .cfi_personality 0x8c, foo
+ nop
+ .cfi_endproc
+
+f27:
+ .cfi_startproc
+ .cfi_personality 0x88, foo
+ nop
+ .cfi_endproc
+
+f28:
+ .cfi_startproc
+ .cfi_personality 0x90, foo
+ nop
+ .cfi_endproc
+
+f29:
+ .cfi_startproc
+ .cfi_personality 0x92, foo
+ nop
+ .cfi_endproc
+
+f30:
+ .cfi_startproc
+ .cfi_personality 0x93, foo
+ nop
+ .cfi_endproc
+
+f31:
+ .cfi_startproc
+ .cfi_personality 0x94, foo
+ nop
+ .cfi_endproc
+
+f32:
+ .cfi_startproc
+ .cfi_personality 0x9a, foo
+ nop
+ .cfi_endproc
+
+f33:
+ .cfi_startproc
+ .cfi_personality 0x9b, foo
+ nop
+ .cfi_endproc
+
+f34:
+ .cfi_startproc
+ .cfi_personality 0x9c, foo
+ nop
+ .cfi_endproc
+
+f36:
+ .cfi_startproc
+ .cfi_personality 0x98, foo
+ nop
+ .cfi_endproc
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000068)
+// CHECK-NEXT: ('sh_size', 0x000006c8)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '14000000 00000000 017a4c52 00017810 02031b0c 07089001 14000000 1c000000 00000000 01000000 04000000 00000000 20000000 00000000 017a504c 52000178 100b0000 00000000 00000003 1b0c0708 90010000 14000000 28000000 00000000 01000000 04000000 00000000 14000000 70000000 00000000 01000000 04000000 00000000 20000000 00000000 017a504c 52000178 100b0000 00000000 00000002 1b0c0708 90010000 10000000 28000000 00000000 01000000 02000000 18000000 00000000 017a5052 00017810 04020000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06030000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a040000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 040a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 060b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a0c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a080000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a100000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 04120000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06130000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a140000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 041a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 061b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a1c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a180000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a800000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 04820000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06830000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a840000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 048a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 068b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a8c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a880000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a900000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 04920000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 06930000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a940000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 049a0000 1b0c0708 90010000 10000000 20000000 00000000 01000000 00000000 18000000 00000000 017a5052 00017810 069b0000 00001b0c 07089001 10000000 20000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a9c0000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000 1c000000 00000000 017a5052 00017810 0a980000 00000000 00001b0c 07089001 10000000 24000000 00000000 01000000 00000000')
+// CHECK-NEXT: ),
+
+// CHECK: # Section 0x00000008
+// CHECK-NEXT: (('sh_name', 0x00000036) # '.rela.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x00000004)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000bf8)
+// CHECK-NEXT: ('sh_size', 0x000006c0)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+// CHECK-NEXT: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000029)
+// CHECK-NEXT: ('r_sym', 0x00000028)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000002
+// CHECK-NEXT: (('r_offset', 0x00000043)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000003
+// CHECK-NEXT: (('r_offset', 0x0000005c)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000001)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000004
+// CHECK-NEXT: (('r_offset', 0x00000065)
+// CHECK-NEXT: ('r_sym', 0x00000028)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000005
+// CHECK-NEXT: (('r_offset', 0x00000074)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000002)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000006
+// CHECK-NEXT: (('r_offset', 0x0000007d)
+// CHECK-NEXT: ('r_sym', 0x00000028)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000007
+// CHECK-NEXT: (('r_offset', 0x00000097)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000008
+// CHECK-NEXT: (('r_offset', 0x000000b0)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000003)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000009
+// CHECK-NEXT: (('r_offset', 0x000000b9)
+// CHECK-NEXT: ('r_sym', 0x00000028)
+// CHECK-NEXT: ('r_type', 0x0000000c)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000000a
+// CHECK-NEXT: (('r_offset', 0x000000ce)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000c)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000000b
+// CHECK-NEXT: (('r_offset', 0x000000e0)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000004)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000000c
+// CHECK-NEXT: (('r_offset', 0x000000fe)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000000d
+// CHECK-NEXT: (('r_offset', 0x00000110)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000005)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000000e
+// CHECK-NEXT: (('r_offset', 0x0000012e)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000000f
+// CHECK-NEXT: (('r_offset', 0x00000144)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000006)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000010
+// CHECK-NEXT: (('r_offset', 0x00000162)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000c)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000011
+// CHECK-NEXT: (('r_offset', 0x00000174)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000007)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000012
+// CHECK-NEXT: (('r_offset', 0x00000192)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000013
+// CHECK-NEXT: (('r_offset', 0x000001a4)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000008)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000014
+// CHECK-NEXT: (('r_offset', 0x000001c2)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000015
+// CHECK-NEXT: (('r_offset', 0x000001d8)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000009)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000016
+// CHECK-NEXT: (('r_offset', 0x000001f6)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000017
+// CHECK-NEXT: (('r_offset', 0x0000020c)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000000a)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000018
+// CHECK-NEXT: (('r_offset', 0x0000022a)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000019
+// CHECK-NEXT: (('r_offset', 0x00000240)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000000b)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000001a
+// CHECK-NEXT: (('r_offset', 0x0000025e)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000d)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000001b
+// CHECK-NEXT: (('r_offset', 0x00000270)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000000c)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000001c
+// CHECK-NEXT: (('r_offset', 0x0000028e)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000001d
+// CHECK-NEXT: (('r_offset', 0x000002a0)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000000d)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000001e
+// CHECK-NEXT: (('r_offset', 0x000002be)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000001f
+// CHECK-NEXT: (('r_offset', 0x000002d4)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000000e)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000020
+// CHECK-NEXT: (('r_offset', 0x000002f2)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000d)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000021
+// CHECK-NEXT: (('r_offset', 0x00000304)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000000f)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000022
+// CHECK-NEXT: (('r_offset', 0x00000322)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000023
+// CHECK-NEXT: (('r_offset', 0x00000334)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000010)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000024
+// CHECK-NEXT: (('r_offset', 0x00000352)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000025
+// CHECK-NEXT: (('r_offset', 0x00000368)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000011)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000026
+// CHECK-NEXT: (('r_offset', 0x00000386)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000027
+// CHECK-NEXT: (('r_offset', 0x0000039c)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000012)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000028
+// CHECK-NEXT: (('r_offset', 0x000003ba)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000029
+// CHECK-NEXT: (('r_offset', 0x000003d0)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000013)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000002a
+// CHECK-NEXT: (('r_offset', 0x000003ee)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000c)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000002b
+// CHECK-NEXT: (('r_offset', 0x00000400)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000014)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000002c
+// CHECK-NEXT: (('r_offset', 0x0000041e)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000002d
+// CHECK-NEXT: (('r_offset', 0x00000430)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000015)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000002e
+// CHECK-NEXT: (('r_offset', 0x0000044e)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000002f
+// CHECK-NEXT: (('r_offset', 0x00000464)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000016)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000030
+// CHECK-NEXT: (('r_offset', 0x00000482)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000c)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000031
+// CHECK-NEXT: (('r_offset', 0x00000494)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000017)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000032
+// CHECK-NEXT: (('r_offset', 0x000004b2)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000033
+// CHECK-NEXT: (('r_offset', 0x000004c4)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000018)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000034
+// CHECK-NEXT: (('r_offset', 0x000004e2)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000035
+// CHECK-NEXT: (('r_offset', 0x000004f8)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000019)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000036
+// CHECK-NEXT: (('r_offset', 0x00000516)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000037
+// CHECK-NEXT: (('r_offset', 0x0000052c)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000001a)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000038
+// CHECK-NEXT: (('r_offset', 0x0000054a)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000039
+// CHECK-NEXT: (('r_offset', 0x00000560)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000001b)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000003a
+// CHECK-NEXT: (('r_offset', 0x0000057e)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000d)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000003b
+// CHECK-NEXT: (('r_offset', 0x00000590)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000001c)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000003c
+// CHECK-NEXT: (('r_offset', 0x000005ae)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000003d
+// CHECK-NEXT: (('r_offset', 0x000005c0)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000001d)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000003e
+// CHECK-NEXT: (('r_offset', 0x000005de)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x0000003f
+// CHECK-NEXT: (('r_offset', 0x000005f4)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000001e)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000040
+// CHECK-NEXT: (('r_offset', 0x00000612)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x0000000d)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000041
+// CHECK-NEXT: (('r_offset', 0x00000624)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000001f)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000042
+// CHECK-NEXT: (('r_offset', 0x00000642)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000043
+// CHECK-NEXT: (('r_offset', 0x00000654)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000020)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000044
+// CHECK-NEXT: (('r_offset', 0x00000672)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000045
+// CHECK-NEXT: (('r_offset', 0x00000688)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000021)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000046
+// CHECK-NEXT: (('r_offset', 0x000006a6)
+// CHECK-NEXT: ('r_sym', 0x00000029)
+// CHECK-NEXT: ('r_type', 0x00000018)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000047
+// CHECK-NEXT: (('r_offset', 0x000006bc)
+// CHECK-NEXT: ('r_sym', 0x00000024)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000022)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/comdat.s b/test/MC/ELF/comdat.s
new file mode 100644
index 0000000..0f1164e
--- /dev/null
+++ b/test/MC/ELF/comdat.s
@@ -0,0 +1,86 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that we produce the group sections and that they are a the beginning
+// of the file.
+
+// CHECK: # Section 0x00000001
+// CHECK-NEXT: (('sh_name', 0x00000026) # '.group'
+// CHECK-NEXT: ('sh_type', 0x00000011)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x0000000c)
+// CHECK-NEXT: ('sh_link', 0x0000000c)
+// CHECK-NEXT: ('sh_info', 0x00000001)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000004)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x00000002
+// CHECK-NEXT: (('sh_name', 0x00000026) # '.group'
+// CHECK-NEXT: ('sh_type', 0x00000011)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x0000004c)
+// CHECK-NEXT: ('sh_size', 0x00000008)
+// CHECK-NEXT: ('sh_link', 0x0000000c)
+// CHECK-NEXT: ('sh_info', 0x00000002)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000004)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x00000003
+// CHECK-NEXT: (('sh_name', 0x00000026) # '.group'
+// CHECK-NEXT: ('sh_type', 0x00000011)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000054)
+// CHECK-NEXT: ('sh_size', 0x00000008)
+// CHECK-NEXT: ('sh_link', 0x0000000c)
+// CHECK-NEXT: ('sh_info', 0x0000000d)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000004)
+// CHECK-NEXT: ),
+
+// Test that g1 and g2 are local, but g3 is an undefined global.
+
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000001) # 'g1'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000007)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000004) # 'g2'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000002)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+
+// CHECK: # Symbol 0x0000000d
+// CHECK-NEXT: (('st_name', 0x00000007) # 'g3'
+// 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: ),
+
+
+ .section .foo,"axG",@progbits,g1,comdat
+g1:
+ nop
+
+ .section .bar,"axG",@progbits,g1,comdat
+ nop
+
+ .section .zed,"axG",@progbits,g2,comdat
+ nop
+
+ .section .baz,"axG",@progbits,g3,comdat
+ .long g3
diff --git a/test/MC/ELF/common.s b/test/MC/ELF/common.s
new file mode 100644
index 0000000..16b677b
--- /dev/null
+++ b/test/MC/ELF/common.s
@@ -0,0 +1,88 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+
+ .text
+
+// Test that this produces a regular local symbol.
+ .type common1,@object
+ .local common1
+ .comm common1,1,1
+
+// CHECK: ('st_name', 0x00000001) # 'common1'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx',
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000001)
+
+
+// Same as common1, but with directives in a different order.
+ .local common2
+ .type common2,@object
+ .comm common2,1,1
+
+// CHECK: ('st_name', 0x00000009) # 'common2'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx',
+// CHECK-NEXT: ('st_value', 0x0000000000000001)
+// CHECK-NEXT: ('st_size', 0x0000000000000001)
+
+ .local common6
+ .comm common6,8,16
+
+// CHECK: # Symbol 0x00000003
+// CHECK-NEXT: (('st_name', 0x00000011) # 'common6'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000003)
+// CHECK-NEXT: ('st_value', 0x0000000000000010)
+// CHECK-NEXT: ('st_size', 0x0000000000000008)
+// CHECK-NEXT: ),
+
+// Test that without an explicit .local we produce a global.
+ .type common3,@object
+ .comm common3,4,4
+
+// CHECK: ('st_name', 0x00000019) # 'common3'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x0000fff2)
+// CHECK-NEXT: ('st_value', 0x0000000000000004)
+// CHECK-NEXT: ('st_size', 0x0000000000000004)
+
+
+// Test that without an explicit .local we produce a global, even if the first
+// occurrence is not in a directive.
+ .globl foo
+ .type foo,@function
+foo:
+ movsbl common4+3(%rip), %eax
+
+
+ .type common4,@object
+ .comm common4,40,16
+
+// CHECK: ('st_name', 0x00000025) # 'common4'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x0000fff2)
+// CHECK-NEXT: ('st_value', 0x0000000000000010)
+// CHECK-NEXT: ('st_size', 0x0000000000000028)
+
+ .comm common5,4,4
+
+// CHECK: # Symbol 0x00000009
+// CHECK-NEXT: (('st_name', 0x0000002d) # 'common5'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x0000fff2)
+// CHECK-NEXT: ('st_value', 0x0000000000000004)
+// CHECK-NEXT: ('st_size', 0x0000000000000004)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/common2.s b/test/MC/ELF/common2.s
new file mode 100644
index 0000000..b54cdfe
--- /dev/null
+++ b/test/MC/ELF/common2.s
@@ -0,0 +1,21 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the common symbols are placed at the end of .bss. In this example
+// it causes .bss to have size 9 instead of 8.
+
+ .local vimvardict
+ .comm vimvardict,1,8
+ .bss
+ .zero 1
+ .align 8
+
+// CHECK: (('sh_name', 0x0000000d) # '.bss'
+// CHECK-NEXT: ('sh_type',
+// CHECK-NEXT: ('sh_flags'
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000009)
+// CHECK-NEXT: ('sh_link',
+// CHECK-NEXT: ('sh_info',
+// CHECK-NEXT: ('sh_addralign',
+// CHECK-NEXT: ('sh_entsize',
diff --git a/test/MC/ELF/debug-line.s b/test/MC/ELF/debug-line.s
new file mode 100644
index 0000000..2979ca2
--- /dev/null
+++ b/test/MC/ELF/debug-line.s
@@ -0,0 +1,22 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that .debug_line is populated.
+
+// CHECK: (('sh_name', 0x00000012) # '.debug_line'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000044)
+// CHECK-NEXT: ('sh_size', 0x00000037)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '33000000 02001c00 00000101 fb0e0d00 01010101 00000001 00000100 666f6f2e 63000000 00000009 02000000 00000000 00150204 000101')
+
+ .section .debug_line,"",@progbits
+ .text
+
+ .file 1 "foo.c"
+ .loc 1 4 0
+ subq $8, %rsp
diff --git a/test/MC/ELF/debug-loc.s b/test/MC/ELF/debug-loc.s
new file mode 100644
index 0000000..36ae485
--- /dev/null
+++ b/test/MC/ELF/debug-loc.s
@@ -0,0 +1,32 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that we don't regress on the size of the line info section. We used
+// to handle negative line diffs incorrectly which manifested as very
+// large integers being passed to DW_LNS_advance_line.
+
+// FIXME: This size is the same as gnu as, but we can probably do a bit better.
+// FIXME2: We need a debug_line dumper so that we can test the actual contents.
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.debug_line'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000044)
+// CHECK-NEXT: ('sh_size', 0x0000003d)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+
+ .section .debug_line,"",@progbits
+ .text
+foo:
+ .file 1 "Driver.ii"
+ .loc 1 2 0
+ nop
+ .loc 1 4 0
+ nop
+ .loc 1 3 0
+ nop
diff --git a/test/MC/ELF/dg.exp b/test/MC/ELF/dg.exp
index 7b7bd4e..d46d700 100644
--- a/test/MC/ELF/dg.exp
+++ b/test/MC/ELF/dg.exp
@@ -1,5 +1,5 @@
load_lib llvm.exp
if { [llvm_supports_target X86] } {
- RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll}]]
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,s}]]
}
diff --git a/test/MC/ELF/diff.s b/test/MC/ELF/diff.s
new file mode 100644
index 0000000..1879a39
--- /dev/null
+++ b/test/MC/ELF/diff.s
@@ -0,0 +1,15 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+ .global zed
+foo:
+ nop
+bar:
+ nop
+zed:
+ mov zed+(bar-foo), %eax
+
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000005)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend', 0x00000001)
diff --git a/test/MC/ELF/diff2.s b/test/MC/ELF/diff2.s
new file mode 100644
index 0000000..4a9fbd1
--- /dev/null
+++ b/test/MC/ELF/diff2.s
@@ -0,0 +1,13 @@
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2> %t
+// RUN: FileCheck -input-file %t %s
+
+.global zed
+ .data
+foo:
+ .text
+ nop
+bar:
+ nop
+zed:
+// CHECK: expected relocatable expression
+ mov zed+(bar-foo), %eax
diff --git a/test/MC/ELF/elf_directive_previous.s b/test/MC/ELF/elf_directive_previous.s
new file mode 100644
index 0000000..5db1eac
--- /dev/null
+++ b/test/MC/ELF/elf_directive_previous.s
@@ -0,0 +1,13 @@
+# RUN: llvm-mc -triple i386-pc-linux-gnu %s | FileCheck %s
+
+.bss
+# CHECK: .bss
+
+.text
+# CHECK: .text
+
+.previous
+# CHECK: .bss
+
+.previous
+# CHECK: .text
diff --git a/test/MC/ELF/elf_directive_section.s b/test/MC/ELF/elf_directive_section.s
new file mode 100644
index 0000000..9531c02
--- /dev/null
+++ b/test/MC/ELF/elf_directive_section.s
@@ -0,0 +1,23 @@
+# RUN: llvm-mc -triple i386-pc-linux-gnu %s | FileCheck %s
+
+ .bss
+# CHECK: .bss
+
+ .data.rel.ro
+# CHECK: .data.rel.ro
+
+ .data.rel
+# CHECK: .data.rel
+
+ .eh_frame
+# CHECK: .eh_frame
+
+ .rodata
+# CHECK: .rodata
+
+ .tbss
+# CHECK: .tbss
+
+ .tdata
+# CHECK: .tdata
+
diff --git a/test/MC/ELF/empty-dwarf-lines.s b/test/MC/ELF/empty-dwarf-lines.s
new file mode 100644
index 0000000..0f791ae
--- /dev/null
+++ b/test/MC/ELF/empty-dwarf-lines.s
@@ -0,0 +1,21 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the dwarf debug_line section contains no line directives.
+
+ .file 1 "test.c"
+ .globl c
+c:
+ .asciz "hi\n"
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.debug_line'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000044)
+// CHECK-NEXT: ('sh_size', 0x00000027)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/empty.s b/test/MC/ELF/empty.s
new file mode 100644
index 0000000..e351936
--- /dev/null
+++ b/test/MC/ELF/empty.s
@@ -0,0 +1,70 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that like gnu as we create text, data and bss by default. Also test
+// that shstrtab, symtab and strtab are listed in that order.
+
+// CHECK: ('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+
+// CHECK: ('sh_name', 0x00000007) # '.data'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000003)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+
+// CHECK: ('sh_name', 0x0000000d) # '.bss'
+// CHECK-NEXT: ('sh_type', 0x00000008)
+// CHECK-NEXT: ('sh_flags', 0x00000003)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+
+// CHECK: ('sh_name', 0x00000012) # '.shstrtab'
+// CHECK-NEXT: ('sh_type', 0x00000003)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x0000002c)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+
+// CHECK: ('sh_name', 0x0000001c) # '.symtab'
+// CHECK-NEXT: ('sh_type', 0x00000002)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000060)
+// CHECK-NEXT: ('sh_link', 0x00000006)
+// CHECK-NEXT: ('sh_info', 0x00000004)
+// CHECK-NEXT: ('sh_addralign', 0x00000008)
+// CHECK-NEXT: ('sh_entsize', 0x00000018)
+
+// CHECK: ('sh_name', 0x00000024) # '.strtab'
+// CHECK-NEXT: ('sh_type', 0x00000003)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000001)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
diff --git a/test/MC/ELF/entsize.ll b/test/MC/ELF/entsize.ll
new file mode 100644
index 0000000..21179df
--- /dev/null
+++ b/test/MC/ELF/entsize.ll
@@ -0,0 +1,44 @@
+; RUN: llc -filetype=obj -mtriple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck -check-prefix=64 %s
+
+; Test that constant mergeable strings have sh_entsize set.
+
+@.str1 = private unnamed_addr constant [6 x i8] c"tring\00"
+@.str2 = private unnamed_addr constant [7 x i8] c"String\00"
+@.c8a = private unnamed_addr constant [1 x i64] [i64 42]
+@.c8b = private unnamed_addr constant [1 x i64] [i64 42]
+
+define i32 @main() nounwind {
+ %1 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0))
+ %2 = call i32 @puts(i8* getelementptr inbounds ([7 x i8]* @.str2, i32 0, i32 0))
+ call void @foo(i64* getelementptr inbounds ([1 x i64]* @.c8a, i32 0, i32 0))
+ call void @foo(i64* getelementptr inbounds ([1 x i64]* @.c8b, i32 0, i32 0))
+ ret i32 0
+}
+
+declare i32 @puts(i8* nocapture) nounwind
+declare void @foo(i64* nocapture) nounwind
+
+;;;;;
+
+; 64: (('sh_name', 0x00000012) # '.rodata.str1.1'
+; 64-NEXT: ('sh_type', 0x00000001)
+; 64-NEXT: ('sh_flags', 0x00000032)
+; 64-NEXT: ('sh_addr',
+; 64-NEXT: ('sh_offset',
+; 64-NEXT: ('sh_size', 0x0000000d)
+; 64-NEXT: ('sh_link',
+; 64-NEXT: ('sh_info',
+; 64-NEXT: ('sh_addralign', 0x00000001)
+; 64-NEXT: ('sh_entsize', 0x00000001)
+
+; 64: (('sh_name', 0x00000021) # '.rodata.cst8'
+; 64-NEXT: ('sh_type', 0x00000001)
+; 64-NEXT: ('sh_flags', 0x00000012)
+; 64-NEXT: ('sh_addr',
+; 64-NEXT: ('sh_offset',
+; 64-NEXT: ('sh_size', 0x00000010)
+; 64-NEXT: ('sh_link',
+; 64-NEXT: ('sh_info',
+; 64-NEXT: ('sh_addralign', 0x00000008)
+; 64-NEXT: ('sh_entsize', 0x00000008)
+
diff --git a/test/MC/ELF/entsize.s b/test/MC/ELF/entsize.s
new file mode 100644
index 0000000..e8eb62e
--- /dev/null
+++ b/test/MC/ELF/entsize.s
@@ -0,0 +1,69 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that mergeable constants have sh_entsize set.
+
+// 1 byte strings
+ .section .rodata.str1.1,"aMS",@progbits,1
+
+ .type .L.str1,@object # @.str1
+.L.str1:
+ .asciz "tring"
+ .size .L.str1, 6
+
+ .type .L.str2,@object # @.str2
+.L.str2:
+ .asciz "String"
+ .size .L.str2, 7
+
+// 2 byte strings
+ .section .rodata.str2.1,"aMS",@progbits,2
+ .type .L.str3,@object # @.str3
+.L.str3:
+ .asciz "L\000o\000n\000g\000"
+ .size .L.str3, 9
+
+ .type .L.str4,@object # @.str4
+.L.str4:
+ .asciz "o\000n\000g\000"
+ .size .L.str4, 7
+
+ // 8 byte constants
+ .section .rodata.cst8,"aM",@progbits,8
+ .quad 42
+ .quad 42
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: ('sh_name', 0x00000012) # '.rodata.str1.1'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000032)
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x0000000d)
+// CHECK-NEXT: ('sh_link',
+// CHECK-NEXT: ('sh_info',
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000001)
+
+// CHECK: # Section 0x00000005
+// CHECK-NEXT: ('sh_name', 0x00000021) # '.rodata.str2.1'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000032)
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000010)
+// CHECK-NEXT: ('sh_link',
+// CHECK-NEXT: ('sh_info',
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000002)
+
+// CHECK: # Section 0x00000006
+// CHECK-NEXT: ('sh_name', 0x00000030) # '.rodata.cst8
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000012)
+// CHECK-NEXT: ('sh_addr',
+// CHECK-NEXT: ('sh_offset',
+// CHECK-NEXT: ('sh_size', 0x00000010)
+// CHECK-NEXT: ('sh_link',
+// CHECK-NEXT: ('sh_info',
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000008)
diff --git a/test/MC/ELF/file.s b/test/MC/ELF/file.s
new file mode 100644
index 0000000..d8ccbe6
--- /dev/null
+++ b/test/MC/ELF/file.s
@@ -0,0 +1,23 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the STT_FILE symbol precedes the other local symbols.
+
+.file "foo"
+foa:
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000004)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x0000fff1)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000005) # 'foa'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
diff --git a/test/MC/ELF/global-offset.s b/test/MC/ELF/global-offset.s
new file mode 100644
index 0000000..aa63287
--- /dev/null
+++ b/test/MC/ELF/global-offset.s
@@ -0,0 +1,18 @@
+// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// We test that _GLOBAL_OFFSET_TABLE_ will account for the two bytes at the
+// start of the addl.
+
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+
+// 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',
+// CHECK-NEXT: ('sh_link',
+// CHECK-NEXT: ('sh_info',
+// CHECK-NEXT: ('sh_addralign',
+// CHECK-NEXT: ('sh_entsize',
+// CHECK-NEXT: ('_section_data', '81c30200 0000')
diff --git a/test/MC/ELF/got.s b/test/MC/ELF/got.s
new file mode 100644
index 0000000..798150e
--- /dev/null
+++ b/test/MC/ELF/got.s
@@ -0,0 +1,25 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that this produces a R_X86_64_GOT32 and that we have an undefined
+// reference to _GLOBAL_OFFSET_TABLE_.
+
+ movl foo@GOT, %eax
+ movl foo@GOTPCREL(%rip), %eax
+
+// CHECK: (('st_name', 0x00000005) # '_GLOBAL_OFFSET_TABLE_'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+
+// CHECK: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x00000003)
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x00000009)
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
diff --git a/test/MC/ELF/ident.s b/test/MC/ELF/ident.s
new file mode 100644
index 0000000..f79458f
--- /dev/null
+++ b/test/MC/ELF/ident.s
@@ -0,0 +1,17 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// CHECK: (('sh_name', 0x00000012) # '.comment'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000030)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x0000000d)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000001)
+// CHECK-NEXT: ('_section_data', '00666f6f 00626172 007a6564 00')
+
+ .ident "foo"
+ .ident "bar"
+ .ident "zed"
diff --git a/test/MC/ELF/invalid-symver.s b/test/MC/ELF/invalid-symver.s
new file mode 100644
index 0000000..3c4f8c0
--- /dev/null
+++ b/test/MC/ELF/invalid-symver.s
@@ -0,0 +1,7 @@
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 2> %t.out
+// RUN: FileCheck --input-file=%t.out %s
+
+// CHECK: A @@ version cannot be undefined
+
+ .symver undefined, foo@@bar
+ .long undefined
diff --git a/test/MC/ELF/leb128.s b/test/MC/ELF/leb128.s
new file mode 100644
index 0000000..e5f31f4
--- /dev/null
+++ b/test/MC/ELF/leb128.s
@@ -0,0 +1,19 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+ .sleb128 .Lfoo - .Lbar
+.Lfoo:
+ .uleb128 .Lbar - .Lfoo
+ .fill 126, 1, 0x90
+.Lbar:
+
+// CHECK: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000081)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '817f7f90 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90909090 90')
diff --git a/test/MC/ELF/local-reloc.s b/test/MC/ELF/local-reloc.s
new file mode 100644
index 0000000..c2b4771
--- /dev/null
+++ b/test/MC/ELF/local-reloc.s
@@ -0,0 +1,31 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that relocations with local symbols are represented as relocations
+// with the section. They should be equivalent, but gas behaves like this.
+
+ movl foo, %r14d
+foo:
+
+// Section number 1 is .text
+// CHECK: # Section 0x00000001
+// CHECK-next: (('sh_name', 0x00000001) # '.text'
+
+// Symbol number 2 is section number 1
+// CHECK: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+
+// Relocation refers to symbol number 2
+// CHECK: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type',
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
diff --git a/test/MC/ELF/merge.s b/test/MC/ELF/merge.s
new file mode 100644
index 0000000..ec02228
--- /dev/null
+++ b/test/MC/ELF/merge.s
@@ -0,0 +1,97 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that PIC relocations with local symbols in a mergeable section are done
+// with a reference to the symbol. Not sure if this is a linker limitation,
+// but this matches the behavior of gas.
+
+// Non-PIC relocations with 0 offset don't use the symbol.
+
+
+ movsd .Lfoo(%rip), %xmm1
+ movl $.Lfoo, %edi
+ movl $.Lfoo+2, %edi
+ jmp foo@PLT
+ movq foo@GOTPCREL, %rax
+ movq zed, %rax
+
+ .section .sec1,"aM",@progbits,16
+.Lfoo:
+zed:
+ .global zed
+
+ .section bar,"ax",@progbits
+foo:
+
+// Section 4 is "sec1"
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.sec1'
+
+// Symbol number 1 is .Lfoo
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000001) # '.Lfoo'
+
+// Symbol number 2 is foo
+// CHECK: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000007) # 'foo'
+
+// Symbol number 6 is section 4
+// CHECK: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000004)
+
+// Symbol number 8 is zed
+// CHECK: # Symbol 0x00000008
+// CHECK-NEXT: (('st_name', 0x0000000b) # 'zed'
+
+// Relocation 0 refers to symbol 1
+// CHECK: ('_relocations', [
+// CHECK-NEXT: # Relocation 0
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000001)
+// CHECK-NEXT: ('r_type', 0x00000002
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+
+// Relocation 1 refers to symbol 6
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+
+// Relocation 2 refers to symbol 1
+// CHECK-NEXT: # Relocation 0x00000002
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000001)
+// CHECK-NEXT: ('r_type', 0x0000000a
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+
+// Relocation 3 refers to symbol 2
+// CHECK-NEXT: # Relocation 0x00000003
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000004
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+
+// Relocation 4 refers to symbol 2
+// CHECK-NEXT: # Relocation 0x00000004
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x00000009
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+
+// Relocation 5 refers to symbol 8
+// CHECK-NEXT: # Relocation 0x00000005
+// CHECK-NEXT: (('r_offset', 0x00000023)
+// CHECK-NEXT: ('r_sym', 0x00000008)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
diff --git a/test/MC/ELF/n_bytes.s b/test/MC/ELF/n_bytes.s
new file mode 100644
index 0000000..59d67bf
--- /dev/null
+++ b/test/MC/ELF/n_bytes.s
@@ -0,0 +1,20 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+ .2byte 42, 1, 2, 3
+ .4byte 42, 1, 2, 3
+ .8byte 42, 1, 2, 3
+ .int 42, 1, 2, 3
+
+// CHECK: # Section 0x00000001
+// CHECK-NEXT: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000048)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', '2a000100 02000300 2a000000 01000000 02000000 03000000 2a000000 00000000 01000000 00000000 02000000 00000000 03000000 00000000 2a000000 01000000 02000000 03000000')
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/no-fixup.s b/test/MC/ELF/no-fixup.s
new file mode 100644
index 0000000..6e719bc
--- /dev/null
+++ b/test/MC/ELF/no-fixup.s
@@ -0,0 +1,16 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t -stats 2>%t.out
+// RUN: FileCheck --input-file=%t.out %s
+
+// Test that we create no fixups for this file since "a" and "b" are in the
+// same fragment.
+
+// CHECK: assembler - Number of assembler layout and relaxation steps
+// CHECK-NEXT: assembler - Number of emitted assembler fragments
+// CHECK-NEXT: assembler - Number of emitted object file bytes
+// CHECK-NEXT: assembler - Number of fragment layouts
+// CHECK-NEXT: mcexpr - Number of MCExpr evaluations
+
+a:
+ nop
+b:
+ .long b - a
diff --git a/test/MC/ELF/noexec.s b/test/MC/ELF/noexec.s
new file mode 100644
index 0000000..87b6f3a
--- /dev/null
+++ b/test/MC/ELF/noexec.s
@@ -0,0 +1,24 @@
+// RUN: llvm-mc -mc-no-exec-stack -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// CHECK: # Section 0x00000004
+// CHECK-NEXT: (('sh_name', 0x00000012) # '.note.GNU-stack'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+
+// CHECK: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000004)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/norelocation.s b/test/MC/ELF/norelocation.s
new file mode 100644
index 0000000..0a0efe1
--- /dev/null
+++ b/test/MC/ELF/norelocation.s
@@ -0,0 +1,18 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+ call bar
+bar:
+
+// CHECK: ('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000005)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', 'e8000000 00')
+// CHECK-NOT: .rela.text
+// CHECK: shstrtab
diff --git a/test/MC/ELF/pic-diff.s b/test/MC/ELF/pic-diff.s
new file mode 100644
index 0000000..d1fc909
--- /dev/null
+++ b/test/MC/ELF/pic-diff.s
@@ -0,0 +1,29 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// CHECK: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000005) # 'baz'
+// 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: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x0000000c)
+// CHECK-NEXT: ('r_sym', 0x00000005)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x00000008)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
+
+.zero 4
+.data
+
+.zero 1
+.align 4
+foo:
+.zero 8
+.long baz - foo
diff --git a/test/MC/ELF/plt.s b/test/MC/ELF/plt.s
new file mode 100644
index 0000000..7d0073c
--- /dev/null
+++ b/test/MC/ELF/plt.s
@@ -0,0 +1,14 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that this produces a R_X86_64_PLT32.
+
+ jmp foo@PLT
+
+// CHECK: ('_relocations', [
+// CHECK-NEXT: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x00000004)
+// CHECK-NEXT: ('r_addend',
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
diff --git a/test/MC/ELF/relax-arith.s b/test/MC/ELF/relax-arith.s
new file mode 100644
index 0000000..3236b41
--- /dev/null
+++ b/test/MC/ELF/relax-arith.s
@@ -0,0 +1,75 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that we correctly relax these instructions into versions that use
+// 16 or 32 bit immediate values.
+
+bar:
+// CHECK: 'imul'
+// CHECK: ('_section_data', '6669db00 0066691c 25000000 00000069 db000000 00691c25 00000000 00000000 4869db00 00000048 691c2500 00000000 000000')
+ .section imul
+ imul $foo, %bx, %bx
+ imul $foo, bar, %bx
+ imul $foo, %ebx, %ebx
+ imul $foo, bar, %ebx
+ imul $foo, %rbx, %rbx
+ imul $foo, bar, %rbx
+
+// CHECK: and'
+// CHECK:('_section_data', '6681e300 00668124 25000000 00000081 e3000000 00812425 00000000 00000000 4881e300 00000048 81242500 00000000 000000')
+ .section and
+ and $foo, %bx
+ andw $foo, bar
+ and $foo, %ebx
+ andl $foo, bar
+ and $foo, %rbx
+ andq $foo, bar
+
+// CHECK: 'or'
+// CHECK: ('_section_data', '6681cb00 0066810c 25000000 00000081 cb000000 00810c25 00000000 00000000 4881cb00 00000048 810c2500 00000000 000000')
+ .section or
+ or $foo, %bx
+ orw $foo, bar
+ or $foo, %ebx
+ orl $foo, bar
+ or $foo, %rbx
+ orq $foo, bar
+
+// CHECK: 'xor'
+// CHECK: ('_section_data', '6681f300 00668134 25000000 00000081 f3000000 00813425 00000000 00000000 4881f300 00000048 81342500 00000000 000000')
+ .section xor
+ xor $foo, %bx
+ xorw $foo, bar
+ xor $foo, %ebx
+ xorl $foo, bar
+ xor $foo, %rbx
+ xorq $foo, bar
+
+// CHECK: 'add'
+// CHECK: ('_section_data', '6681c300 00668104 25000000 00000081 c3000000 00810425 00000000 00000000 4881c300 00000048 81042500 00000000 000000')
+ .section add
+ add $foo, %bx
+ addw $foo, bar
+ add $foo, %ebx
+ addl $foo, bar
+ add $foo, %rbx
+ addq $foo, bar
+
+// CHECK: 'sub'
+// CHECK: ('_section_data', '6681eb00 0066812c 25000000 00000081 eb000000 00812c25 00000000 00000000 4881eb00 00000048 812c2500 00000000 000000')
+ .section sub
+ sub $foo, %bx
+ subw $foo, bar
+ sub $foo, %ebx
+ subl $foo, bar
+ sub $foo, %rbx
+ subq $foo, bar
+
+// CHECK: 'cmp'
+// CHECK: ('_section_data', '6681fb00 0066813c 25000000 00000081 fb000000 00813c25 00000000 00000000 4881fb00 00000048 813c2500 00000000 000000')
+ .section cmp
+ cmp $foo, %bx
+ cmpw $foo, bar
+ cmp $foo, %ebx
+ cmpl $foo, bar
+ cmp $foo, %rbx
+ cmpq $foo, bar
diff --git a/test/MC/ELF/relax-crash.s b/test/MC/ELF/relax-crash.s
new file mode 100644
index 0000000..442825d
--- /dev/null
+++ b/test/MC/ELF/relax-crash.s
@@ -0,0 +1,11 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
+
+// This is a test that we don't crash. We used to do so by going in a infinite
+// recursion trying to compute the size of a MCDwarfLineAddrFragment.
+
+ .section .debug_line,"",@progbits
+ .text
+ .file 1 "Disassembler.ii"
+ .section foo
+ .loc 1 1 0
+ ret
diff --git a/test/MC/ELF/relax.s b/test/MC/ELF/relax.s
new file mode 100644
index 0000000..2c0e285
--- /dev/null
+++ b/test/MC/ELF/relax.s
@@ -0,0 +1,27 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that we do not relax these.
+
+bar:
+.globl foo
+foo:
+ .set zed,foo
+
+ jmp bar
+ jmp foo
+ jmp zed
+
+// CHECK: ('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000006)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ('_section_data', 'ebfeebfc ebfa')
+
+// CHECK: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000005) # 'foo'
diff --git a/test/MC/ELF/relocation-386.s b/test/MC/ELF/relocation-386.s
new file mode 100644
index 0000000..f106f89
--- /dev/null
+++ b/test/MC/ELF/relocation-386.s
@@ -0,0 +1,226 @@
+// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that we produce the correct relocation types and that the relocations
+// correctly point to the section or the symbol.
+
+// Section 3 is bss
+// CHECK: # Section 0x00000003
+// CHECK-NEXT: (('sh_name', 0x0000000d) # '.bss'
+
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000005) # '.Lfoo'
+
+// Symbol 4 is zed
+// CHECK: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000035) # 'zed'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000004)
+
+// Symbol 7 is section 3
+// CHECK: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000003)
+
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000002)
+// CHECK-NEXT: ('r_sym', 0x00000001)
+// CHECK-NEXT: ('r_type', 0x00000009)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x00000004)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000002
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ),
+
+// Relocation 3 (bar3@GOTOFF) is done with symbol 7 (bss)
+// CHECK-NEXT: # Relocation 0x00000003
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym', 0x00000007
+// CHECK-NEXT: ('r_type',
+// CHECK-NEXT: ),
+
+// Relocation 4 (bar2@GOT) is of type R_386_GOT32
+// CHECK-NEXT: # Relocation 0x00000004
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x00000003
+// CHECK-NEXT: ),
+
+// Relocation 5 (foo@TLSGD) is of type R_386_TLS_GD
+// CHECK-NEXT: # Relocation 0x00000005
+// CHECK-NEXT: (('r_offset', 0x00000020)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x00000012)
+// CHECK-NEXT: ),
+
+// Relocation 6 ($foo@TPOFF) is of type R_386_TLS_LE_32
+// CHECK-NEXT: # Relocation 0x00000006
+// CHECK-NEXT: (('r_offset', 0x00000025)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x00000022)
+// CHECK-NEXT: ),
+
+// Relocation 7 (foo@INDNTPOFF) is of type R_386_TLS_IE
+// CHECK-NEXT: # Relocation 0x00000007
+// CHECK-NEXT: (('r_offset', 0x0000002b)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x0000000f)
+// CHECK-NEXT: ),
+
+// Relocation 8 (foo@NTPOFF) is of type R_386_TLS_LE
+// CHECK-NEXT: # Relocation 0x00000008
+// CHECK-NEXT: (('r_offset', 0x00000031)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x00000011)
+// CHECK-NEXT: ),
+
+// Relocation 9 (foo@GOTNTPOFF) is of type R_386_TLS_GOTIE
+// CHECK-NEXT: # Relocation 0x00000009
+// CHECK-NEXT: (('r_offset', 0x00000037)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x00000010)
+// CHECK-NEXT: ),
+
+// Relocation 10 (foo@TLSLDM) is of type R_386_TLS_LDM
+// CHECK-NEXT: # Relocation 0x0000000a
+// CHECK-NEXT: (('r_offset', 0x0000003d)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x00000013)
+// CHECK-NEXT: ),
+
+// Relocation 11 (foo@DTPOFF) is of type R_386_TLS_LDO_32
+// CHECK-NEXT: # Relocation 0x0000000b
+// CHECK-NEXT: (('r_offset', 0x00000043)
+// CHECK-NEXT: ('r_sym', 0x0000000d)
+// CHECK-NEXT: ('r_type', 0x00000020)
+// CHECK-NEXT: ),
+// Relocation 12 (calll 4096) is of type R_386_PC32
+// CHECK-NEXT: # Relocation 0x0000000c
+// CHECK-NEXT: (('r_offset', 0x00000048)
+// CHECK-NEXT: ('r_sym', 0x00000000)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ),
+// Relocation 13 (zed@GOT) is of type R_386_GOT32 and uses the symbol
+// CHECK-NEXT: # Relocation 0x0000000d
+// CHECK-NEXT: (('r_offset', 0x0000004e)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000003)
+// CHECK-NEXT: ),
+// Relocation 14 (zed@GOTOFF) is of type R_386_GOTOFF and uses the symbol
+// CHECK-NEXT: # Relocation 0x0000000e
+// CHECK-NEXT: (('r_offset', 0x00000054)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000009)
+// CHECK-NEXT: ),
+// Relocation 15 (zed@INDNTPOFF) is of type R_386_TLS_IE and uses the symbol
+// CHECK-NEXT: # Relocation 0x0000000f
+// CHECK-NEXT: (('r_offset', 0x0000005a)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x0000000f)
+// CHECK-NEXT: ),
+// Relocation 16 (zed@NTPOFF) is of type R_386_TLS_LE and uses the symbol
+// CHECK-NEXT: # Relocation 0x00000010
+// CHECK-NEXT: (('r_offset', 0x00000060)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000011)
+// CHECK-NEXT: ),
+// Relocation 17 (zed@GOTNTPOFF) is of type R_386_TLS_GOTIE and uses the symbol
+// CHECK-NEXT: # Relocation 0x00000011
+// CHECK-NEXT: (('r_offset', 0x00000066)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000010)
+// CHECK-NEXT: ),
+// Relocation 18 (zed@PLT) is of type R_386_PLT32 and uses the symbol
+// CHECK-NEXT: # Relocation 0x00000012
+// CHECK-NEXT: (('r_offset', 0x0000006b)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000004)
+// CHECK-NEXT: ),
+// Relocation 19 (zed@TLSGD) is of type R_386_TLS_GD and uses the symbol
+// CHECK-NEXT: # Relocation 0x00000013
+// CHECK-NEXT: (('r_offset', 0x00000071)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000012)
+// CHECK-NEXT: ),
+// Relocation 20 (zed@TLSLDM) is of type R_386_TLS_LDM and uses the symbol
+// CHECK-NEXT: # Relocation 0x00000014
+// CHECK-NEXT: (('r_offset', 0x00000077)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000013)
+// CHECK-NEXT: ),
+// Relocation 21 (zed@TPOFF) is of type R_386_TLS_LE_32 and uses the symbol
+// CHECK-NEXT:# Relocation 0x00000015
+// CHECK-NEXT: (('r_offset', 0x0000007d)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000022)
+// CHECK-NEXT: ),
+// Relocation 22 (zed@DTPOFF) is of type R_386_TLS_LDO_32 and uses the symbol
+// CHECK-NEXT: Relocation 0x00000016
+// CHECK-NEXT: (('r_offset', 0x00000083)
+// CHECK-NEXT: ('r_sym', 0x00000004)
+// CHECK-NEXT: ('r_type', 0x00000020)
+// CHECK-NEXT: ),
+// Relocation 23 ($bar) is of type R_386_32 and uses the section
+// CHECK-NEXT: Relocation 0x00000017
+// CHECK-NEXT: (('r_offset',
+// CHECK-NEXT: ('r_sym',
+// CHECK-NEXT: ('r_type', 0x00000001)
+// CHECK-NEXT: ),
+
+ .text
+bar:
+ leal .Lfoo@GOTOFF(%ebx), %eax
+
+ .global bar2
+bar2:
+ calll bar2@PLT
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ movb bar3@GOTOFF(%ebx), %al
+
+ .type bar3,@object
+ .local bar3
+ .comm bar3,1,1
+
+ movl bar2j@GOT(%eax), %eax
+
+ leal foo@TLSGD(, %ebx,1), %eax
+ movl $foo@TPOFF, %edx
+ movl foo@INDNTPOFF, %ecx
+ addl foo@NTPOFF(%eax), %eax
+ addl foo@GOTNTPOFF(%ebx), %ecx
+ leal foo@TLSLDM(%ebx), %eax
+ leal foo@DTPOFF(%eax), %edx
+ calll 4096
+ movl zed@GOT(%eax), %eax
+ movl zed@GOTOFF(%eax), %eax
+ movl zed@INDNTPOFF(%eax), %eax
+ movl zed@NTPOFF(%eax), %eax
+ movl zed@GOTNTPOFF(%eax), %eax
+ call zed@PLT
+ movl zed@TLSGD(%eax), %eax
+ movl zed@TLSLDM(%eax), %eax
+ movl zed@TPOFF(%eax), %eax
+ movl zed@DTPOFF(%eax), %eax
+ pushl $bar
+
+ .section zedsec,"awT",@progbits
+zed:
+ .long 0
+
+ .section .rodata.str1.16,"aMS",@progbits,1
+.Lfoo:
+ .asciz "bool llvm::llvm_start_multithreaded()"
diff --git a/test/MC/ELF/relocation.s b/test/MC/ELF/relocation.s
new file mode 100644
index 0000000..dabe721
--- /dev/null
+++ b/test/MC/ELF/relocation.s
@@ -0,0 +1,114 @@
+// 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.
+
+bar:
+ movl $bar, %edx # R_X86_64_32
+ movq $bar, %rdx # R_X86_64_32S
+ movq $bar, bar(%rip) # R_X86_64_32S
+ movl bar, %edx # R_X86_64_32S
+ movq bar, %rdx # R_X86_64_32S
+.long bar # R_X86_64_32
+ leaq foo@GOTTPOFF(%rip), %rax # R_X86_64_GOTTPOFF
+ leaq foo@TLSGD(%rip), %rax # R_X86_64_TLSGD
+ leaq foo@TPOFF(%rax), %rax # R_X86_64_TPOFF32
+ leaq foo@TLSLD(%rip), %rdi # R_X86_64_TLSLD
+ leaq foo@dtpoff(%rax), %rcx # R_X86_64_DTPOFF32
+ pushq $bar
+ movq foo(%rip), %rdx
+ leaq foo-bar(%r14),%r14
+
+
+// CHECK: # Section 0x00000001
+// CHECK: (('sh_name', 0x00000001) # '.text'
+
+// CHECK: # Symbol 0x00000002
+// CHECK: (('st_name', 0x00000000) # ''
+// CHECK: ('st_bind', 0x00000000)
+// CHECK: ('st_type', 0x00000003)
+// CHECK: ('st_other', 0x00000000)
+// CHECK: ('st_shndx', 0x00000001)
+
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000001)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend',
+
+// CHECK: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000008)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend',
+
+// CHECK: # Relocation 0x00000002
+// CHECK-NEXT: (('r_offset', 0x00000013)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend',
+
+// CHECK: # Relocation 0x00000003
+// CHECK-NEXT: (('r_offset', 0x0000001a)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend',
+
+// CHECK: # Relocation 0x00000004
+// CHECK-NEXT: (('r_offset', 0x00000022)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend',
+
+// CHECK: # Relocation 0x00000005
+// CHECK-NEXT: (('r_offset', 0x00000026)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend',
+
+// CHECK: # Relocation 0x00000006
+// CHECK-NEXT: (('r_offset', 0x0000002d)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000016)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+
+// CHECK: # Relocation 0x00000007
+// CHECK-NEXT: (('r_offset', 0x00000034)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000013)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+
+// CHECK: # Relocation 0x00000008
+// CHECK-NEXT: (('r_offset', 0x0000003b)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000017)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+
+// CHECK: # Relocation 0x00000009
+// CHECK-NEXT: (('r_offset', 0x00000042)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000014)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+
+// CHECK: # Relocation 0x0000000a
+// CHECK-NEXT: (('r_offset', 0x00000049)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000015)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+
+// CHECK: # Relocation 0x0000000b
+// CHECK-NEXT: (('r_offset', 0x0000004e)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+
+// CHECK: # Relocation 0x0000000c
+// CHECK-NEXT: (('r_offset', 0x00000055)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+
+// CHECK: # Relocation 0x0000000d
+// CHECK-NEXT: (('r_offset', 0x0000005c)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0x0000005c)
diff --git a/test/MC/ELF/rename.s b/test/MC/ELF/rename.s
new file mode 100644
index 0000000..3606560
--- /dev/null
+++ b/test/MC/ELF/rename.s
@@ -0,0 +1,46 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// When doing a rename, all the checks for where the relocation should go
+// should be performed with the original symbol. Only if we decide to relocate
+// with the symbol we should then use the renamed one.
+
+// This is a regression test for a bug where we used bar5@@@zed when deciding
+// if we should relocate with the symbol or with the section and we would then
+// not produce a relocation with .text.
+
+defined1:
+defined3:
+ .symver defined3, bar5@@@zed
+ .long defined3
+
+ .global defined1
+
+// Section 1 is .text
+// CHECK: # Section 0x00000001
+// CHECK-NEXT: (('sh_name', 0x00000001) # '.text'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000040)
+// CHECK-NEXT: ('sh_size', 0x00000004)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000004)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+
+// Symbol 2 is section 1
+// CHECK: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+
+// The relocation uses symbol 2
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000000)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
diff --git a/test/MC/ELF/section.s b/test/MC/ELF/section.s
new file mode 100644
index 0000000..861dc4f
--- /dev/null
+++ b/test/MC/ELF/section.s
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that these names are accepted.
+
+.section .note.GNU-stack,"",@progbits
+.section .note.GNU-stack2,"",%progbits
+.section .note.GNU-,"",@progbits
+.section -.note.GNU,"",@progbits
+
+// CHECK: ('sh_name', 0x00000012) # '.note.GNU-stack'
+// CHECK: ('sh_name', 0x00000022) # '.note.GNU-stack2'
+// CHECK: ('sh_name', 0x00000033) # '.note.GNU-'
+// CHECK: ('sh_name', 0x0000003e) # '-.note.GNU'
+
+// Test that the defaults are used
+
+.section .init
+.section .fini
+.section .rodata
+.section zed, ""
+
+// CHECK: (('sh_name', 0x00000049) # '.init'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x0000000b
+// CHECK-NEXT: (('sh_name', 0x0000004f) # '.fini'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000006)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x0000000c
+// CHECK-NEXT: (('sh_name', 0x00000055) # '.rodata'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Section 0x0000000d
+// CHECK-NEXT: (('sh_name', 0x0000005d) # 'zed'
+// CHECK-NEXT: ('sh_type', 0x00000001)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+
+.section .note.test,"",@note
+// CHECK: (('sh_name', 0x00000061) # '.note.test'
+// CHECK-NEXT: ('sh_type', 0x00000007)
+// CHECK-NEXT: ('sh_flags', 0x00000000)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+
+// Test that we can parse these
+foo:
+bar:
+.section .text.foo,"axG",@progbits,foo,comdat
+.section .text.bar,"axMG",@progbits,42,bar,comdat
+
+// Test that the default values are not used
+
+.section .eh_frame,"a",@unwind
+
+// CHECK: (('sh_name', 0x00000080) # '.eh_frame'
+// CHECK-NEXT: ('sh_type', 0x70000001)
+// CHECK-NEXT: ('sh_flags', 0x00000002)
+// CHECK-NEXT: ('sh_addr', 0x00000000)
+// CHECK-NEXT: ('sh_offset', 0x00000050)
+// CHECK-NEXT: ('sh_size', 0x00000000)
+// CHECK-NEXT: ('sh_link', 0x00000000)
+// CHECK-NEXT: ('sh_info', 0x00000000)
+// CHECK-NEXT: ('sh_addralign', 0x00000001)
+// CHECK-NEXT: ('sh_entsize', 0x00000000)
+// CHECK-NEXT: ),
+
+// Test that we handle the strings like gas
+.section bar-"foo"
+.section "foo"
+
+// CHECK: ('sh_name', 0x0000008a) # 'bar-"foo"'
+// CHECK: ('sh_name', 0x00000094) # 'foo'
diff --git a/test/MC/ELF/set.s b/test/MC/ELF/set.s
new file mode 100644
index 0000000..69d6c91
--- /dev/null
+++ b/test/MC/ELF/set.s
@@ -0,0 +1,34 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+// Test that we emit the correct value.
+
+.set kernbase,0xffffffff80000000
+
+// CHECK: (('st_name', 0x00000001) # 'kernbase'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x0000fff1)
+// CHECK-NEXT: ('st_value', 0xffffffff80000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+
+// Test that we accept .set of a symbol after it has been used in a statement.
+
+ jmp foo
+ .set foo, bar
+
+// or a .quad
+
+ .quad foo2
+ .set foo2,bar2
+
+// Test that there is an undefined reference to bar
+// CHECK: (('st_name', 0x0000000a) # '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: ),
diff --git a/test/MC/ELF/sleb.s b/test/MC/ELF/sleb.s
new file mode 100644
index 0000000..00e5b4b
--- /dev/null
+++ b/test/MC/ELF/sleb.s
@@ -0,0 +1,29 @@
+// RUN: llvm-mc -filetype=obj -triple i686-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck -check-prefix=ELF_32 %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck -check-prefix=ELF_64 %s
+// RUN: llvm-mc -filetype=obj -triple i386-apple-darwin9 %s -o - | macho-dump --dump-section-data | FileCheck -check-prefix=MACHO_32 %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-apple-darwin9 %s -o - | macho-dump --dump-section-data | FileCheck -check-prefix=MACHO_64 %s
+
+ .text
+foo:
+ .sleb128 0
+ .sleb128 1
+ .sleb128 -1
+ .sleb128 63
+ .sleb128 -64
+
+ .sleb128 64
+ .sleb128 -65
+
+ .sleb128 8191
+ .sleb128 -8192
+
+ .sleb128 8193
+
+// ELF_32: ('sh_name', 0x00000001) # '.text'
+// ELF_32: ('_section_data', '00017f3f 40c000bf 7fff3f80 4081c000')
+// ELF_64: ('sh_name', 0x00000001) # '.text'
+// ELF_64: ('_section_data', '00017f3f 40c000bf 7fff3f80 4081c000')
+// MACHO_32: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// MACHO_32: ('_section_data', '00017f3f 40c000bf 7fff3f80 4081c000')
+// MACHO_64: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// MACHO_64: ('_section_data', '00017f3f 40c000bf 7fff3f80 4081c000')
diff --git a/test/MC/ELF/symref.s b/test/MC/ELF/symref.s
new file mode 100644
index 0000000..b99e71b
--- /dev/null
+++ b/test/MC/ELF/symref.s
@@ -0,0 +1,165 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+defined1:
+defined2:
+defined3:
+ .symver defined1, bar1@zed
+ .symver undefined1, bar2@zed
+
+ .symver defined2, bar3@@zed
+
+ .symver defined3, bar5@@@zed
+ .symver undefined3, bar6@@@zed
+
+ .long defined1
+ .long undefined1
+ .long defined2
+ .long defined3
+ .long undefined3
+
+ .global global1
+ .symver global1, g1@@zed
+global1:
+
+
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000013) # 'bar1@zed'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000025) # 'bar3@@zed'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000003
+// CHECK-NEXT: (('st_name', 0x0000002f) # 'bar5@@zed'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000001) # 'defined1'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x0000000a) # 'defined2'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000002)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000008
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000003)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000009
+// CHECK-NEXT: (('st_name', 0x0000004a) # 'g1@@zed'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000014)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000a
+// CHECK-NEXT: (('st_name', 0x00000042) # 'global1'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000014)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000b
+// CHECK-NEXT: (('st_name', 0x0000001c) # 'bar2@zed'
+// 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 0x0000000c
+// CHECK-NEXT: (('st_name', 0x00000039) # 'bar6@zed'
+// 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:])
+
+// CHECK: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000000)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000004)
+// CHECK-NEXT: ('r_sym', 0x0000000b)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000002
+// CHECK-NEXT: (('r_offset', 0x00000008)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000003
+// CHECK-NEXT: (('r_offset', 0x0000000c)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000004
+// CHECK-NEXT: (('r_offset', 0x00000010)
+// CHECK-NEXT: ('r_sym', 0x0000000c)
+// CHECK-NEXT: ('r_type', 0x0000000a)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT:])
diff --git a/test/MC/ELF/tls-i386.s b/test/MC/ELF/tls-i386.s
new file mode 100644
index 0000000..459d4cc
--- /dev/null
+++ b/test/MC/ELF/tls-i386.s
@@ -0,0 +1,64 @@
+// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that all symbols are of type STT_TLS.
+
+ movl foo1@NTPOFF(%eax), %eax
+ movl foo2@GOTNTPOFF(%eax), %eax
+ movl foo3@TLSGD(%eax), %eax
+ movl foo4@TLSLDM(%eax), %eax
+ movl foo5@TPOFF(%eax), %eax
+ movl foo6@DTPOFF(%eax), %eax
+
+// CHECK: (('st_name', 0x00000001) # 'foo1'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000006) # 'foo2'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x0000000b) # 'foo3'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000008
+// CHECK-NEXT: (('st_name', 0x00000010) # 'foo4'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000009
+// CHECK-NEXT: (('st_name', 0x00000015) # 'foo5'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000a
+// CHECK-NEXT: (('st_name', 0x0000001a) # 'foo6'
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/tls.s b/test/MC/ELF/tls.s
new file mode 100644
index 0000000..2517a5b
--- /dev/null
+++ b/test/MC/ELF/tls.s
@@ -0,0 +1,48 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that all symbols are of type STT_TLS.
+
+ leaq foo1@TLSGD(%rip), %rdi
+ leaq foo2@GOTTPOFF(%rip), %rdi
+ leaq foo3@TLSLD(%rip), %rdi
+
+ .section .zed,"awT",@progbits
+foobar:
+ .long 43
+
+// CHECK: (('st_name', 0x00000010) # 'foobar'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000004)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+
+// CHECK: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo1'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// 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 0x00000008
+// CHECK-NEXT: (('st_name', 0x00000006) # 'foo2'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// 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 0x00000009
+// CHECK-NEXT: (('st_name', 0x0000000b) # 'foo3'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000006)
+// 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/type.s b/test/MC/ELF/type.s
new file mode 100644
index 0000000..4b98c02
--- /dev/null
+++ b/test/MC/ELF/type.s
@@ -0,0 +1,32 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that both % and @ are accepted.
+ .global foo
+ .type foo,%function
+foo:
+
+ .global bar
+ .type bar,@object
+bar:
+
+// Test that gnu_unique_object is accepted.
+ .type zed,@gnu_unique_object
+
+// CHECK: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000005) # 'bar'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// 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', 0x00000002)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/uleb.s b/test/MC/ELF/uleb.s
new file mode 100644
index 0000000..1e4734b
--- /dev/null
+++ b/test/MC/ELF/uleb.s
@@ -0,0 +1,22 @@
+// RUN: llvm-mc -filetype=obj -triple i686-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck -check-prefix=ELF_32 %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck -check-prefix=ELF_64 %s
+// RUN: llvm-mc -filetype=obj -triple i386-apple-darwin9 %s -o - | macho-dump --dump-section-data | FileCheck -check-prefix=MACHO_32 %s
+// RUN: llvm-mc -filetype=obj -triple x86_64-apple-darwin9 %s -o - | macho-dump --dump-section-data | FileCheck -check-prefix=MACHO_64 %s
+
+ .text
+foo:
+ .uleb128 0
+ .uleb128 1
+ .uleb128 127
+ .uleb128 128
+ .uleb128 16383
+ .uleb128 16384
+
+// ELF_32: ('sh_name', 0x00000001) # '.text'
+// ELF_32: ('_section_data', '00017f80 01ff7f80 8001')
+// ELF_64: ('sh_name', 0x00000001) # '.text'
+// ELF_64: ('_section_data', '00017f80 01ff7f80 8001')
+// MACHO_32: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// MACHO_32: ('_section_data', '00017f80 01ff7f80 8001')
+// MACHO_64: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+// MACHO_64: ('_section_data', '00017f80 01ff7f80 8001')
diff --git a/test/MC/ELF/undef.s b/test/MC/ELF/undef.s
new file mode 100644
index 0000000..fc3a2d2
--- /dev/null
+++ b/test/MC/ELF/undef.s
@@ -0,0 +1,46 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test which symbols should be in the symbol table
+
+ .long .Lsym1
+.Lsym2:
+.Lsym3:
+.Lsym4 = .Lsym2 - .Lsym3
+ .long .Lsym4
+
+ .type .Lsym5,@object
+ .type sym6,@object
+ .long sym6
+
+ .section .rodata.str1.1,"aMS",@progbits,1
+.Lsym7:
+.Lsym8:
+
+ .text
+ movsd .Lsym8(%rip), %xmm1
+
+// CHECK: ('_symbols', [
+// CHECK-NEXT: # Symbol 0x00000000
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000001
+// CHECK-NEXT: (('st_name', 0x0000000d) # '.Lsym8'
+// CHECK: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000003
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000001) # '.Lsym1'
+// CHECK: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000008) # 'sym6'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000001)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000000)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: ])
diff --git a/test/MC/ELF/undef2.s b/test/MC/ELF/undef2.s
new file mode 100644
index 0000000..9544fbc
--- /dev/null
+++ b/test/MC/ELF/undef2.s
@@ -0,0 +1,10 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that this produces an undefined reference to .Lfoo
+
+ je .Lfoo
+
+// CHECK: ('_symbols', [
+// CHECK: (('st_name', 0x00000001) # '.Lfoo'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK: (('sh_name', 0x00000024) # '.strtab'
diff --git a/test/MC/ELF/weak.s b/test/MC/ELF/weak.s
new file mode 100644
index 0000000..67e9b18
--- /dev/null
+++ b/test/MC/ELF/weak.s
@@ -0,0 +1,30 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that this produces a weak undefined symbol.
+
+ .weak foo
+ .long foo
+
+// And that bar is after all local symbols and has non zero value.
+ .weak bar
+bar:
+
+//CHECK: # Symbol 0x00000004
+//CHECK-NEXT: (('st_name', 0x00000005) # 'bar'
+//CHECK-NEXT: ('st_bind', 0x00000002)
+//CHECK-NEXT: ('st_type', 0x00000000)
+//CHECK-NEXT: ('st_other', 0x00000000)
+//CHECK-NEXT: ('st_shndx', 0x00000001)
+//CHECK-NEXT: ('st_value', 0x0000000000000004)
+//CHECK-NEXT: ('st_size', 0x0000000000000000)
+//CHECK-NEXT: ),
+//CHECK-NEXT: # Symbol 0x00000005
+//CHECK: (('st_name', 0x00000001) # 'foo'
+//CHECK-NEXT: ('st_bind', 0x00000002)
+//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: ])
diff --git a/test/MC/ELF/weakref-plt.s b/test/MC/ELF/weakref-plt.s
new file mode 100644
index 0000000..26ba3f6
--- /dev/null
+++ b/test/MC/ELF/weakref-plt.s
@@ -0,0 +1,8 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+ .weakref bar,foo
+ call bar@PLT
+
+// CHECK: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
+// CHECK-NEXT: ('st_bind', 0x00000002)
diff --git a/test/MC/ELF/weakref-reloc.s b/test/MC/ELF/weakref-reloc.s
new file mode 100644
index 0000000..c7cd764
--- /dev/null
+++ b/test/MC/ELF/weakref-reloc.s
@@ -0,0 +1,49 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// Test that the relocations point to the correct symbols. We used to get the
+// symbol index wrong for weakrefs when creating _GLOBAL_OFFSET_TABLE_.
+
+ .weakref bar,foo
+ call zed@PLT
+ call bar
+
+// CHECK: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000009) # '_GLOBAL_OFFSET_TABLE_'
+// 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', 0x00000002)
+// 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 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000005) # 'zed'
+// 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: # Relocation 0x00000000
+// CHECK-NEXT: (('r_offset', 0x00000001)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000004)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 0x00000001
+// CHECK-NEXT: (('r_offset', 0x00000006)
+// CHECK-NEXT: ('r_sym', 0x00000005)
+// CHECK-NEXT: ('r_type', 0x00000002)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)
+// CHECK-NEXT: ),
diff --git a/test/MC/ELF/weakref.s b/test/MC/ELF/weakref.s
new file mode 100644
index 0000000..aea10d1
--- /dev/null
+++ b/test/MC/ELF/weakref.s
@@ -0,0 +1,234 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
+
+// This is a long test that checks that the aliases created by weakref are
+// never in the symbol table and that the only case it causes a symbol to
+// be output as a weak undefined symbol is if that variable is not defined
+// in this file and all the references to it are done via the alias.
+
+ .weakref foo1, bar1
+
+ .weakref foo2, bar2
+ .long bar2
+
+ .weakref foo3, bar3
+ .long foo3
+
+ .weakref foo4, bar4
+ .long foo4
+ .long bar4
+
+ .weakref foo5, bar5
+ .long bar5
+ .long foo5
+
+bar6:
+ .weakref foo6, bar6
+
+bar7:
+ .weakref foo7, bar7
+ .long bar7
+
+bar8:
+ .weakref foo8, bar8
+ .long foo8
+
+bar9:
+ .weakref foo9, bar9
+ .long foo9
+ .long bar9
+
+bar10:
+ .global bar10
+ .weakref foo10, bar10
+ .long bar10
+ .long foo10
+
+bar11:
+ .global bar11
+ .weakref foo11, bar11
+
+bar12:
+ .global bar12
+ .weakref foo12, bar12
+ .long bar12
+
+bar13:
+ .global bar13
+ .weakref foo13, bar13
+ .long foo13
+
+bar14:
+ .global bar14
+ .weakref foo14, bar14
+ .long foo14
+ .long bar14
+
+bar15:
+ .global bar15
+ .weakref foo15, bar15
+ .long bar15
+ .long foo15
+
+// CHECK: # Symbol 0x00000000
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// 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 0x00000001
+// CHECK-NEXT: (('st_name', 0x00000015) # 'bar6'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000018)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000002
+// CHECK-NEXT: (('st_name', 0x0000001a) # 'bar7'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000018)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000003
+// CHECK-NEXT: (('st_name', 0x0000001f) # 'bar8'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x000000000000001c)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000004
+// CHECK-NEXT: (('st_name', 0x00000024) # 'bar9'
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000020)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000005
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000006
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000002)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000007
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_bind', 0x00000000)
+// CHECK-NEXT: ('st_type', 0x00000003)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000003)
+// CHECK-NEXT: ('st_value', 0x0000000000000000)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000008
+// CHECK-NEXT: (('st_name', 0x00000029) # 'bar10'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000028)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x00000009
+// CHECK-NEXT: (('st_name', 0x0000002f) # 'bar11'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000030)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000a
+// CHECK-NEXT: (('st_name', 0x00000035) # 'bar12'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000030)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000b
+// CHECK-NEXT: (('st_name', 0x0000003b) # 'bar13'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000034)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000c
+// CHECK-NEXT: (('st_name', 0x00000041) # 'bar14'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000038)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000d
+// CHECK-NEXT: (('st_name', 0x00000047) # 'bar15'
+// CHECK-NEXT: ('st_bind', 0x00000001)
+// CHECK-NEXT: ('st_type', 0x00000000)
+// CHECK-NEXT: ('st_other', 0x00000000)
+// CHECK-NEXT: ('st_shndx', 0x00000001)
+// CHECK-NEXT: ('st_value', 0x0000000000000040)
+// CHECK-NEXT: ('st_size', 0x0000000000000000)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Symbol 0x0000000e
+// CHECK-NEXT: (('st_name', 0x00000001) # 'bar2'
+// 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 0x0000000f
+// CHECK-NEXT: (('st_name', 0x00000006) # 'bar3'
+// CHECK-NEXT: ('st_bind', 0x00000002)
+// 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 0x00000010
+// CHECK-NEXT: (('st_name', 0x0000000b) # 'bar4'
+// 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 0x00000011
+// CHECK-NEXT: (('st_name', 0x00000010) # 'bar5'
+// 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: ])
diff --git a/test/MC/ELF/zero.s b/test/MC/ELF/zero.s
new file mode 100644
index 0000000..adf21f8
--- /dev/null
+++ b/test/MC/ELF/zero.s
@@ -0,0 +1,16 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
+
+.zero 4
+.zero 1,42
+
+// CHECK: ('sh_name', 0x00000001) # '.text'
+// CHECK: ('sh_type', 0x00000001)
+// CHECK: ('sh_flags', 0x00000006)
+// CHECK: ('sh_addr', 0x00000000)
+// CHECK: ('sh_offset', 0x00000040)
+// CHECK: ('sh_size', 0x00000005)
+// CHECK: ('sh_link', 0x00000000)
+// CHECK: ('sh_info', 0x00000000)
+// CHECK: ('sh_addralign', 0x00000004)
+// CHECK: ('sh_entsize', 0x00000000)
+// CHECK: ('_section_data', '00000000 2a')
OpenPOWER on IntegriCloud