summaryrefslogtreecommitdiff
path: root/test/MC/ELF
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-02-28 21:13:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-02-28 21:13:05 +0000
commit489d67927172941bf59b9f4829ab8910814fea24 (patch)
treea36101a0f30fac4ccf07c8fd29794a78adad47c3 /test/MC/ELF
parent3c2e5f2140ade86ff353b27b37137d493f487558 (diff)
downloadllvm-489d67927172941bf59b9f4829ab8910814fea24.tar.gz
llvm-489d67927172941bf59b9f4829ab8910814fea24.tar.bz2
llvm-489d67927172941bf59b9f4829ab8910814fea24.tar.xz
On ELF, create relocations to the abbreviation and line sections when producing
debug info for assembly files. We were already doing the right thing when producing debug info for C/C++. ELF linkers don't know dwarf, so they depend on these relocations to produce valid dwarf output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ELF')
-rw-r--r--test/MC/ELF/gen-dwarf.s70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/MC/ELF/gen-dwarf.s b/test/MC/ELF/gen-dwarf.s
new file mode 100644
index 0000000000..b090e0802b
--- /dev/null
+++ b/test/MC/ELF/gen-dwarf.s
@@ -0,0 +1,70 @@
+// RUN: llvm-mc -g -triple i686-pc-linux-gnu %s -filetype=obj -o - | elf-dump | FileCheck %s
+
+
+// Test that on ELF the debug info has a relocation to debug_abbrev and one to
+// to debug_line.
+
+
+ .text
+ .globl foo
+ .type foo, @function
+ .align 4
+foo:
+ ret
+ .size foo, .-foo
+
+// Section 4 is .debug_line
+// CHECK: # Section 4
+// CHECK-NEXT: # '.debug_line'
+
+
+
+// The two relocations, one to symbol 6 and one to 4
+// CHECK: # '.rel.debug_info'
+// 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: ('_relocations', [
+// CHECK-NEXT: # Relocation 0
+// CHECK-NEXT: (('r_offset', 0x00000006)
+// CHECK-NEXT: ('r_sym', 0x000006)
+// CHECK-NEXT: ('r_type', 0x01)
+// CHECK-NEXT: ),
+// CHECK-NEXT: # Relocation 1
+// CHECK-NEXT: (('r_offset', 0x0000000c)
+// CHECK-NEXT: ('r_sym', 0x000004)
+// CHECK-NEXT: ('r_type', 0x01)
+// CHECK-NEXT: ),
+
+
+// Section 8 is .debug_abbrev
+// CHECK: # Section 8
+// CHECK-NEXT: (('sh_name', 0x00000001) # '.debug_abbrev'
+
+// Symbol 4 is section 4 (.debug_line)
+// CHECK: # Symbol 4
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x0)
+// CHECK-NEXT: ('st_type', 0x3)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0004)
+// CHECK-NEXT: ),
+
+// Symbol 6 is section 8 (.debug_abbrev)
+// CHECK: # Symbol 6
+// CHECK-NEXT: (('st_name', 0x00000000) # ''
+// CHECK-NEXT: ('st_value', 0x00000000)
+// CHECK-NEXT: ('st_size', 0x00000000)
+// CHECK-NEXT: ('st_bind', 0x0)
+// CHECK-NEXT: ('st_type', 0x3)
+// CHECK-NEXT: ('st_other', 0x00)
+// CHECK-NEXT: ('st_shndx', 0x0008)
+// CHECK-NEXT: ),