946119bb2483de1df7478ebac645e4a6ded95d64
[oota-llvm.git] / test / MC / ELF / gen-dwarf.s
1 // RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r | FileCheck %s
2 // RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM %s
3
4
5 // Test that on ELF:
6 // 1. the debug info has a relocation to debug_abbrev and one to to debug_line.
7 // 2. the debug_aranges has relocations to text and debug_line.
8
9
10     .text
11     .globl foo
12     .type foo, @function
13     .align 4
14 foo:
15     ret
16     .size foo, .-foo
17
18 // CHECK:      Relocations [
19 // CHECK:        Section ({{[^ ]+}}) .rel.debug_info {
20 // CHECK-NEXT:     0x6 R_386_32 .debug_abbrev 0x0
21 // CHECK-NEXT:     0xC R_386_32 .debug_line 0x0
22 // CHECK:        }
23 // CHECK-NEXT:   Section ({{[^ ]+}}) .rel.debug_aranges {
24 // CHECK-NEXT:     0x6 R_386_32 .debug_info 0x0
25 // CHECK-NEXT:     0x10 R_386_32 .text 0x0
26 // CHECK-NEXT:   }
27 // CHECK:      ]
28
29 // First instance of the section is just to give it a label for debug_aranges to refer to
30 // ASM: .section .debug_info
31
32 // ASM: .section .debug_abbrev
33 // ASM-NEXT: [[ABBREV_LABEL:.Ltmp[0-9]+]]
34
35 // Second instance of the section has the CU
36 // ASM: .section .debug_info
37 // Dwarf version
38 // ASM: .short 2
39 // ASM-NEXT: .long [[ABBREV_LABEL]]
40 // First .byte 1 is the abbreviation number for the compile_unit abbrev
41 // ASM: .byte 1
42 // ASM-NEXT: .long [[LINE_LABEL:.L[a-z0-9]+]]
43
44 // ASM: .section .debug_line
45 // ASM-NEXT: [[LINE_LABEL]]
46