2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 # RUN: ld.lld -r %t -o %tout
4 # RUN: llvm-objdump -d %tout | FileCheck --check-prefix=DISASM %s
5 # RUN: llvm-readobj -r %t | FileCheck -check-prefix=RELOC %s
6 # RUN: llvm-readobj --symbols -r %tout | FileCheck -check-prefix=SYMBOL %s
9 # DISASM-NEXT: 0: {{.*}} callq 0
10 # DISASM-NEXT: 5: {{.*}} callq 0
11 # DISASM-NEXT: a: {{.*}} callq 0
12 # DISASM-NEXT: f: {{.*}} callq 0
13 # DISASM-NEXT: 14: {{.*}} callq 0
14 # DISASM-NEXT: 19: {{.*}} callq 0
15 # DISASM-NEXT: 1e: {{.*}} callq 0
16 # DISASM-NEXT: 23: {{.*}} callq 0
17 # DISASM-NEXT: 28: {{.*}} callq 0
18 # DISASM-NEXT: 2d: {{.*}} callq 0
19 # DISASM-NEXT: 32: {{.*}} callq 0
20 # DISASM-NEXT: 37: {{.*}} callq 0
22 # DISASM-NEXT: Disassembly of section foo:
25 # DISASM-NEXT: 0: 90 nop
26 # DISASM-NEXT: 1: 90 nop
27 # DISASM-NEXT: 2: 90 nop
29 # DISASM-NEXT: Disassembly of section bar:
32 # DISASM-NEXT: 0: 90 nop
33 # DISASM-NEXT: 1: 90 nop
34 # DISASM-NEXT: 2: 90 nop
36 # RELOC: Relocations [
37 # RELOC-NEXT: Section ({{.*}}) .rela.text {
38 # RELOC-NEXT: 0x1 R_X86_64_PC32 __start_foo 0xFFFFFFFFFFFFFFFC
39 # RELOC-NEXT: 0x6 R_X86_64_PC32 __stop_foo 0xFFFFFFFFFFFFFFFC
40 # RELOC-NEXT: 0xB R_X86_64_PC32 __start_bar 0xFFFFFFFFFFFFFFFC
41 # RELOC-NEXT: 0x10 R_X86_64_PC32 __stop_bar 0xFFFFFFFFFFFFFFFC
42 # RELOC-NEXT: 0x15 R_X86_64_PC32 __start_doo 0xFFFFFFFFFFFFFFFC
43 # RELOC-NEXT: 0x1A R_X86_64_PC32 __stop_doo 0xFFFFFFFFFFFFFFFC
44 # RELOC-NEXT: 0x1F R_X86_64_PC32 __preinit_array_start 0xFFFFFFFFFFFFFFFC
45 # RELOC-NEXT: 0x24 R_X86_64_PC32 __preinit_array_end 0xFFFFFFFFFFFFFFFC
46 # RELOC-NEXT: 0x29 R_X86_64_PC32 __init_array_start 0xFFFFFFFFFFFFFFFC
47 # RELOC-NEXT: 0x2E R_X86_64_PC32 __init_array_end 0xFFFFFFFFFFFFFFFC
48 # RELOC-NEXT: 0x33 R_X86_64_PC32 __fini_array_start 0xFFFFFFFFFFFFFFFC
49 # RELOC-NEXT: 0x38 R_X86_64_PC32 __fini_array_end 0xFFFFFFFFFFFFFFFC
53 # SYMBOL: Relocations [
54 # SYMBOL-NEXT: Section ({{.*}}) .rela.text {
55 # SYMBOL-NEXT: 0x1 R_X86_64_PC32 __start_foo 0xFFFFFFFFFFFFFFFC
56 # SYMBOL-NEXT: 0x6 R_X86_64_PC32 __stop_foo 0xFFFFFFFFFFFFFFFC
57 # SYMBOL-NEXT: 0xB R_X86_64_PC32 __start_bar 0xFFFFFFFFFFFFFFFC
58 # SYMBOL-NEXT: 0x10 R_X86_64_PC32 __stop_bar 0xFFFFFFFFFFFFFFFC
59 # SYMBOL-NEXT: 0x15 R_X86_64_PC32 __start_doo 0xFFFFFFFFFFFFFFFC
60 # SYMBOL-NEXT: 0x1A R_X86_64_PC32 __stop_doo 0xFFFFFFFFFFFFFFFC
61 # SYMBOL-NEXT: 0x1F R_X86_64_PC32 __preinit_array_start 0xFFFFFFFFFFFFFFFC
62 # SYMBOL-NEXT: 0x24 R_X86_64_PC32 __preinit_array_end 0xFFFFFFFFFFFFFFFC
63 # SYMBOL-NEXT: 0x29 R_X86_64_PC32 __init_array_start 0xFFFFFFFFFFFFFFFC
64 # SYMBOL-NEXT: 0x2E R_X86_64_PC32 __init_array_end 0xFFFFFFFFFFFFFFFC
65 # SYMBOL-NEXT: 0x33 R_X86_64_PC32 __fini_array_start 0xFFFFFFFFFFFFFFFC
66 # SYMBOL-NEXT: 0x38 R_X86_64_PC32 __fini_array_end 0xFFFFFFFFFFFFFFFC
70 # SYMBOL: Name: __start_foo
71 # SYMBOL-NEXT: Value: 0x0
72 # SYMBOL-NEXT: Size: 0
73 # SYMBOL-NEXT: Binding: Global
74 # SYMBOL-NEXT: Type: None
75 # SYMBOL-NEXT: Other: 0
76 # SYMBOL-NEXT: Section: Undefined
78 # SYMBOL-NEXT: Symbol {
79 # SYMBOL-NEXT: Name: __stop_foo
80 # SYMBOL-NEXT: Value: 0x0
81 # SYMBOL-NEXT: Size: 0
82 # SYMBOL-NEXT: Binding: Global
83 # SYMBOL-NEXT: Type: None
84 # SYMBOL-NEXT: Other: 0
85 # SYMBOL-NEXT: Section: Undefined
87 # SYMBOL-NEXT: Symbol {
88 # SYMBOL-NEXT: Name: __start_bar
89 # SYMBOL-NEXT: Value: 0x0
90 # SYMBOL-NEXT: Size: 0
91 # SYMBOL-NEXT: Binding: Global
92 # SYMBOL-NEXT: Type: None
93 # SYMBOL-NEXT: Other: 0
94 # SYMBOL-NEXT: Section: Undefined
96 # SYMBOL-NEXT: Symbol {
97 # SYMBOL-NEXT: Name: __stop_bar
98 # SYMBOL-NEXT: Value: 0x0
99 # SYMBOL-NEXT: Size: 0
100 # SYMBOL-NEXT: Binding: Global
101 # SYMBOL-NEXT: Type: None
102 # SYMBOL-NEXT: Other: 0
103 # SYMBOL-NEXT: Section: Undefined
105 # SYMBOL-NEXT: Symbol {
106 # SYMBOL-NEXT: Name: __start_doo
107 # SYMBOL-NEXT: Value: 0x0
108 # SYMBOL-NEXT: Size: 0
109 # SYMBOL-NEXT: Binding: Global
110 # SYMBOL-NEXT: Type: None
111 # SYMBOL-NEXT: Other: 0
112 # SYMBOL-NEXT: Section: Undefined
114 # SYMBOL-NEXT: Symbol {
115 # SYMBOL-NEXT: Name: __stop_doo
116 # SYMBOL-NEXT: Value: 0x0
117 # SYMBOL-NEXT: Size: 0
118 # SYMBOL-NEXT: Binding: Global
119 # SYMBOL-NEXT: Type: None
120 # SYMBOL-NEXT: Other: 0
121 # SYMBOL-NEXT: Section: Undefined
123 # SYMBOL-NEXT: Symbol {
124 # SYMBOL-NEXT: Name: __preinit_array_start
125 # SYMBOL-NEXT: Value: 0x0
126 # SYMBOL-NEXT: Size: 0
127 # SYMBOL-NEXT: Binding: Global
128 # SYMBOL-NEXT: Type: None
129 # SYMBOL-NEXT: Other: 0
130 # SYMBOL-NEXT: Section: Undefined
132 # SYMBOL-NEXT: Symbol {
133 # SYMBOL-NEXT: Name: __preinit_array_end
134 # SYMBOL-NEXT: Value: 0x0
135 # SYMBOL-NEXT: Size: 0
136 # SYMBOL-NEXT: Binding: Global
137 # SYMBOL-NEXT: Type: None
138 # SYMBOL-NEXT: Other: 0
139 # SYMBOL-NEXT: Section: Undefined
141 # SYMBOL-NEXT: Symbol {
142 # SYMBOL-NEXT: Name: __init_array_start
143 # SYMBOL-NEXT: Value: 0x0
144 # SYMBOL-NEXT: Size: 0
145 # SYMBOL-NEXT: Binding: Global
146 # SYMBOL-NEXT: Type: None
147 # SYMBOL-NEXT: Other: 0
148 # SYMBOL-NEXT: Section: Undefined
150 # SYMBOL-NEXT: Symbol {
151 # SYMBOL-NEXT: Name: __init_array_end
152 # SYMBOL-NEXT: Value: 0x0
153 # SYMBOL-NEXT: Size: 0
154 # SYMBOL-NEXT: Binding: Global
155 # SYMBOL-NEXT: Type: None
156 # SYMBOL-NEXT: Other: 0
157 # SYMBOL-NEXT: Section: Undefined
160 # SYMBOL-NEXT: Name: __fini_array_start
161 # SYMBOL-NEXT: Value: 0x0
162 # SYMBOL-NEXT: Size: 0
163 # SYMBOL-NEXT: Binding: Global
164 # SYMBOL-NEXT: Type: None
165 # SYMBOL-NEXT: Other: 0
166 # SYMBOL-NEXT: Section: Undefined
168 # SYMBOL-NEXT: Symbol {
169 # SYMBOL-NEXT: Name: __fini_array_end
170 # SYMBOL-NEXT: Value: 0x0
171 # SYMBOL-NEXT: Size: 0
172 # SYMBOL-NEXT: Binding: Global
173 # SYMBOL-NEXT: Type: None
174 # SYMBOL-NEXT: Other: 0
175 # SYMBOL-NEXT: Section: Undefined
182 .long __start_foo - . -4
184 .long __stop_foo - . -4
187 .long __start_bar - . -4
189 .long __stop_bar - . -4
192 .long __start_doo - . -4
194 .long __stop_doo - . -4
197 .long __preinit_array_start - . -4
199 .long __preinit_array_end - . -4
201 .long __init_array_start - . -4
203 .long __init_array_end - . -4
205 .long __fini_array_start - . -4
207 .long __fini_array_end - . -4