• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=obj -o - | elf-dump | FileCheck %s
2
3
4// Test that on ELF:
5// 1. the debug info has a relocation to debug_abbrev and one to to debug_line.
6// 2. the debug_aranges has relocations to text and debug_line.
7
8
9    .text
10    .globl foo
11    .type foo, @function
12    .align 4
13foo:
14    ret
15    .size foo, .-foo
16
17// Section 4 is .debug_line
18// CHECK:       # Section 4
19// CHECK-NEXT:  # '.debug_line'
20
21
22
23// The two relocations, one to symbol 6 and one to 4
24// CHECK:         # '.rel.debug_info'
25// CHECK-NEXT:   ('sh_type',
26// CHECK-NEXT:   ('sh_flags'
27// CHECK-NEXT:   ('sh_addr',
28// CHECK-NEXT:   ('sh_offset',
29// CHECK-NEXT:   ('sh_size',
30// CHECK-NEXT:   ('sh_link',
31// CHECK-NEXT:   ('sh_info',
32// CHECK-NEXT:   ('sh_addralign',
33// CHECK-NEXT:   ('sh_entsize',
34// CHECK-NEXT:   ('_relocations', [
35// CHECK-NEXT:    # Relocation 0
36// CHECK-NEXT:    (('r_offset', 0x00000006)
37// CHECK-NEXT:     ('r_sym', 0x000006)
38// CHECK-NEXT:     ('r_type', 0x01)
39// CHECK-NEXT:    ),
40// CHECK-NEXT:    # Relocation 1
41// CHECK-NEXT:    (('r_offset', 0x0000000c)
42// CHECK-NEXT:     ('r_sym', 0x000004)
43// CHECK-NEXT:     ('r_type', 0x01)
44// CHECK-NEXT:    ),
45
46
47// Section 8 is .debug_abbrev
48// CHECK:       # Section 8
49// CHECK-NEXT:  (('sh_name', 0x00000001) # '.debug_abbrev'
50
51// Section 9 is .debug_aranges
52// CHECK:       # Section 9
53// CHECK-NEXT:  (('sh_name', 0x0000001e) # '.debug_aranges'
54
55// Two relocations in .debug_aranges, one to text and one to debug_info.
56// CHECK:       # '.rel.debug_aranges'
57// CHECK:       # Relocation 0
58// CHECK-NEXT:  (('r_offset', 0x00000006)
59// CHECK-NEXT:   ('r_sym', 0x000005)
60// CHECK-NEXT:   ('r_type', 0x01)
61// CHECK-NEXT:  ),
62// CHECK-NEXT:  # Relocation 1
63// CHECK-NEXT: (('r_offset', 0x00000010)
64// CHECK-NEXT:  ('r_sym', 0x000001)
65// CHECK-NEXT:  ('r_type', 0x01)
66// CHECK-NEXT: ),
67
68// Symbol 1 is section 1 (.text)
69// CHECK:         # Symbol 1
70// CHECK-NEXT:    (('st_name', 0x00000000) # ''
71// CHECK-NEXT:     ('st_value', 0x00000000)
72// CHECK-NEXT:     ('st_size', 0x00000000)
73// CHECK-NEXT:     ('st_bind', 0x0)
74// CHECK-NEXT:     ('st_type', 0x3)
75// CHECK-NEXT:     ('st_other', 0x00)
76// CHECK-NEXT:     ('st_shndx', 0x0001)
77// CHECK-NEXT:    ),
78
79// Symbol 4 is section 4 (.debug_line)
80// CHECK:         # Symbol 4
81// CHECK-NEXT:    (('st_name', 0x00000000) # ''
82// CHECK-NEXT:     ('st_value', 0x00000000)
83// CHECK-NEXT:     ('st_size', 0x00000000)
84// CHECK-NEXT:     ('st_bind', 0x0)
85// CHECK-NEXT:     ('st_type', 0x3)
86// CHECK-NEXT:     ('st_other', 0x00)
87// CHECK-NEXT:     ('st_shndx', 0x0004)
88// CHECK-NEXT:    ),
89
90// Symbol 5 is section 6 (.debug_info)
91// CHECK:         # Symbol 5
92// CHECK-NEXT:    (('st_name', 0x00000000) # ''
93// CHECK-NEXT:     ('st_value', 0x00000000)
94// CHECK-NEXT:     ('st_size', 0x00000000)
95// CHECK-NEXT:     ('st_bind', 0x0)
96// CHECK-NEXT:     ('st_type', 0x3)
97// CHECK-NEXT:     ('st_other', 0x00)
98// CHECK-NEXT:     ('st_shndx', 0x0006)
99// CHECK-NEXT:    ),
100
101// Symbol 6 is section 8 (.debug_abbrev)
102// CHECK:         # Symbol 6
103// CHECK-NEXT:    (('st_name', 0x00000000) # ''
104// CHECK-NEXT:     ('st_value', 0x00000000)
105// CHECK-NEXT:     ('st_size', 0x00000000)
106// CHECK-NEXT:     ('st_bind', 0x0)
107// CHECK-NEXT:     ('st_type', 0x3)
108// CHECK-NEXT:     ('st_other', 0x00)
109// CHECK-NEXT:     ('st_shndx', 0x0008)
110// CHECK-NEXT:    ),
111