1 ## This test checks how we handle the --bb-addr-map option on relocatable
4 # RUN: yaml2obj %s -o %t1.o
5 # RUN: llvm-readobj %t1.o --bb-addr-map | FileCheck %s
8 # CHECK-NEXT: Function {
10 # CHECK-NEXT: Name: <?>
11 # CHECK-NEXT: BB Ranges [
13 # CHECK-NEXT: Base Address: 0x0
14 # CHECK-NEXT: BB Entries [
17 # CHECK-NEXT: Offset: 0x0
18 # CHECK-NEXT: Size: 0xF
19 # CHECK-NEXT: HasReturn: Yes
20 # CHECK-NEXT: HasTailCall: No
21 # CHECK-NEXT: IsEHPad: No
22 # CHECK-NEXT: CanFallThrough: No
23 # CHECK-NEXT: HasIndirectBranch: No
29 # CHECK-NEXT: Function {
30 # CHECK-NEXT: At: 0x10
31 # CHECK-NEXT: Name: <?>
32 # CHECK-NEXT: BB Ranges [
34 # CHECK-NEXT: Base Address: 0x10
35 # CHECK-NEXT: BB Entries [
38 # CHECK-NEXT: Offset: 0x0
39 # CHECK-NEXT: Size: 0x11
40 # CHECK-NEXT: HasReturn: No
41 # CHECK-NEXT: HasTailCall: No
42 # CHECK-NEXT: IsEHPad: No
43 # CHECK-NEXT: CanFallThrough: Yes
44 # CHECK-NEXT: HasIndirectBranch: No
61 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
62 - Name: .llvm_bb_addr_map
63 Type: SHT_LLVM_BB_ADDR_MAP
80 - Name: .rela.llvm_bb_addr_map
82 Flags: [ SHF_INFO_LINK ]
84 Info: .llvm_bb_addr_map
104 ## Check that if we have a relocatable file and no relocation section for
105 ## a SHT_LLVM_BB_ADDR_MAP section, we give the appropriate warnings.
116 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
117 - Name: .llvm_bb_addr_map
118 Type: SHT_LLVM_BB_ADDR_MAP
121 # RUN: yaml2obj %s --docnum=2 -o %t2.o
122 # RUN: llvm-readobj %t2.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=NO-RELA -DFILE=%t2.o
124 # NO-RELA: warning: '[[FILE]]': unable to get relocation section for SHT_LLVM_BB_ADDR_MAP section with index 2
126 ## Check that we get a warning if we expect a relocation and it is not present.
137 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
138 - Name: .llvm_bb_addr_map
139 Type: SHT_LLVM_BB_ADDR_MAP
149 - Name: .rela.llvm_bb_addr_map
151 Flags: [ SHF_INFO_LINK ]
152 Info: .llvm_bb_addr_map
154 # RUN: yaml2obj %s --docnum=3 -o %t3.o
155 # RUN: llvm-readobj %t3.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=MISSING-RELOCATION -DFILE=%t3.o
157 # MISSING-RELOCATION: warning: '[[FILE]]': unable to dump SHT_LLVM_BB_ADDR_MAP section with index 2: failed to get relocation data for offset: 2 in section SHT_LLVM_BB_ADDR_MAP section with index 2
159 ## Check that if we have a missing relocated section, we fail and give the
160 ## appropriate warning.
169 - Name: .rela.llvm_bb_addr_map
171 Flags: [ SHF_INFO_LINK ]
174 # RUN: yaml2obj %s --docnum=4 -o %t4.o
175 # RUN: llvm-readobj %t4.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=NO-RELOCATED-SECTION -DFILE=%t4.o
177 # NO-RELOCATED-SECTION: warning: '[[FILE]]': failed to get SHT_LLVM_BB_ADDR_MAP section(s): SHT_RELA section with index 1: failed to get a relocated section: invalid section index: 255
179 ## Check that if we have an ET_DYN file with a .rela.dyn section, we don't get
180 ## a warning about a missing relocation section and can get the baddrmap data.
192 - Name: .llvm_bb_addr_map
193 Type: SHT_LLVM_BB_ADDR_MAP
194 Flags: [ SHF_LINK_ORDER ]
205 # RUN: yaml2obj %s --docnum=5 -o %t5.o
206 # RUN: llvm-readobj %t5.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=ET-DYN-NO-WARNING -DFILE=%t5.o
208 # ET-DYN-NO-WARNING: BBAddrMap [
209 # ET-DYN-NO-WARNING: Function {
210 # ET-DYN-NO-WARNING: At: 0xF
211 # ET-DYN-NO-WARNING: Name: <?>
212 # ET-DYN-NO-WARNING: BB Ranges [
213 # ET-DYN-NO-WARNING: {
214 # ET-DYN-NO-WARNING: Base Address: 0xF
215 # ET-DYN-NO-WARNING: BB Entries [
216 # ET-DYN-NO-WARNING: {
217 # ET-DYN-NO-WARNING: ID: 0
218 # ET-DYN-NO-WARNING: Offset: 0x0
219 # ET-DYN-NO-WARNING: Size: 0xF
220 # ET-DYN-NO-WARNING: HasReturn: Yes
221 # ET-DYN-NO-WARNING: HasTailCall: No
222 # ET-DYN-NO-WARNING: IsEHPad: No
223 # ET-DYN-NO-WARNING: CanFallThrough: No
224 # ET-DYN-NO-WARNING: HasIndirectBranch: No
225 # ET-DYN-NO-WARNING: }
226 # ET-DYN-NO-WARNING: ]
227 # ET-DYN-NO-WARNING: }
228 # ET-DYN-NO-WARNING: ]
229 # ET-DYN-NO-WARNING: }
230 # ET-DYN-NO-WARNING: ]